File: lilo.postinst

package info (click to toggle)
lilo 1%3A24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,580 kB
  • ctags: 4,114
  • sloc: ansic: 13,306; asm: 10,403; perl: 1,291; sh: 1,035; makefile: 592
file content (108 lines) | stat: -rw-r--r-- 2,963 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# postinst script lilo
#
# see: dh_installdeb(1)

set -e

if [ -f /usr/share/debconf/confmodule ]; then
  . /usr/share/debconf/confmodule
fi

# remove old-named config files
dpkg-maintscript-helper rm_conffile \
  /etc/kernel/postinst.d/zz-lilo  1:22.8-10 lilo -- "$@"

dpkg-maintscript-helper rm_conffile \
  /etc/kernel/postrm.d/zz-lilo    1:22.8-10 lilo -- "$@"

dpkg-maintscript-helper rm_conffile \
  /etc/kernel/postinst.d/zz-lilo  1:22.8-10 lilo -- "$@"

dpkg-maintscript-helper rm_conffile \
  /etc/initramfs/post-update.d/lilo  1:22.8-10 lilo -- "$@"


# targets: configure|abort-upgrade|abort-remove|abort-deconfigure

case "$1" in
    configure|reconfigure)
    
	# if a new install then we create the link and exit
	if grep -q "^# UNCONFIGURED FSTAB FOR BASE SYSTEM" /etc/fstab ; then
	  exit 0
	fi

	# Check whether /boot is on another partition and mount it. See Bug#216250
	if grep "[[:space:]]/boot[[:space:]]" /etc/fstab | grep -vq "^#"; then
	   if ! grep -q "[[:space:]]/boot[[:space:]]" /etc/mtab ; then
	   	mount /boot 2>&1 > /dev/null

		if [ $? -ne 0 ]; then
			echo
			echo "WARNING: /boot is in another partition but could not be mounted."
			echo "LILO may fail in the next steps!"
		fi
	   fi
	fi

	# copy all background images to the right place
	if [ -L /boot/debian.bmp ]; then
		rm -f /boot/debian.bmp; fi

	install -m 0644  /usr/share/lilo/*.bmp  /boot

	# Nasty part to create network block devices if needed. Bug#235805.
	if [ `uname -r | sed -e 's/-.*//g' -ne 's/\(^[0-9]\{1\}\.[0-9]\{1,2\}\).*/\1/p'` = "2.6" ] && \
	   [ `uname -r | sed -e 's/-.*//g' -ne 's/.*\.\([0-9]\{1,3\}\).*/\1/p'` -ge "3" ]; then

	  garbage=$(cat /proc/partitions | sed -ne 's/^[ \t]*//pg' | sed -ne '/^43/p')

	  if [ x"$garbage" != "x" ]; then
		# Create the missing devices
		echo -n "Creating network block devices... "
		(cd /dev; ./MAKEDEV nb) > /dev/null
		echo "done."  
	  fi
	fi

	db_get lilo/add_large_memory || true;
	if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then
		if ! grep -q "^[[:space:]]*large-memory" /etc/lilo.conf; then
			sed -i -e '1i\# Automatically added by lilo postinst script\nlarge-memory\n' /etc/lilo.conf
			echo "WARNING: Added option 'large-memory', please run 'lilo' before you reboot."
		fi
	fi

	db_get lilo/diskid_uuid || true;
	if [ x"$RET" = x"true" -a -e /etc/lilo.conf ]; then
		if [ `grep -c -E "dev/disk/by-|UUID=" /etc/lilo.conf` -lt 2 ]; then
		  if test -x /usr/sbin/lilo-uuid-diskid; then
		    lilo-uuid-diskid
		    echo "WARNING: If boot / root options were converted, please run 'lilo' before you reboot."
		  fi
		fi
	fi

	db_get lilo/runme || true;
	if [ x"$RET" = x"true" ]; then
		echo "Running lilo..."
		lilo -H
	fi

	;;
	abort-upgrade|abort-remove|abort-deconfigure)
	;;

	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 1
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0