-
Notifications
You must be signed in to change notification settings - Fork 183
/
install_s6init.sh
executable file
·43 lines (32 loc) · 1.16 KB
/
install_s6init.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
41
42
43
#!/bin/bash
set -e
### Sets up S6 supervisor.
S6_VERSION=${1:-${S6_VERSION:-"v2.1.0.2"}}
# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}
ARCH=$(dpkg --print-architecture)
if [ "$ARCH" = "arm64" ]; then
ARCH=aarch64
fi
DOWNLOAD_FILE=s6-overlay-${ARCH}.tar.gz
apt_install wget ca-certificates
## Set up S6 init system
if [ -f "/rocker_scripts/.s6_version" ] && [ "$S6_VERSION" = "$(cat /rocker_scripts/.s6_version)" ]; then
echo "S6 already installed"
else
wget -P /tmp/ "https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/${DOWNLOAD_FILE}"
## need the modified double tar now, see https://github.com/just-containers/s6-overlay/issues/288
tar hzxf /tmp/$DOWNLOAD_FILE -C / --exclude=usr/bin/execlineb
tar hzxf /tmp/$DOWNLOAD_FILE -C /usr ./bin/execlineb
echo "$S6_VERSION" >/rocker_scripts/.s6_version
fi
# Clean up
rm -rf /var/lib/apt/lists/*
rm -f /tmp/$DOWNLOAD_FILE