From 5c50a73508a2cc63a13991e46e61526b1189a6aa Mon Sep 17 00:00:00 2001 From: Massimo Giambona Date: Tue, 12 Sep 2023 13:38:07 +0000 Subject: [PATCH 1/4] Support linux install path from src --- .../Packaging.Linux/Packaging.Linux.csproj | 4 ++-- src/linux/Packaging.Linux/build.sh | 9 +++++++-- .../Packaging.Linux/install-from-source.sh | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/linux/Packaging.Linux/Packaging.Linux.csproj b/src/linux/Packaging.Linux/Packaging.Linux.csproj index b9fb5ccd5..03189d26d 100644 --- a/src/linux/Packaging.Linux/Packaging.Linux.csproj +++ b/src/linux/Packaging.Linux/Packaging.Linux.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/src/linux/Packaging.Linux/build.sh b/src/linux/Packaging.Linux/build.sh index 3b179e22d..b6861409a 100755 --- a/src/linux/Packaging.Linux/build.sh +++ b/src/linux/Packaging.Linux/build.sh @@ -30,6 +30,10 @@ case "$i" in INSTALL_FROM_SOURCE="${i#*=}" shift # past argument=value ;; + --install-location=*) + INSTALL_LOCATION="${i#*=}" + shift # past argument=value + ;; *) # unknown option ;; @@ -50,10 +54,11 @@ SYMBOLS="$OUTDIR/payload.sym" "$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" || exit 1 if [ $INSTALL_FROM_SOURCE = true ]; then - INSTALL_LOCATION="/usr/local" + #INSTALL_LOCATION="/usr/local" + mkdir -p "$INSTALL_LOCATION" - echo "Installing..." + echo "Installing to $INSTALL_LOCATION" # Install directories INSTALL_TO="$INSTALL_LOCATION/share/gcm-core/" diff --git a/src/linux/Packaging.Linux/install-from-source.sh b/src/linux/Packaging.Linux/install-from-source.sh index e379a55f5..ab86159a3 100755 --- a/src/linux/Packaging.Linux/install-from-source.sh +++ b/src/linux/Packaging.Linux/install-from-source.sh @@ -6,6 +6,7 @@ # for additional details. set -e +installLocation=/usr/local is_ci= for i in "$@"; do case "$i" in @@ -13,15 +14,26 @@ for i in "$@"; do is_ci=true shift # Past argument=value ;; + --install-location=*) + installLocation="${i#*=}" + shift # past argument=value + ;; esac done + +# If pass the install-location check if it exists +if [! -d "$installLocation" ]; then + echo "The folder $installLocation do not exists" + exit +fi + # In non-ci scenarios, advertise what we will be doing and # give user the option to exit. if [ -z $is_ci ]; then echo "This script will download, compile, and install Git Credential Manager to: - /usr/local/bin + $installLocation/bin Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license" @@ -225,5 +237,5 @@ if [ -z "$DOTNET_ROOT" ]; then fi cd "$toplevel_path" -$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -add_to_PATH "/usr/local/bin" +$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:InstallLocation=$installLocation +add_to_PATH $installLocation From 53e2b48afb0c0a202b86f72d17ad8412b1875c06 Mon Sep 17 00:00:00 2001 From: Lessley Date: Mon, 18 Sep 2023 14:18:24 -0600 Subject: [PATCH 2/4] install from source: custom install location edits Update custom install to define a default path in `Packaging.Linux.csproj`. Include a few spelling/grammar/refactoring tweaks as well. --- src/linux/Packaging.Linux/Packaging.Linux.csproj | 1 + src/linux/Packaging.Linux/build.sh | 9 +++++---- src/linux/Packaging.Linux/install-from-source.sh | 9 ++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/linux/Packaging.Linux/Packaging.Linux.csproj b/src/linux/Packaging.Linux/Packaging.Linux.csproj index 03189d26d..c0a30e608 100644 --- a/src/linux/Packaging.Linux/Packaging.Linux.csproj +++ b/src/linux/Packaging.Linux/Packaging.Linux.csproj @@ -9,6 +9,7 @@ false + /usr/local diff --git a/src/linux/Packaging.Linux/build.sh b/src/linux/Packaging.Linux/build.sh index b6861409a..98e5c2f6e 100755 --- a/src/linux/Packaging.Linux/build.sh +++ b/src/linux/Packaging.Linux/build.sh @@ -40,6 +40,11 @@ case "$i" in esac done +# Ensure install location exists +if [! -d "$installLocation" ]; then + mkdir -p "$INSTALL_LOCATION" +fi + # Perform pre-execution checks CONFIGURATION="${CONFIGURATION:=Debug}" if [ -z "$VERSION" ]; then @@ -54,10 +59,6 @@ SYMBOLS="$OUTDIR/payload.sym" "$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" || exit 1 if [ $INSTALL_FROM_SOURCE = true ]; then - #INSTALL_LOCATION="/usr/local" - - mkdir -p "$INSTALL_LOCATION" - echo "Installing to $INSTALL_LOCATION" # Install directories diff --git a/src/linux/Packaging.Linux/install-from-source.sh b/src/linux/Packaging.Linux/install-from-source.sh index ab86159a3..f736514de 100755 --- a/src/linux/Packaging.Linux/install-from-source.sh +++ b/src/linux/Packaging.Linux/install-from-source.sh @@ -6,7 +6,6 @@ # for additional details. set -e -installLocation=/usr/local is_ci= for i in "$@"; do case "$i" in @@ -21,10 +20,14 @@ for i in "$@"; do esac done +# If install-location is not passed, use default value +if [ -z "$installLocation" ]; then + installLocation=/usr/local +fi -# If pass the install-location check if it exists +# Ensure install location exists if [! -d "$installLocation" ]; then - echo "The folder $installLocation do not exists" + echo "The folder $installLocation does not exist" exit fi From 3b6b07dfaaa08d6aa2e2e64099afd36c55ba364c Mon Sep 17 00:00:00 2001 From: Lessley Date: Mon, 25 Sep 2023 10:26:46 -0600 Subject: [PATCH 3/4] install from source: refactor install location Refactor references to "install location" to instead reference "install prefix," since we use this value as a prefix for multiple paths (rather than a static location). --- .../Packaging.Linux/Packaging.Linux.csproj | 6 ++--- src/linux/Packaging.Linux/build.sh | 16 +++++++------- .../Packaging.Linux/install-from-source.sh | 22 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/linux/Packaging.Linux/Packaging.Linux.csproj b/src/linux/Packaging.Linux/Packaging.Linux.csproj index c0a30e608..362ffc230 100644 --- a/src/linux/Packaging.Linux/Packaging.Linux.csproj +++ b/src/linux/Packaging.Linux/Packaging.Linux.csproj @@ -9,7 +9,7 @@ false - /usr/local + /usr/local @@ -24,8 +24,8 @@ - - + + diff --git a/src/linux/Packaging.Linux/build.sh b/src/linux/Packaging.Linux/build.sh index 98e5c2f6e..6672857d2 100755 --- a/src/linux/Packaging.Linux/build.sh +++ b/src/linux/Packaging.Linux/build.sh @@ -30,8 +30,8 @@ case "$i" in INSTALL_FROM_SOURCE="${i#*=}" shift # past argument=value ;; - --install-location=*) - INSTALL_LOCATION="${i#*=}" + --install-prefix=*) + INSTALL_PREFIX="${i#*=}" shift # past argument=value ;; *) @@ -40,9 +40,9 @@ case "$i" in esac done -# Ensure install location exists -if [! -d "$installLocation" ]; then - mkdir -p "$INSTALL_LOCATION" +# Ensure install prefix exists +if [! -d "$INSTALL_PREFIX" ]; then + mkdir -p "$INSTALL_PREFIX" fi # Perform pre-execution checks @@ -59,11 +59,11 @@ SYMBOLS="$OUTDIR/payload.sym" "$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" || exit 1 if [ $INSTALL_FROM_SOURCE = true ]; then - echo "Installing to $INSTALL_LOCATION" + echo "Installing to $INSTALL_PREFIX" # Install directories - INSTALL_TO="$INSTALL_LOCATION/share/gcm-core/" - LINK_TO="$INSTALL_LOCATION/bin/" + INSTALL_TO="$INSTALL_PREFIX/share/gcm-core/" + LINK_TO="$INSTALL_PREFIX/bin/" mkdir -p "$INSTALL_TO" "$LINK_TO" diff --git a/src/linux/Packaging.Linux/install-from-source.sh b/src/linux/Packaging.Linux/install-from-source.sh index f736514de..58a529b09 100755 --- a/src/linux/Packaging.Linux/install-from-source.sh +++ b/src/linux/Packaging.Linux/install-from-source.sh @@ -13,21 +13,21 @@ for i in "$@"; do is_ci=true shift # Past argument=value ;; - --install-location=*) - installLocation="${i#*=}" + --install-prefix=*) + installPrefix="${i#*=}" shift # past argument=value ;; esac done -# If install-location is not passed, use default value -if [ -z "$installLocation" ]; then - installLocation=/usr/local +# If install-prefix is not passed, use default value +if [ -z "$installPrefix" ]; then + installPrefix=/usr/local fi -# Ensure install location exists -if [! -d "$installLocation" ]; then - echo "The folder $installLocation does not exist" +# Ensure install directory exists +if [! -d "$installPrefix" ]; then + echo "The folder $installPrefix does not exist" exit fi @@ -36,7 +36,7 @@ fi if [ -z $is_ci ]; then echo "This script will download, compile, and install Git Credential Manager to: - $installLocation/bin + $installPrefix/bin Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license" @@ -240,5 +240,5 @@ if [ -z "$DOTNET_ROOT" ]; then fi cd "$toplevel_path" -$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:InstallLocation=$installLocation -add_to_PATH $installLocation +$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix +add_to_PATH $installPrefix From 720d34751323bf565670393ac06b84518cb6a5e6 Mon Sep 17 00:00:00 2001 From: Lessley Dennington Date: Mon, 25 Sep 2023 16:39:28 +0000 Subject: [PATCH 4/4] install from source: correct path addition Ensure the correct path for GCM is added to `PATH` at the end of the `install-from-source` script. --- src/linux/Packaging.Linux/install-from-source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux/Packaging.Linux/install-from-source.sh b/src/linux/Packaging.Linux/install-from-source.sh index 58a529b09..98fe7bc4d 100755 --- a/src/linux/Packaging.Linux/install-from-source.sh +++ b/src/linux/Packaging.Linux/install-from-source.sh @@ -241,4 +241,4 @@ fi cd "$toplevel_path" $sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix -add_to_PATH $installPrefix +add_to_PATH "$installPrefix/bin"