Update Czech and Spanish translation for debconf
[rrq/maintain_lilo.git] / debian / lilo.postinst
1 #!/bin/sh
2 # postinst script lilo
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 LNKS="sarge sid"
9
10 if [ -f /usr/share/debconf/confmodule ]; then
11   . /usr/share/debconf/confmodule
12 fi
13
14 # remove old-named config files
15 dpkg-maintscript-helper rm_conffile \
16   /etc/kernel/postinst.d/zz-lilo  1:22.8-10 lilo -- "$@"
17
18 dpkg-maintscript-helper rm_conffile \
19   /etc/kernel/postrm.d/zz-lilo    1:22.8-10 lilo -- "$@"
20
21 dpkg-maintscript-helper rm_conffile \
22   /etc/kernel/postinst.d/zz-lilo  1:22.8-10 lilo -- "$@"
23
24 dpkg-maintscript-helper rm_conffile \
25   /etc/initramfs/post-update.d/lilo  1:22.8-10 lilo -- "$@"
26
27
28 # targets: configure|abort-upgrade|abort-remove|abort-deconfigure
29
30 case "$1" in
31     configure|reconfigure)
32     
33         # if a new install then we create the link and exit
34         if grep -q "^# UNCONFIGURED FSTAB FOR BASE SYSTEM" /etc/fstab ; then
35           exit 0
36         fi
37
38         # Check whether /boot is on another partition and mount it. See Bug#216250
39         if grep "[[:space:]]/boot[[:space:]]" /etc/fstab | grep -vq "^#"; then
40            if ! grep -q "[[:space:]]/boot[[:space:]]" /etc/mtab ; then
41                 mount /boot 2>&1 > /dev/null
42
43                 if [ $? -ne 0 ]; then
44                         echo
45                         echo "WARNING: /boot is in another partition but could not be mounted."
46                         echo "LILO may fail in the next steps!"
47                 fi
48            fi
49         fi
50
51         # copy all background images to the right place
52         if [ -L /boot/debian.bmp ]; then
53                 rm -f /boot/debian.bmp; fi
54
55         install -m 0644  /usr/share/lilo/*.bmp  /boot
56         # stay compatible with old lilo 22.8
57         for i in ${LNKS}; do
58                 ln -s debian.bmp /boot/${i}.bmp
59         done
60
61         # Nasty part to create network block devices if needed. Bug#235805.
62         if [ `uname -r | sed -e 's/-.*//g' -ne 's/\(^[0-9]\{1\}\.[0-9]\{1,2\}\).*/\1/p'` = "2.6" ] && \
63            [ `uname -r | sed -e 's/-.*//g' -ne 's/.*\.\([0-9]\{1,3\}\).*/\1/p'` -ge "3" ]; then
64
65           garbage=$(cat /proc/partitions | sed -ne 's/^[ \t]*//pg' | sed -ne '/^43/p')
66
67           if [ x"$garbage" != "x" ]; then
68                 # Create the missing devices
69                 echo -n "Creating network block devices... "
70                 (cd /dev; ./MAKEDEV nb) > /dev/null
71                 echo "done."  
72           fi
73         fi
74
75         db_get lilo/add_large_memory || true;
76         if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then
77                 if ! grep -q "^[[:space:]]*large-memory" /etc/lilo.conf; then
78                         sed -i -e '1i\# Automatically added by lilo postinst script\nlarge-memory\n' /etc/lilo.conf
79                         echo "WARNING: Added option 'large-memory', please run 'lilo' before you reboot."
80                 fi
81         fi
82
83         db_get lilo/diskid_uuid || true;
84         if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then
85                 if [ `grep -c -E "dev/disk/by-|UUID=" /etc/lilo.conf` -lt 2 ]; then
86                   if test -x /usr/sbin/lilo-uuid-diskid; then
87                     lilo-uuid-diskid
88                     echo "WARNING: If boot / root options were converted, please run 'lilo' before you reboot."
89                   fi
90                 fi
91         fi
92
93         db_get lilo/runme || true;
94         if [ x"$RET" = x"true" ]; then
95                 echo "Running lilo..."
96                 lilo -H
97         fi
98
99         ;;
100         abort-upgrade|abort-remove|abort-deconfigure)
101         ;;
102
103         *)
104                 echo "postinst called with unknown argument \`$1'" >&2
105                 exit 1
106         ;;
107 esac
108
109 # dh_installdeb will replace this with shell code automatically
110 # generated by other debhelper scripts.
111
112 #DEBHELPER#
113
114 exit 0