Skip to content

Commit

Permalink
Merge pull request #2 from ldennington/linux-install-fixes
Browse files Browse the repository at this point in the history
install from source: refactor install location and fix path
  • Loading branch information
m4ss1m0g authored Oct 2, 2023
2 parents e66805c + 720d347 commit 54f6b46
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/linux/Packaging.Linux/Packaging.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<PropertyGroup>
<InstallFromSource>false</InstallFromSource>
<InstallLocation>/usr/local</InstallLocation>
<InstallPrefix>/usr/local</InstallPrefix>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,8 +24,8 @@
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="CoreCompile" Condition="'$(OSPlatform)'=='linux'">
<Message Text="$(MSBuildProjectDirectory)\build.sh --install-from-source=$(InstallFromSource) --configuration='$(Configuration)' --version='$(Version)' --install-location='$(InstallLocation)'" Importance="High" />
<Exec Command="$(MSBuildProjectDirectory)\build.sh --install-from-source=$(InstallFromSource) --configuration='$(Configuration)' --version='$(Version)' --install-location='$(InstallLocation)'" />
<Message Text="$(MSBuildProjectDirectory)\build.sh --install-from-source=$(InstallFromSource) --configuration='$(Configuration)' --version='$(Version)' --install-prefix='$(InstallPrefix)'" Importance="High" />
<Exec Command="$(MSBuildProjectDirectory)\build.sh --install-from-source=$(InstallFromSource) --configuration='$(Configuration)' --version='$(Version)' --install-prefix='$(InstallPrefix)'" />
</Target>

<Target Name="CoreClean">
Expand Down
16 changes: 8 additions & 8 deletions src/linux/Packaging.Linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
*)
Expand All @@ -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
Expand All @@ -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"

Expand Down
22 changes: 11 additions & 11 deletions src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"

Expand Down Expand Up @@ -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/bin"

0 comments on commit 54f6b46

Please sign in to comment.