File: postinst

package info (click to toggle)
modutils 2.1.85-11
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,020 kB
  • ctags: 1,024
  • sloc: ansic: 9,324; sh: 2,180; lex: 484; yacc: 362; makefile: 309
file content (126 lines) | stat: -rw-r--r-- 3,378 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
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
#!/bin/sh -e
# post install script for the Debian GNU/Linux modutils package

case "$1" in
	configure)
		# continue as normal
		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		exit 0;
	;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2;
		exit 0;
	;;
esac

# See if the user still has an old-style /etc/conf.modules
if egrep -q "path\[([A-Za-z]+)\]=.*\1" /etc/conf.modules; then
	echo "You have an old-style /etc/conf.modules file. The format has"
	echo "changed a little and modutils no longer works with the old"
	echo "format."
	echo ""
	echo -n "Enter \"yes\" if I should convert /etc/conf.modules: "
	read ANSWER
	if [ "$ANSWER" != "yes" ]; then
		echo "Okay, NOT converting. Please note that depmod and modprobe may"
		echo "fail to work."
	else
		cp /etc/conf.modules /etc/conf.modules.old
		sed -e "s#path\[\([A-Za-z0-9]\+\)\]=\(.*\)/\1#path[\1]=\2#" \
			/etc/conf.modules.old > /etc/conf.modules
		chmod 644 /etc/conf.modules
		
		echo "Finished converting /etc/conf.modules. A copy of the old version"
		echo "has been saved as /etc/conf.modules.old. You may safely remove"
		echo "this file."
	fi
fi

# Remove obsolete /lib/modules/current link
if [ -L /lib/modules/current ]
then
	echo -n "Removing obsolete /lib/modules/current softlink.."
	rm -f /lib/modules/current
	echo
fi

# Reset KDOPT setting in /etc/init.d/kerneld.
if [ -f /var/run/kerneld.OPT ]
then
	echo "Restoring original KDOPT setting to /etc/init.d/kerneld.."
	OPTLINE="`cat /var/run/kerneld.OPT`"
	cp /etc/init.d/kerneld /etc/init.d/kerneld.TMP
	sed -e "s/^KDOPT="".*/$OPTLINE/" < /etc/init.d/kerneld.TMP > /etc/init.d/kerneld
	if [ -s /etc/init.d/kerneld ]
	then
		rm -f /etc/init.d/kerneld.TMP
	fi
	rm -f /var/run/kerneld.OPT
fi

update-rc.d kerneld defaults 12 >/dev/null

/etc/init.d/kerneld start

if test -x /usr/bin/update-menus; then update-menus; fi

if [ ! -z "$2" ]; then
	if `dpkg --compare-versions 2.1.85-1 gt $2`; then
		cat <<EOF
IMPORTANT NOTES
===============
1) Support for request-route has been dropped from modutils. If you
used this feature please switch to diald.

2) Debian GNU/Linux modutils now supports persistant module storage.
Please read the readme /usr/doc/modutils/README.Debian.gz before using
it though!

EOF
		echo -n "Press enter to continue "
		read HITME
	fi
fi


# Create the symlink from /etc/conf.modules to the proper file in
# /etc/modutils if it does not exist
if [ ! -L /etc/conf.modules ]; then
	echo "You have no /etc/conf.modules symlink, creating it"
	MODEL="`dpkg --print-installation-architecture`"
	CONF="/etc/modutils/conf.${MODEL}"
	if [ $MODEL = "m68k" ]; then
		if [ -f /proc/hardware ]; then
			case `awk '$1 == "Model:" { print $2 }' /proc/hardware` in
				Atari)
					CONF="${CONF}.atari"
					;;
				Amiga)
					CONF="${CONF}.amiga"
					;;
				Macintosh)
					CONF="${CONF}.mac"
					;;
				Motorola)
					CONF="${CONF}.MVME"
					;;
			esac
			if [ ! -f $CONF ]; then
				echo "Machine-specific conf.modules not found, using m68k generic config"
				CONF="/etc/modutils/conf.m68k"
			fi
		else
			echo "/proc not mounted, using generic m68k conf.modules"
		fi
	fi

	if [ ! -f $CONF ]; then
		echo "Architecture-specific modutils configuration not found, using defaults"
		CONF="/etc/modutils/conf.generic"
	fi

	ln -s $CONF /etc/conf.modules
else
	echo "You already have a /etc/conf.modules symlink.. leaving it"
fi