[go: up one dir, main page]

File: postinst

package info (click to toggle)
file-rc 0.5.5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 108 kB
  • ctags: 20
  • sloc: sh: 886; makefile: 44
file content (40 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download
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
#!/bin/sh

set -e

# Versions older than 0.4.3 didn't support runlevel S properly.
# The easiest way to fix this is to change everything back
# to the link structure and then back again to the runlevel file.
#
if [ "$1" = "configure" -a -n "$2" ]
then
    if dpkg --compare-versions $2 lt 0.4.3
    then
	echo "Updating runlevel.conf to support new runlevel S."
	/usr/lib/file-rc/rcfile2link.sh && rm -f /etc/runlevel.conf /etc/runlevel.fallback
	if [ -f /etc/rc0.d/S05halt -o -f /etc/rc6.d/S05reboot ]
	then
	    echo "Correcting handling of halt and reboot"
	    [ -f /etc/rc0.d/S05halt ] && mv -f /etc/rc0.d/S05halt /etc/rc0.d/S90halt
	    [ -f /etc/rc6.d/S05reboot ] && mv -f /etc/rc6.d/S05reboot /etc/rc6.d/S90reboot
	fi
    fi
fi

if [ -d /etc/rc0.d -a ! -f /etc/runlevel.conf ]; then
	/usr/lib/file-rc/rclink2file.sh > /etc/runlevel.conf
	cp /etc/runlevel.conf /etc/runlevel.fallback
	( cd / && tar czf /var/backups/rc-links.tar.gz etc/rc?.d )
	rm -rf /etc/rc[0-6S].d
fi
dpkg-divert --package file-rc --add --rename \
	--divert /usr/sbin/update-rc.d.links /usr/sbin/update-rc.d
cp /usr/lib/file-rc/update-rc.d /usr/sbin/update-rc.d
dpkg-divert --package file-rc --add --rename \
	--divert /etc/init.d/rc.links /etc/init.d/rc
cp /usr/lib/file-rc/rc /etc/init.d/rc
dpkg-divert --package file-rc --add --rename \
	--divert /etc/init.d/rcS.links /etc/init.d/rcS
cp /usr/lib/file-rc/rcS /etc/init.d/rcS

#DEBHELPER#