10000 Scripts: add InstallFromSource.sh by derrickstolee · Pull Request #427 · microsoft/scalar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Scripts: add InstallFromSource.sh #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 25, 2020
Merged
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
86 changes: 86 additions & 0 deletions Scripts/Linux/InstallFromSource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash

# To test on a Debian-based Linux machine:
#
# ./InstallFromSource.sh
# (outputs Git, GCM, and Scalar versions)
#
# Small clone should work:
# scalar clone https://dev.azure.com/gvfs/ci/_git/ForTests
#
# Big clone for authenticated repo should work:
# scalar clone <url>
#
# Note: if you are using a headless Linux machine, then GCM Core will
# not be able to store your credentials. Instead, create a PAT and
# use that for password (multiple times). This will be fixed soon.

# Nuke previous data
rm -rf git-vfs*.deb gcmcore-linux*.deb packages*.deb

echo "Installing dotnet SDK 3.1"

sudo apt-get update -qq
sudo apt-get install -y apt-transport-https && sudo apt-get update -qq

sudo apt-get install -y lsb-release wget
LSB_VERSION=$(lsb_release -rs | awk '/^[0-9]+\.[0-9]+$/ { print }')
if [ -z "$LSB_VERSION" ]
then
LSB_VERSION="20.04"
fi
wget https://packages.microsoft.com/config/ubuntu/"$LSB_VERSION"/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

if sudo apt-get install -y dotnet-sdk-3.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Azure Pipelines agent, we use the install scripts to get .NET on the box. They've done some heavy medium lifting across various Linux flavors to get prereqs sorted and whatnot. This script looks pretty Ubuntu/Debian flavored so perhaps you 🤷‍♂️ but I thought I'd mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting! If we have any more problems with installing dotnet I will definitely replace these with something like wget https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh && ./dotnet-install.sh

then
echo "dotnet successfully installed"
else
echo "error: failed to install dotnet"
echo "please follow instructions here to install: https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu"
exit 1
fi

echo "Installing Git from microsoft/git"
wget https://github.com/microsoft/git/releases/download/v2.28.0.vfs.0.0/git-vfs_2.28.0.vfs.0.0.deb

if ! sudo dpkg -i ./git-vfs_2.28.0.vfs.0.0.deb
then
echo "error: failed to install microsoft/git"
exit 1
fi

echo "Installing GCM Core"
wget https://github.com/microsoft/Git-Credential-Manager-Core/releases/download/v2.0.246-beta/gcmcore-linux_amd64.2.0.246.34937.deb

if ! sudo dpkg -i ./gcmcore-linux*.deb
then
echo "error: failed to install GCM core"
exit 1
fi

echo "Cloning and installing Scalar"
mkdir scalar
git clone --filter=blob:none https://github.com/microsoft/scalar scalar/src
(
cd scalar/src
dotnet restore
dotnet build --configuration Release --no-restore
dotnet test --configuration Release --no-restore --verbosity normal
sudo rm -rf /usr/local/lib/scalar
sudo mkdir /usr/local/lib/scalar
sudo cp -r ../out/Scalar/bin/Release/netcoreapp3.1/* /usr/local/lib/scalar/
sudo rm -rf /usr/local/bin/scalar
sudo ln -s /usr/local/lib/scalar/scalar /usr/local/bin/scalar
sudo chmod a+x /usr/local/bin/scalar
)

git version
git-credential-manager-core --version


if ! scalar version
then
echo "Scalar was not properly installed. Please double-check the build output"
exit 1
fi
0