Skip to content

Commit 5c50a73

Browse files
committed
Support linux install path from src
1 parent afcb6b8 commit 5c50a73

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

src/linux/Packaging.Linux/Packaging.Linux.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
2424

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

3030
<Target Name="CoreClean">

src/linux/Packaging.Linux/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ case "$i" in
3030
INSTALL_FROM_SOURCE="${i#*=}"
3131
shift # past argument=value
3232
;;
33+
--install-location=*)
34+
INSTALL_LOCATION="${i#*=}"
35+
shift # past argument=value
36+
;;
3337
*)
3438
# unknown option
3539
;;
@@ -50,10 +54,11 @@ SYMBOLS="$OUTDIR/payload.sym"
5054
"$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" || exit 1
5155

5256
if [ $INSTALL_FROM_SOURCE = true ]; then
53-
INSTALL_LOCATION="/usr/local"
57+
#INSTALL_LOCATION="/usr/local"
58+
5459
mkdir -p "$INSTALL_LOCATION"
5560

56-
echo "Installing..."
61+
echo "Installing to $INSTALL_LOCATION"
5762

5863
# Install directories
5964
INSTALL_TO="$INSTALL_LOCATION/share/gcm-core/"

src/linux/Packaging.Linux/install-from-source.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,34 @@
66
# for additional details.
77
set -e
88

9+
installLocation=/usr/local
910
is_ci=
1011
for i in "$@"; do
1112
case "$i" in
1213
-y)
1314
is_ci=true
1415
shift # Past argument=value
1516
;;
17+
--install-location=*)
18+
installLocation="${i#*=}"
19+
shift # past argument=value
20+
;;
1621
esac
1722
done
1823

24+
25+
# If pass the install-location check if it exists
26+
if [! -d "$installLocation" ]; then
27+
echo "The folder $installLocation do not exists"
28+
exit
29+
fi
30+
1931
# In non-ci scenarios, advertise what we will be doing and
2032
# give user the option to exit.
2133
if [ -z $is_ci ]; then
2234
echo "This script will download, compile, and install Git Credential Manager to:
2335
24-
/usr/local/bin
36+
$installLocation/bin
2537
2638
Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license"
2739

@@ -225,5 +237,5 @@ if [ -z "$DOTNET_ROOT" ]; then
225237
fi
226238

227239
cd "$toplevel_path"
228-
$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true
229-
add_to_PATH "/usr/local/bin"
240+
$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:InstallLocation=$installLocation
241+
add_to_PATH $installLocation

0 commit comments

Comments
 (0)