From 3b6b07dfaaa08d6aa2e2e64099afd36c55ba364c Mon Sep 17 00:00:00 2001 From: Lessley Date: Mon, 25 Sep 2023 10:26:46 -0600 Subject: [PATCH 1/2] 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 2/2] 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"