-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathinstall.sh
40 lines (31 loc) · 1.27 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/env bash
set -eo pipefail
SCCACHE_VERSION="${VERSION:-latest}";
SCCACHE_REPOSITORY="${REPOSITORY:-"mozilla/sccache"}";
# Ensure we're in this feature's directory during build
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# install global/common scripts
. ./common/install.sh;
check_packages jq wget ca-certificates bash-completion;
echo "Installing sccache...";
if test "$SCCACHE_VERSION" = latest; then
find_version_from_git_tags SCCACHE_VERSION "https://github.com/$SCCACHE_REPOSITORY";
elif test "$SCCACHE_VERSION" = dev; then
find_version_from_git_tags SCCACHE_VERSION "https://github.com/$SCCACHE_REPOSITORY" "" "" "-.*" "true";
fi
# Install sccache
wget --no-hsts -q -O- \
"https://github.com/$SCCACHE_REPOSITORY/releases/download/v$SCCACHE_VERSION/sccache-v$SCCACHE_VERSION-$(uname -m)-unknown-linux-musl.tar.gz" \
| tar -C /usr/bin -zf - --wildcards --strip-components=1 -x '*/sccache' \
&& chmod +x /usr/bin/sccache;
# export envvars in /etc/bash.bashrc
append_to_etc_bashrc "$(cat .bashrc)";
# export envvars in ~/.bashrc
append_to_all_bashrcs "$(cat .bashrc)";
# export envvars in /etc/profile.d
add_etc_profile_d_script sccache "$(cat .bashrc)";
# Clean up
# rm -rf /tmp/*;
rm -rf /var/tmp/*;
rm -rf /var/cache/apt/*;
rm -rf /var/lib/apt/lists/*;