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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
diff -urN debianutils-1.16.7.old/installkernel debianutils-1.16.7/installkernel
--- debianutils-1.16.7.old/installkernel 2002-09-28 12:17:03.000000000 -0700
+++ debianutils-1.16.7/installkernel 2003-04-03 16:16:55.000000000 -0800
@@ -33,7 +33,7 @@
cat "$2" > "$dir/$1-$ver"
if [ -f "$dir/$1" ] ; then
- if [ -L "$dir/$1" -a $(ls -l "$dir/$1" | awk '{print $11}') \
+ if [ -L "$dir/$1" -a "$(ls -l "$dir/$1" | awk '{print $11}')" \
= "$1-$ver" ] ; then
ln -sf "$1-$ver.old" "$dir/$1.old"
else
diff -urN debianutils-1.16.7.old/mkboot debianutils-1.16.7/mkboot
--- debianutils-1.16.7.old/mkboot 2002-10-16 20:20:42.000000000 -0700
+++ debianutils-1.16.7/mkboot 2003-04-03 16:16:55.000000000 -0800
@@ -14,7 +14,13 @@
# check whether GRUB is installed
grubcheck () {
- [ $(dpkg -s grub | grep -i ^status: | cut -d ' ' -f 4) = "installed" ]
+ # Right way in Gentoo to check, but grub is in system profile,
+ # so rather check for lilo first....
+ if [ -x /usr/bin/qpkg ] ; then
+ [ "$(qpkg -nc sys-apps/grub)" = "sys-apps/grub *" ]
+ else
+ return 1
+ fi
}
# check whether LILO is installed
@@ -96,7 +102,7 @@
fi
boottype="lilo"
- if [ $(whoami) != root ] ; then
+ if [ "$(whoami)" != root ] ; then
echo "Since you don't have root permissions, I can't put LILO on the diskette."
echo "I will make a non-LILO diskette instead, but it won't be as useful. You"
echo "can hit <Ctrl-C> to cancel."
@@ -146,6 +152,16 @@
echo "either make a bootable floppy diskette, re-run LILO, or have GRUB"
echo "installed."
+ lilocheck
+ if [ $? -eq 0 ] ; then
+ echo -en "\nShould I run /sbin/lilo? (y/n) "
+ read input
+ if [ "$input" = "y" ] ; then
+ /sbin/lilo && exit 0
+ echo "There was a problem running /sbin/lilo."
+ fi
+ fi
+
grubcheck
if [ $? -eq 0 ] ; then
echo -e "\nGRUB is installed. To automatically switch to new kernels, point your"
@@ -153,16 +169,6 @@
exit 0
fi
- lilocheck
- if [ $? -eq 0 ] ; then
- echo -en "\nShould I run /sbin/lilo? (y/n) "
- read input
- if [ "$input" = "y" ] ; then
- /sbin/lilo && exit 0
- echo "There was a problem running /sbin/lilo."
- fi
- fi
-
echo -en "\nShould I make a bootdisk? (y/n) "
read input
if [ "$input" = "y" ] ; then
diff -urN debianutils-1.16.7.old/mkboot~ debianutils-1.16.7/mkboot~
--- debianutils-1.16.7.old/mkboot~ 1969-12-31 16:00:00.000000000 -0800
+++ debianutils-1.16.7/mkboot~ 2002-10-16 20:20:42.000000000 -0700
@@ -0,0 +1,177 @@
+#!/bin/bash
+# mkboot: make the system bootable
+# Debian GNU/Linux
+# Copyright 1996-1997 Guy Maor <maor@debian.org>
+# This is free software; see the GNU General Public License version 2
+# or later for copying conditions. There is NO warranty.
+
+PATH=$PATH:/sbin:/usr/sbin
+
+# root partition
+rootpart=$(rdev | cut -d ' ' -f 1)
+# temporary directory
+tmpdir=${TMPDIR-/tmp}
+
+# check whether GRUB is installed
+grubcheck () {
+ [ $(dpkg -s grub | grep -i ^status: | cut -d ' ' -f 4) = "installed" ]
+}
+
+# check whether LILO is installed
+lilocheck () {
+ echo -en "\nChecking for LILO..."
+ if [ $(whoami) != root ] ; then
+ echo "Only root can check for LILO"
+ return 1;
+ fi
+ if [ ! -f /etc/lilo.conf -o ! -x /sbin/lilo ] ; then
+ echo "No"
+ return 1;
+ fi
+ bootpart=$(perl -ne 'print $1 if /^\s*boot\s*=\s*(\S*)/' /etc/lilo.conf)
+ if [ -z "$bootpart" ] ; then
+ # lilo defaults to current root when 'boot=' is not present
+ bootpart=$rootpart
+ fi
+ if ! dd if=$bootpart ibs=16 count=1 2>&- | grep -q LILO ; then
+ echo -e "\nYes, but I couldn't find a LILO signature on $bootpart"
+ echo "Check your /etc/lilo.conf, or run /sbin/lilo by hand."
+ return 1;
+ fi
+ echo "Yes, on $bootpart"
+ return 0;
+}
+
+
+# make a lilo boot disk
+makelilo () {
+(
+ b=$tmpdir/boot$$
+ trap "set +e; cd /; umount /dev/fd0; rmdir $b" 0
+ set -ex
+ mkdir $b
+ mke2fs -q /dev/fd0
+ mount -t ext2 /dev/fd0 $b
+ if [ -e /boot/boot.b ]; then
+ cp /boot/boot.b $b/boot.b
+ fi
+ cp $1 $b/vmlinuz
+ cd $b
+ cat > lilo.conf <<- EOF
+ lba32
+ boot = /dev/fd0
+ install = boot.b
+ map = map
+ compact
+ prompt
+ timeout = 50
+ read-only
+ image = vmlinuz
+ label = linux
+ root = $rootpart
+ EOF
+ lilo -C lilo.conf
+)
+}
+
+
+# make a simple boot disk
+makesimple () {
+(
+ set -ex
+ dd if=$1 of=/dev/fd0
+ rdev /dev/fd0 $rootpart
+ rdev -R /dev/fd0 1
+)
+}
+
+
+
+# make a boot disk
+makedisk () {
+ kernel=${1:-/vmlinuz}
+ if [ ! -r $kernel ] ; then
+ echo "Error: Can't read $kernel."
+ exit 1
+ fi
+
+ boottype="lilo"
+ if [ $(whoami) != root ] ; then
+ echo "Since you don't have root permissions, I can't put LILO on the diskette."
+ echo "I will make a non-LILO diskette instead, but it won't be as useful. You"
+ echo "can hit <Ctrl-C> to cancel."
+ boottype="simple"
+ fi
+
+ echo -en "\nInsert a floppy diskette into your boot drive, and press <Return>. "
+ read input
+ diskok=0
+ while [ "$diskok" != 1 ] ; do
+ echo -e "\nCreating a $boottype bootdisk..."
+ make$boottype $kernel
+ if [ $? -eq 0 ] ; then
+ diskok=1
+ else
+ echo -e "\nThere was a problem creating the boot diskette. Please make sure that"
+ echo "you inserted the diskette into the correct drive and that the diskette"
+ echo "is not write-protected."
+ echo -en "\nWould you like to try again? (y/n) "
+ read input
+ if [ "$input" != "y" ] ; then
+ return 1
+ fi
+ fi
+ done
+ echo "...Success."
+ return 0
+}
+
+usage="$0 [-r rootpartition] [-i] [kernel]"
+
+while getopts "r:ih-" opt ; do
+ case "$opt" in
+ r) rootpart="$OPTARG" ;;
+ i) installkernel=1 ;;
+ h) echo $usage ; exit 0 ;;
+ -) break ;;
+ *) echo $usage 1>&2 ; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "$installkernel" ] ; then
+ shift
+ echo "In order to use the new kernel image you have just installed, you"
+ echo "will need to reboot the machine. First, however, you will need to"
+ echo "either make a bootable floppy diskette, re-run LILO, or have GRUB"
+ echo "installed."
+
+ grubcheck
+ if [ $? -eq 0 ] ; then
+ echo -e "\nGRUB is installed. To automatically switch to new kernels, point your"
+ echo "default entry in menu.lst to $1"
+ exit 0
+ fi
+
+ lilocheck
+ if [ $? -eq 0 ] ; then
+ echo -en "\nShould I run /sbin/lilo? (y/n) "
+ read input
+ if [ "$input" = "y" ] ; then
+ /sbin/lilo && exit 0
+ echo "There was a problem running /sbin/lilo."
+ fi
+ fi
+
+ echo -en "\nShould I make a bootdisk? (y/n) "
+ read input
+ if [ "$input" = "y" ] ; then
+ makedisk $1 && exit 0
+ fi
+
+ echo -e "\nWARNING: Your system is probably unbootable now. After correcting any"
+ echo "problems, rerun this script with the command \`mkboot -installkernel'."
+ exit 1
+fi
+
+makedisk $1
diff -urN debianutils-1.16.7.old/run-parts.c debianutils-1.16.7/run-parts.c
--- debianutils-1.16.7.old/run-parts.c 2002-10-16 21:19:37.000000000 -0700
+++ debianutils-1.16.7/run-parts.c 2003-04-03 16:17:20.000000000 -0800
@@ -120,7 +120,8 @@
!fnmatch("*~", c, 0) ||
!fnmatch("*.pre_fcopy", c, 0) ||
!fnmatch("*.notslocate", c, 0) ||
- !fnmatch("*.disabled", c, 0) );
+ !fnmatch("*.disabled", c, 0) ||
+ !fnmatch("*.keep", c, 0) );
}
|