blob: 2293045ddf6647d37c2764c3b9183a1cdb95f29d (
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
#! /bin/sh
#
# initscripts postinst
#
set -e
. /lib/init/vars.sh
. /lib/init/tmpfs.sh
. /lib/init/mount-functions.sh
# Set this as a variable to hide from lintian the fact that we're removing
# it; otherwise, a wrong lintian check + ftp fatal autoreject prevents us
# from uploading this legitimate code, even though the previous upload was
# accepted without incident.
devshm=/dev/shm
case "$1" in
configure)
PREV_VER=$2
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
esac
umask 022
compat_link () {
SRC=$1
DEST=$2
ssrc="$(stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
sdest="$(stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"
if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
echo "guest environment detected: Linking $DEST to $SRC"
(
if [ -e $DEST ]; then
if [ -L $DEST ]; then
echo "$DEST is already a symlink; not replacing with link to $SRC"
exit 0
elif [ -d $DEST ]; then
rmdir $DEST || exit 1
else
echo "$DEST isn't a directory or a symlink"
exit 1
fi
fi
ln -fs $SRC $DEST
) || {
echo "Can't symlink $DEST to $SRC; please fix manually."
return 1
}
if which restorecon >/dev/null 2>&1; then
restorecon "$DEST"
fi
fi
return 0
}
# In 2.88dsf-23 the "mountoverflowtmp" script was dropped entirely.
if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-23" ; then
update-rc.d -f mountoverflowtmp remove >/dev/null
fi
# In 2.88dsf-41+jessie1 the "mtab.sh" script was dropped entirely.
if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-41+jessie1" ; then
update-rc.d -f mtab.sh remove >/dev/null
fi
# Comment out obsolete options in rcS.
if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-23" ; then
if [ -f /etc/default/rcS ]; then
sed -i \
-e 's:^\(RAMRUN=.*\)$:#\1 # OBSOLETE; see /etc/default/tmpfs and tmpfs(5).:' \
-e 's:^\(RAMLOCK=.*\)$:#\1 # OBSOLETE; see /etc/default/tmpfs and tmpfs(5).:' \
-e ':^RAMSHM=:i# OBSOLETE; see /etc/default/tmpfs and tmpfs(5).' \
-e ':^RAMTMP=:i# OBSOLETE; see /etc/default/tmpfs and tmpfs(5).' \
-e 's:^\(EDITMOTD=.*\)$:#\1 # OBSOLETE.:' /etc/default/rcS
fi
fi
INITSCRIPTS="mountkernfs.sh brightness hostname.sh mountdevsubfs.sh checkroot.sh \
checkroot-bootclean.sh checkfs.sh mountall.sh mountall-bootclean.sh \
mountnfs.sh mountnfs-bootclean.sh bootmisc.sh urandom halt reboot \
umountroot umountfs umountnfs.sh sendsigs killprocs single motd \
bootlogs rc.local rmnologin"
for F in $INITSCRIPTS; do
if [ -x /etc/init.d/$F ]; then
update-rc.d $F defaults >/dev/null || exit $?
fi
done
mkdir -p /etc/systemd/system
for F in $INITSCRIPTS; do
SERVICE="$(basename $F .sh).service"
if [ -x /etc/init.d/$F ] && [ ! -e /etc/systemd/system/$SERVICE ]; then
ln -s /dev/null /etc/systemd/system/$SERVICE
fi
done
#
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
# versions. We have the same functionality in mount{kern,devsub}fs.sh
#
#
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
# mountkernfs.sh and mountdevsubfs.sh. It was removed completely in
# 2.86.ds1-16.
#
for F in mountkernfs devpts.sh mountvirtfs
do
rm -f /etc/init.d/$F
update-rc.d $F remove >/dev/null
done
#
# When installing for the first time or upgrading from a version
# before or equal to 2.88dsf-14, a reboot is needed to make the /run
# tmpfs available. Flag this using notify-reboot-required. /run is
# available in some form before the reboot, so the need for a reboot
# isn't particularly urgent.
#
if dpkg --compare-versions "$PREV_VER" le "2.88dsf-13.3" \
&& [ -x /usr/share/update-notifier/notify-reboot-required ]; then
/usr/share/update-notifier/notify-reboot-required
fi
#
# Create initial log files
#
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
for F in /var/log/dmesg /var/log/fsck/checkroot /var/log/fsck/checkfs
do
if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
then
echo "(Nothing has been logged yet.)" >| "$F"
chown root:adm "$F"
chmod 640 "$F"
fi
done
#
# Create /dev/pts, /dev/shm directories
#
if [ "$(uname -s)" = Linux ]
then
#
# Only create /dev/{pts,shm} if /dev is on the
# root file system. If some package has mounted a
# seperate /dev (ramfs from udev, devfs) it is
# responsible for the presence of those subdirs.
# (it is OK for these to fail under fakechroot)
#
if ! mountpoint -q /dev
then
[ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; }
[ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; }
fi
fi
#
# Install runsystem.sysv on Hurd.
#
if [ "$(uname -s)" = GNU ]
then
get_runsystem() {
update-alternatives --query runsystem \
| sed -n -e '/^Value:/s|.*\.||p'
}
current="$(get_runsystem)"
update-alternatives --quiet \
--install /etc/hurd/runsystem runsystem \
/etc/hurd/runsystem.sysv 10 \
--slave /sbin/halt halt /sbin/halt-sysv \
--slave /sbin/poweroff poweroff /sbin/poweroff-sysv \
--slave /sbin/reboot reboot /sbin/reboot-sysv
new="$(get_runsystem)"
if [ "$current" != "$new" ]; then
echo "Switching from runsystem.$current to runsystem.$new."
echo
fi
echo "You can use update-alternatives --config runsystem to select"
echo "the runsystem to use."
echo
echo "You must use halt-hurd or reboot-hurd to halt or reboot the"
echo "system whenever you change the runsystem."
fi
# Ensure we have a random seed on first boot.
if [ "$PREV_VER" = "" ]; then
if which invoke-rc.d >/dev/null 2>&1
then
invoke-rc.d urandom start || true
else
/etc/init.d/urandom start || true
fi
fi
#
# Create /etc/rc.local on first time install and when upgrading from
# versions before "2.86.ds1-16"
#
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
then
if [ ! -e /etc/rc.local ]; then
cat << EOF > /etc/rc.local
#!/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.
#
# By default this script does nothing.
[ -d /etc/boot.d ] && run-parts /etc/boot.d
exit 0
EOF
# make sure it's enabled by default.
chmod 755 /etc/rc.local
fi
fi
#DEBHELPER#
:
|