summaryrefslogtreecommitdiffstats
path: root/hosts/odxu4a-armhf-rb/etc/rc.local
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant@debian.org>2017-10-05 10:58:12 -0700
committerMattia Rizzolo <mattia@debian.org>2017-10-07 13:01:12 +0200
commitee0200ef35f086dcb6862deae831053e6f79ca3a (patch)
treeffbea97612404d7854d6a216ef7871a720f71c97 /hosts/odxu4a-armhf-rb/etc/rc.local
parent90f1ac45dbcafcfd2ef2a4838e9ef523cdba99d6 (diff)
downloadjenkins.debian.net-ee0200ef35f086dcb6862deae831053e6f79ca3a.tar.xz
reproducible debian: Rename armhf host odxu4 to odxu4a.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
Diffstat (limited to 'hosts/odxu4a-armhf-rb/etc/rc.local')
-rwxr-xr-xhosts/odxu4a-armhf-rb/etc/rc.local105
1 files changed, 105 insertions, 0 deletions
diff --git a/hosts/odxu4a-armhf-rb/etc/rc.local b/hosts/odxu4a-armhf-rb/etc/rc.local
new file mode 100755
index 00000000..aa6bfefc
--- /dev/null
+++ b/hosts/odxu4a-armhf-rb/etc/rc.local
@@ -0,0 +1,105 @@
+#!/bin/sh -e
+#
+# rc.local
+#
+# This script is executed at the end of each multiuser runlevel.
+# Make sure that the script will "exit 0" on success or any other
+# value on error.
+
+set -x
+
+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 || true
+ systemctl disable systemd-timedated || true
+ systemctl disable ntp.service || true
+ systemctl stop systemd-timesyncd || true
+ systemctl stop systemd-timedated || true
+ systemctl stop ntp.service || true
+ # set correct date
+ ntpdate -b de.pool.ntp.org
+ # set fake date
+ date --set="+398 days +6 hours + 23 minutes"
+ # 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
+}
+
+fixup_shm() {
+ # this is always harmless
+ chmod 1777 /dev/shm
+}
+
+fixup_mtu() {
+ # only act on systems which have eth0
+ if ip link show eth0 >/dev/null 2>&1 ; then
+ # if MTU != 1500 set it to 1500
+ if [ -z "$(ip link show eth0 | grep 'eth0:' | grep 'mtu 1500 ' || true)" ] ; then
+ ip link set dev eth0 mtu 1500
+ fi
+ ip link show eth0
+ fi
+}
+
+#
+# init, notify about reboots
+#
+MESSAGE="$(hostname -f) rebooted"
+echo "$(date -u) - system was rebooted" | mail -s "$MESSAGE" root
+
+#
+# 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
+
+#
+# fixup /(dev|run)/shm if needed
+#
+fixup_shm
+
+#
+# fixup eth0's MTU if needed
+fixup_mtu
+
+#
+# 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
+
+#
+# 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 booted up."
+exit 0