Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/linux/Packaging.Linux/Packaging.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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

<ItemGroup>
Expand All @@ -23,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)'" Importance="High" />
<Exec Command="$(MSBuildProjectDirectory)\build.sh --install-from-source=$(InstallFromSource) --configuration='$(Configuration)' --version='$(Version)'" />
<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
18 changes: 12 additions & 6 deletions src/linux/Packaging.Linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@ case "$i" in
INSTALL_FROM_SOURCE="${i#*=}"
shift # past argument=value
;;
--install-prefix=*)
INSTALL_PREFIX="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done

# Ensure install prefix exists
if [! -d "$INSTALL_PREFIX" ]; then
mkdir -p "$INSTALL_PREFIX"
fi

# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"
if [ -z "$VERSION" ]; then
Expand All @@ -50,14 +59,11 @@ 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..."
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
21 changes: 18 additions & 3 deletions src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,30 @@ for i in "$@"; do
is_ci=true
shift # Past argument=value
;;
--install-prefix=*)
installPrefix="${i#*=}"
shift # past argument=value
;;
esac
done

# If install-prefix is not passed, use default value
if [ -z "$installPrefix" ]; then
installPrefix=/usr/local
fi

# Ensure install directory exists
if [! -d "$installPrefix" ]; then
echo "The folder $installPrefix does not exist"
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
$installPrefix/bin

Git Credential Manager is licensed under the MIT License: https://aka.ms/gcm/license"

Expand Down Expand Up @@ -225,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
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:installPrefix=$installPrefix
add_to_PATH "$installPrefix/bin"