blob: 7a3ac2822d36df7080748e871defab14f2c8ee55 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/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.
#
# 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
}
fixup_shm() {
# this is always harmless
chmod 1777 /dev/shm
}
#
# 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
#
# 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
#
# fixup /(dev|run)/shm if needed
#
fixup_shm
#
# 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
|