Created
May 28, 2017 16:52
-
-
Save thexa4/7ae7fd135029aaac6ed056b5ad2ed844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# postinst script for empires-gitlab-runner | |
# | |
# see: dh_installdeb(1) | |
set -e | |
# summary of how this script can be called: | |
# * <postinst> `configure' <most-recently-configured-version> | |
# * <old-postinst> `abort-upgrade' <new version> | |
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | |
# <new-version> | |
# * <postinst> `abort-remove' | |
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | |
# <failed-install-package> <version> `removing' | |
# <conflicting-package> <version> | |
# for details, see http://www.debian.org/doc/debian-policy/ or | |
# the debian-policy package | |
# source debconf library | |
. /usr/share/debconf/confmodule | |
case "$1" in | |
configure) | |
db_get empires-gitlab-runner/token | |
TOKEN="$RET" | |
gitlab-runner verify --delete > /dev/null || true | |
name=$(hostname --fqdn) | |
runners=$(gitlab-runner list 2>&1 | grep empires-deb-runner-linux || true) | |
if [ -z "$runners" ]; then | |
gitlab-runner register --non-interactive --name "empires-deb-runner-linux [$(uname -m)] ($name)" --url https://gitlab.com/ci --registration-token "$TOKEN" --executor shell | |
fi | |
( | |
mkdir -p /valve | |
cd /valve | |
rm steam-runtime* 2>/dev/null || true | |
if [ ! -d /valve/steam-runtime ]; then | |
echo "Downloading steam runtime" | |
wget http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz 2> /dev/null | |
unxz *.xz | |
mv *.tar runtime.tar | |
tar -xf runtime.tar | |
mv steam-runtime* steam-runtime | |
fi | |
cd steam-runtime | |
echo "Configuring steam runtime" | |
./setup.sh > /dev/null <<INPUTHERE | |
3 | |
1 | |
y | |
y | |
y | |
INPUTHERE | |
ln -s /valve/steam-runtime/tool.sh /valve/steam-runtime/objcopy | |
echo "done" | |
) | |
;; | |
abort-upgrade|abort-remove|abort-deconfigure) | |
exit 0 | |
;; | |
*) | |
echo "postinst called with unknown argument \`$1'" >&2 | |
exit 1 | |
;; | |
esac | |
# dh_installdeb will replace this with shell code automatically | |
# generated by other debhelper scripts. | |
#DEBHELPER# | |
db_stop | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment