diff options
author | Holger Levsen <holger@layer-acht.org> | 2017-01-21 11:24:46 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2017-01-21 11:24:46 +0100 |
commit | 9be2b23d7960a4cc9317e36fbc00f90f92c53e5c (patch) | |
tree | 58fa4c8bf6bbe21844c3d800bfa9fbd5741c36eb /hosts/wbd0-armhf-rb/etc | |
parent | 327478e4785753238e48055d20452d3c9136b6a5 (diff) | |
download | jenkins.debian.net-9be2b23d7960a4cc9317e36fbc00f90f92c53e5c.tar.xz |
reproducible Debian: refactor, use one common rc.local script for all hosts
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'hosts/wbd0-armhf-rb/etc')
-rwxr-xr-x | hosts/wbd0-armhf-rb/etc/rc.local | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/hosts/wbd0-armhf-rb/etc/rc.local b/hosts/wbd0-armhf-rb/etc/rc.local index 1c4ece10..8fb854c5 100755 --- a/hosts/wbd0-armhf-rb/etc/rc.local +++ b/hosts/wbd0-armhf-rb/etc/rc.local @@ -8,9 +8,75 @@ # # In order to enable or disable this script just change the execution # bits. + +send_back_to_the_future() { + # stop ntp + service ntp stop || true + # disable systemd date services (and don't fail if systemd ain't running) + systemctl disable systemd-timesyncd + systemctl disable systemd-timedated + systemctl stop systemd-timesyncd || true + systemctl stop systemd-timedated || true + # set correct date + ntpdate -b de.pool.ntp.org + # set fake date + date --set="+398 days +6 hours + 23 minutes" + # disable check for outdated packages as in the future (like this) + # packages from security.d.o will appear outdated always… + ln -sf /bin/true /usr/local/bin/dsa-check-packages + # finally report success + echo "$(date -u) - system is running in the future now" | mail -s "$(hostname -f) in the future" root +} + +put_schroots_on_tmpfs() { + # keep schroot sessions on tmpfs + [ -L /var/lib/schroot ] || echo "$(date -u) - /var/lib/schroot is not a link (to /srv/workspace/varlibschroot/) as it should, please fix manually" + mkdir -p /srv/workspace/varlibschroot + cd /srv/workspace/varlibschroot || exit 1 + mkdir -p mount session union unpack + mkdir -p union/overlay union/underlay +} + +# +# init, notify about reboots +# +MESSAGE="$(hostname -f) rebooted" +echo "$(date -u) - system was rebooted" | mail -s "$MESSAGE" root + # -# By default this script does nothing. +# notify jenkins reboots on irc +# +if [ "$(hostname)" = "jenkins" ] ; then + for channel in debian-qa debian-reproducible ; do + kgb-client --conf /srv/jenkins/kgb/$channel.conf --relay-msg "$MESSAGE" + done +fi + +# +# run some hosts in the future +# +case $(hostname) in + codethink-sled9*) send_back_to_the_future ;; + codethink-sled11*) send_back_to_the_future ;; + codethink-sled13*) send_back_to_the_future ;; + codethink-sled15*) send_back_to_the_future ;; + profitbricks-build4*) send_back_to_the_future ;; + profitbricks-build5*) send_back_to_the_future ;; + profitbricks-build6*) send_back_to_the_future ;; + profitbricks-build15*) send_back_to_the_future ;; + profitbricks-build16*) send_back_to_the_future ;; + *) ;; +esac -echo "$(date -u) - system was rebooted" | mail -s "$(hostname -f) rebooted" root +# +# put schroots on tmpfs for non debian hosts +# +case $(hostname) in + profitbricks-build3*) put_schroots_on_tmpfs ;; + profitbricks-build4*) put_schroots_on_tmpfs ;; + profitbricks-build7*) put_schroots_on_tmpfs ;; + *) ;; +esac +echo "$(date -u) - system booted up." exit 0 |