Subversion Repositories livecd

Rev

Rev 30 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30 Rev 31
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
###############################################################
3
###############################################################
4
#
4
#
5
# Installes the LiveCD on local harddisk
5
# Installes the LiveCD on local harddisk
6
# 
6
# 
7
# Boot LiveCD and run this script as root
7
# Boot LiveCD and run this script as root
8
#
8
#
9
# Urs Beyerle, PSI
9
# Urs Beyerle, PSI
10
#
10
#
11
###############################################################
11
###############################################################
12
 
12
 
13
 
13
 
14
###############################################################
14
###############################################################
15
# Definitions
15
# Definitions
16
###############################################################
16
###############################################################
17
 
17
 
18
# RPMs that are no longer needed and can break future udpates
18
# RPMs that are no longer needed and can break future udpates
19
RPMS_TO_REMOVE="kernel-module-squashfs \
19
RPMS_TO_REMOVE="kernel-module-squashfs \
20
                kernel-module-unionfs \
20
                kernel-module-unionfs \
21
                unionfs \
21
                unionfs \
22
                squashfs"
22
                squashfs"
23
 
23
 
24
# RPMs that can break future Scientific Linux updates
24
# RPMs that can break future Scientific Linux updates
25
# because there are not part of Scientific Linux
25
# because there are not part of Scientific Linux
26
RPMS_TO_REMOVE_SL="kernel-module-ntfs"
26
RPMS_TO_REMOVE_SL="kernel-module-ntfs"
27
                   
27
                   
28
# RPMs that can break future PSI SL updates
28
# RPMs that can break future PSI SL updates
29
# because there are not part of PSI Scientific Linux
29
# because there are not part of PSI Scientific Linux
30
RPMS_TO_REMOVE_PSI=""
30
RPMS_TO_REMOVE_PSI=""
31
                   
31
                   
32
# files which should be restored from .ori files
32
# files which should be restored from .ori files
33
FILES_RESTORE="/etc/init.d/netfs \
33
FILES_RESTORE="/etc/init.d/netfs \
34
           /etc/init.d/autofs \
34
           /etc/init.d/autofs \
35
           /etc/init.d/halt \
35
           /etc/init.d/halt \
36
           /etc/init.d/network
36
           /etc/init.d/network
37
           /etc/init.d/functions \
37
           /etc/init.d/functions \
38
           /etc/rc.d/rc.sysinit \
38
           /etc/rc.d/rc.sysinit \
39
           /etc/sysconfig/afs \
39
           /etc/sysconfig/afs \
40
           /etc/motd \
40
           /etc/motd \
41
           /etc/redhat-release \
41
           /etc/redhat-release \
42
	   /etc/rc.d/rc.local"
42
	   /etc/rc.d/rc.local"
43
 
43
 
44
LIVECD_INIT_SCRIPTS="runfirst \
44
LIVECD_INIT_SCRIPTS="runfirst \
45
                    runveryfirst \
45
                    runveryfirst \
46
                    runlast \
46
                    runlast \
47
                    kudzu-auto"
47
                    kudzu-auto"
48
 
48
 
49
# Main directories which should be not be copied
49
# Main directories which should be not be copied
50
DIR_NOT_COPY="/proc \
50
DIR_NOT_COPY="/proc \
51
              /dev \
51
              /dev \
52
              /livecd \
52
              /livecd \
53
              /boot \
53
              /boot \
54
              /afs \
54
              /afs \
55
              /sys \
55
              /sys \
56
              /mnt \
56
              /mnt \
57
              /media"
57
              /media"
58
 
58
 
59
# Mount point of the new SL system
59
# Mount point of the new SL system
60
NEW=/mnt/harddisk
60
NEW=/mnt/harddisk
61
 
61
 
62
# Name of the script
62
# Name of the script
63
SCRIPTNAME=$( basename $0 )
63
SCRIPTNAME=$( basename $0 )
64
 
64
 
65
 
65
 
66
 
66
 
67
 
67
 
68
###############################################################
68
###############################################################
69
# Functions
69
# Functions
70
###############################################################
70
###############################################################
71
 
71
 
72
function usage() {
72
function usage() {
73
 
73
 
74
   ## Usage
74
   ## Usage
75
   # ----------------------------------------------------------
75
   # ----------------------------------------------------------
76
 
76
 
77
   cat <<EOF
77
   cat <<EOF
78
   
78
   
79
  $SCRIPTNAME [OPTIONS] -mbr=[DEVICE] [PARTITION]
79
  $SCRIPTNAME [OPTIONS] -mbr=[DEVICE] [PARTITION]
80
 
80
 
81
    Installes LiveCD on PARTITION and the bootloader grub into 
81
    Installes LiveCD on PARTITION and the bootloader grub into 
82
    the Master Boot Record (MBR) of DEVICE. The MBR will be 
82
    the Master Boot Record (MBR) of DEVICE. The MBR will be 
83
    backed up to PARTITION.
83
    backed up to PARTITION.
84
 
84
 
85
  OPTIONS:
85
  OPTIONS:
86
 
86
 
87
    -h   --help         Print this screen
87
    -h   --help         Print this screen
88
    -swap=[partition]   Use [partition] as swap
88
    -swap=[partition]   Use [partition] as swap
89
    -win=[partition]    Your active Windows partition. If not given, 
89
    -win=[partition]    Your active Windows partition. If not given, 
90
                        $SCRIPTNAME tries to find it
90
                        $SCRIPTNAME tries to find it
91
    -nogrub             Do not install grub. You have to install 
91
    -nogrub             Do not install grub. You have to install 
92
                        manually a bootloader (not recommended)
92
                        manually a bootloader (not recommended)
93
    -floppy             Needed, if grub should be installed on floppy
93
    -floppy             Needed, if grub should be installed on floppy
-
 
94
                        In this case use -mbr=/dev/fd0 -floppy
94
    -norpmremove        Do not remove RPMs that break future updates 
95
    -norpmremove        Do not remove RPMs that break future updates 
95
                        (not recommended)
96
                        (not recommended)
96
    -y                  Answer all questions with yes
97
    -y                  Answer all questions with yes
97
 
98
 
98
  Example:
99
  Example:
99
 
100
 
100
  $SCRIPTNAME -swap=/dev/sda3 -mbr=/dev/sda /dev/sda2
101
  $SCRIPTNAME -swap=/dev/sda3 -mbr=/dev/sda /dev/sda2
101
 
102
 
102
    Will install LiveCD on /dev/sda2 (= second partition on 
103
    Will install LiveCD on /dev/sda2 (= second partition on 
103
    first SATA disk). All data on /dev/sda2 will be deleted.
104
    first SATA disk). All data on /dev/sda2 will be deleted.
104
    /dev/sda3 has to be a Linux Swap partion. GRUB will be 
105
    /dev/sda3 has to be a Linux Swap partion. GRUB will be 
105
    installed in the MBR of /dev/sda (= first SATA disk).
106
    installed in the MBR of /dev/sda (= first SATA disk).
106
   
107
   
-
 
108
  Remarks:
-
 
109
 
-
 
110
    To display your hard disk partitions, user 'fdisk -l'.
-
 
111
    Use fdisk, qtparted or parted to create an empty Linux
-
 
112
    partition.
-
 
113
 
107
EOF
114
EOF
108
}
115
}
109
 
116
 
110
 
117
 
111
function exit_now() {
118
function exit_now() {
112
 
119
 
113
    local exitcode=$1
120
    local exitcode=$1
114
    umount $INSTALL_PART 2>/dev/null
121
    umount $INSTALL_PART 2>/dev/null
115
    exit $exitcode
122
    exit $exitcode
116
}
123
}
117
 
124
 
118
 
125
 
119
 
126
 
120
###############################################################
127
###############################################################
121
# Main
128
# Main
122
###############################################################
129
###############################################################
123
 
130
 
124
### are we root?
131
### are we root?
125
### -----------------------------------------------------------
132
### -----------------------------------------------------------
126
if [ "$( whoami )" != "root" ]; then
133
if [ "$( whoami )" != "root" ]; then
127
    echo "Please run this script as roo/home/l_beyerle/svn-livecd/livecd/trunkt."
134
    echo; echo "Please run this script as root: 'su - -c $SCRIPTNAME'"; echo
128
    exit_now 1
135
    exit_now 1
129
fi
136
fi
130
 
137
 
131
 
138
 
132
### read options from command-line
139
### read options from command-line
133
### -----------------------------------------------------------
140
### -----------------------------------------------------------
134
while [ $# -gt 0 ]; do
141
while [ $# -gt 0 ]; do
135
 
142
 
136
    case "$1" in
143
    case "$1" in
137
       -h)
144
       -h)
138
            usage; exit_now;;
145
            usage; exit_now;;
139
 
146
 
140
       --help)
147
       --help)
141
            usage; exit_now;;
148
            usage; exit_now;;
142
 
149
 
143
       -swap*)
150
       -swap*)
144
           if echo $1 | grep -q '=' ; then
151
           if echo $1 | grep -q '=' ; then
145
	       SWAP_PART=$( echo $1 | sed 's/^-swap=//' )
152
	       SWAP_PART=$( echo $1 | sed 's/^-swap=//' )
146
	   else
153
	   else
147
	       shift
154
	       shift
148
               SWAP_PART=$1
155
               SWAP_PART=$1
149
	   fi
156
	   fi
150
	   shift; continue;;
157
	   shift; continue;;
151
 
158
 
152
       -mbr*)
159
       -mbr*)
153
           if echo $1 | grep -q '=' ; then
160
           if echo $1 | grep -q '=' ; then
154
	       MBR_DEV=$( echo $1 | sed 's/^-mbr=//' )
161
	       MBR_DEV=$( echo $1 | sed 's/^-mbr=//' )
155
	   else
162
	   else
156
	       shift
163
	       shift
157
               MBR_DEV=$1
164
               MBR_DEV=$1
158
	   fi
165
	   fi
159
	   shift; continue;;
166
	   shift; continue;;
160
 
167
 
161
       -win*)
168
       -win*)
162
           if echo $1 | grep -q '=' ; then
169
           if echo $1 | grep -q '=' ; then
163
	       WIN_PART=$( echo $1 | sed 's/^-win=//' )
170
	       WIN_PART=$( echo $1 | sed 's/^-win=//' )
164
	   else
171
	   else
165
	       shift
172
	       shift
166
               WIN_PART=$1
173
               WIN_PART=$1
167
	   fi
174
	   fi
168
	   shift; continue;;
175
	   shift; continue;;
169
 
176
 
170
       -nogrub)
177
       -nogrub)
171
            NOGRUB=$1; shift; continue;;
178
            NOGRUB=$1; shift; continue;;
172
 
179
 
173
       -norpmremove)
180
       -norpmremove)
174
            NORPMREMOVE=$1; shift; continue;;
181
            NORPMREMOVE=$1; shift; continue;;
175
 
182
 
176
       -floppy)
183
       -floppy)
177
            FLOPPY=$1; shift; continue;;
184
            FLOPPY=$1; shift; continue;;
178
 
185
 
179
       -y)
186
       -y)
180
            YES=$1; shift; continue;;
187
            YES=$1; shift; continue;;
181
 
188
 
182
       *)
189
       *)
183
            INSTALL_PART=$1; break;;
190
            INSTALL_PART=$1; break;;
184
    esac
191
    esac
185
 
192
 
186
done
193
done
187
echo
194
echo
188
 
195
 
189
 
196
 
190
### display fdisk -l
197
### display fdisk -l
191
### -----------------------------------------------------------
198
### -----------------------------------------------------------
192
echo "Output of 'fdisk -l' ..."
199
echo "Output of 'fdisk -l' ..."
193
fdisk -l
200
fdisk -l
194
echo
201
echo
195
 
202
 
196
 
203
 
197
### test if $INSTALL_PART is defined
204
### test if $INSTALL_PART is defined
198
### -----------------------------------------------------------
205
### -----------------------------------------------------------
199
if [ ! $INSTALL_PART ]; then
206
if [ ! $INSTALL_PART ]; then
200
    echo "No partition defined for installation"
207
    echo "No partition defined for installation"
201
    echo "Please see '$SCRIPTNAME -h'"; echo
208
    echo "Please see '$SCRIPTNAME -h'"; echo
202
    exit_now 1
209
    exit_now 1
203
fi
210
fi
204
 
211
 
205
 
212
 
206
### test if MBR_DEV is given
213
### test if MBR_DEV is given
207
### -----------------------------------------------------------
214
### -----------------------------------------------------------
208
if [ ! $NOGRUB ]; then
215
if [ ! $NOGRUB ]; then
209
    if [ ! $MBR_DEV ]; then
216
    if [ ! $MBR_DEV ]; then
210
	echo "No MBR device defined."
217
	echo "No MBR device defined."
211
	echo "Please see '$SCRIPTNAME -h'"; echo
218
	echo "Please see '$SCRIPTNAME -h'"; echo
212
	exit_now 1
219
	exit_now 1
213
    fi
220
    fi
214
fi
221
fi
215
 
222
 
216
 
223
 
217
### test if $INSTALL_PART exists
224
### test if $INSTALL_PART exists
218
### -----------------------------------------------------------
225
### -----------------------------------------------------------
219
fdisk -l | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
226
fdisk -l | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
220
if [ "$?" != "0" ]; then
227
if [ "$?" != "0" ]; then
221
    echo "Partition $INSTALL_PART not found! See 'fdisk -l'"
228
    echo "Partition $INSTALL_PART not found! See 'fdisk -l'"
222
    echo "Or you have to reboot first to make the partition table active"; echo
229
    echo "Or you have to reboot first to make the partition table active"; echo
223
    exit_now 1
230
    exit_now 1
224
fi
231
fi
225
 
232
 
226
 
233
 
227
### test if $INSTALL_PART is a Linux partition
234
### test if $INSTALL_PART is a Linux partition
228
### -----------------------------------------------------------
235
### -----------------------------------------------------------
229
fdisk -l | grep "Linux$" | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
236
fdisk -l | grep "Linux$" | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
230
if [ "$?" != "0" ]; then
237
if [ "$?" != "0" ]; then
231
    echo "Partition $INSTALL_PART is not a Linux partition! (see 'fdisk -l')"
238
    echo "Partition $INSTALL_PART is not a Linux partition! (see 'fdisk -l')"
232
    echo "Use fdisk and/or qtparted to create a Linux partition!"
239
    echo "Use fdisk and/or qtparted to create a Linux partition!"
233
    echo "You have to reboot first to make the partition table active"; echo
240
    echo "You have to reboot first to make the partition table active"; echo
234
    exit_now 1
241
    exit_now 1
235
fi
242
fi
236
 
243
 
237
 
244
 
238
### test if $SWAP_PART exists and is a Linux Swap partition
245
### test if $SWAP_PART exists and is a Linux Swap partition
239
### -----------------------------------------------------------
246
### -----------------------------------------------------------
240
if [ $SWAP_PART ]; then
247
if [ $SWAP_PART ]; then
241
    fdisk -l | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
248
    fdisk -l | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
242
    if [ "$?" != "0" ]; then
249
    if [ "$?" != "0" ]; then
243
	echo "Swap partition $SWAP_PART not found! (see 'fdisk -l')"
250
	echo "Swap partition $SWAP_PART not found! (see 'fdisk -l')"
244
	echo "Or you have to reboot first to make the partition table active"; echo
251
	echo "Or you have to reboot first to make the partition table active"; echo
245
	exit_now 1
252
	exit_now 1
246
    fi
253
    fi
247
    fdisk -l | grep "Linux swap$" | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
254
    fdisk -l | grep "Linux swap$" | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
248
    if [ "$?" != "0" ]; then
255
    if [ "$?" != "0" ]; then
249
	echo "Partition $SWAP_PART is not a Linux swap partition! (see 'fdisk -l')"
256
	echo "Partition $SWAP_PART is not a Linux swap partition! (see 'fdisk -l')"
250
	echo "Use fdisk and/or qtparted to create a Linux Swap partition!"
257
	echo "Use fdisk and/or qtparted to create a Linux Swap partition!"
251
	echo "You have to reboot first to make the partition table active"; echo
258
	echo "You have to reboot first to make the partition table active"; echo
252
	exit_now 1
259
	exit_now 1
253
    fi
260
    fi
254
fi
261
fi
255
 
262
 
256
 
263
 
257
### set $INSTALL_DEV (eg. /dev/sda)
264
### set $INSTALL_DEV (eg. /dev/sda)
258
### -----------------------------------------------------------
265
### -----------------------------------------------------------
259
INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
266
INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
260
INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
267
INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
261
 
268
 
262
 
269
 
263
### print warning
270
### print warning
264
### -----------------------------------------------------------
271
### -----------------------------------------------------------
265
echo                     "------------------------------------------------------------"
272
echo                     "------------------------------------------------------------"
266
echo                     "   LiveCD will be installed on partition $INSTALL_PART"
273
echo                     "   LiveCD will be installed on partition $INSTALL_PART"
267
[ "$SWAP_PART" ] && echo " Partition $SWAP_PART will be used as swap partition."
274
[ "$SWAP_PART" ] && echo " Partition $SWAP_PART will be used as swap partition."
268
[ ! $NOGRUB ]    && echo " GRUB will be installed in Master Boot Record of $MBR_DEV"
275
[ ! $NOGRUB ]    && echo " GRUB will be installed in Master Boot Record of $MBR_DEV"
269
echo                     "       !! All data on $INSTALL_PART will be lost !!"
276
echo                     "       !! All data on $INSTALL_PART will be lost !!"
270
echo                     "------------------------------------------------------------"
277
echo                     "------------------------------------------------------------"
271
echo
278
echo
272
 
279
 
273
 
280
 
274
### continue?
281
### continue?
275
### -----------------------------------------------------------
282
### -----------------------------------------------------------
276
if [ ! $YES ]; then
283
if [ ! $YES ]; then
277
    echo -n "Continue (y/N)? "
284
    echo -n "Continue (y/N)? "
278
    read key
285
    read key
279
    echo
286
    echo
280
    [ "$key" != "y" ] && exit_now 0
287
    [ "$key" != "y" ] && exit_now 0
281
fi
288
fi
282
 
289
 
283
 
290
 
284
### format $SWAP_PART
291
### format $SWAP_PART
285
### -----------------------------------------------------------
292
### -----------------------------------------------------------
286
if [ $SWAP_PART ]; then
293
if [ $SWAP_PART ]; then
287
    echo "Make swap on $SWAP_PART ..."
294
    echo "Make swap on $SWAP_PART ..."
288
    mkswap $SWAP_PART
295
    mkswap $SWAP_PART
289
    echo
296
    echo
290
fi
297
fi
291
 
298
 
292
 
299
 
293
### format $INSTALL_PART
300
### format $INSTALL_PART
294
### -----------------------------------------------------------
301
### -----------------------------------------------------------
295
echo -n "Format $INSTALL_PART, please wait ... " 
302
echo -n "Format $INSTALL_PART, please wait ... " 
296
mkfs.ext3 -q $INSTALL_PART || exit_now 1
303
mkfs.ext3 -q $INSTALL_PART || exit_now 1
297
echo "done."; echo
304
echo "done."; echo
298
 
305
 
299
 
306
 
300
### mount $INSTALL_PART
307
### mount $INSTALL_PART
301
### -----------------------------------------------------------
308
### -----------------------------------------------------------
302
echo -n "Try to mount $INSTALL_PART to $NEW ... "
309
echo -n "Try to mount $INSTALL_PART to $NEW ... "
303
mkdir -p $NEW
310
mkdir -p $NEW
304
mount $INSTALL_PART $NEW || exit_now 1
311
mount $INSTALL_PART $NEW || exit_now 1
305
echo "done."; echo
312
echo "done."; echo
306
 
313
 
307
 
314
 
308
### copy root dirs
315
### copy root dirs
309
### -----------------------------------------------------------
316
### -----------------------------------------------------------
310
echo "Copy Live System to $INSTALL_PART ..."
317
echo "Copy Live System to $INSTALL_PART ..."
311
root_dirs=$( ls / )
318
root_dirs=$( ls / )
312
for dir in $root_dirs; do
319
for dir in $root_dirs; do
313
    # check if dir is not in $DIR_NOT_COPY
320
    # check if dir is not in $DIR_NOT_COPY
314
    do_not_copy=""
321
    do_not_copy=""
315
    for not_dir in $DIR_NOT_COPY; do
322
    for not_dir in $DIR_NOT_COPY; do
316
	if [ "$not_dir" = "/$dir" ]; then 
323
	if [ "$not_dir" = "/$dir" ]; then 
317
	    do_not_copy="yes"
324
	    do_not_copy="yes"
318
	    break
325
	    break
319
	fi
326
	fi
320
    done
327
    done
321
    # do not copy links
328
    # do not copy links
322
    [ -L /$dir ] && do_not_copy="yes"
329
    [ -L /$dir ] && do_not_copy="yes"
323
 
330
 
324
    fail=""
331
    fail=""
325
    if [ ! $do_not_copy ]; then
332
    if [ ! $do_not_copy ]; then
326
	echo -n "  * Copy  /$dir ... "
333
	echo -n "  * Copy  /$dir ... "
327
	cp -a /$dir $NEW || fail=true
334
	cp -a /$dir $NEW || fail=true
328
	echo "done."
335
	echo "done."
329
    fi
336
    fi
330
done
337
done
331
echo
338
echo
332
if [ $fail ]; then
339
if [ $fail ]; then
333
    echo "ERROR: Not everything was copied to $INSTALL_PART"
340
    echo "ERROR: Not everything was copied to $INSTALL_PART"
334
    exit_now 1
341
    exit_now 1
335
fi
342
fi
336
 
343
 
337
 
344
 
338
### move /usr/opt back to /opt
345
### move /usr/opt back to /opt
339
### -----------------------------------------------------------
346
### -----------------------------------------------------------
340
if [ -d $NEW/usr/opt ]; then
347
if [ -d $NEW/usr/opt ]; then
341
    echo -n "Move /opt back ... "
348
    echo -n "Move /opt back ... "
342
    mv $NEW/usr/opt $NEW/
349
    mv $NEW/usr/opt $NEW/
343
    echo "done."; echo
350
    echo "done."; echo
344
fi
351
fi
345
 
352
 
346
 
353
 
347
### create dirs which were not copied
354
### create dirs which were not copied
348
### -----------------------------------------------------------
355
### -----------------------------------------------------------
349
for dir in $DIR_NOT_COPY; do
356
for dir in $DIR_NOT_COPY; do
350
    mkdir $NEW/$dir
357
    mkdir $NEW/$dir
351
done
358
done
352
# we do not need this directories
359
# we do not need this directories
353
rmdir $NEW/livecd
360
rmdir $NEW/livecd
354
# if not yet existing, create
361
# if not yet existing, create
355
mkdir -p $NEW/srv
362
mkdir -p $NEW/srv
356
mkdir -p $NEW/selinux
363
mkdir -p $NEW/selinux
357
 
364
 
358
 
365
 
359
### copy back original files
366
### copy back original files
360
### -----------------------------------------------------------
367
### -----------------------------------------------------------
361
echo -n "Restore original files ... " 
368
echo -n "Restore original files ... " 
362
for file in $FILES_RESTORE; do
369
for file in $FILES_RESTORE; do
363
    [ -r $NEW/${file}.ori ] && mv -f $NEW/${file}.ori $NEW/${file} 
370
    [ -r $NEW/${file}.ori ] && mv -f $NEW/${file}.ori $NEW/${file} 
364
done
371
done
365
echo "done."; echo
372
echo "done."; echo
366
 
373
 
367
 
374
 
368
### define kernel version
375
### define kernel version
369
### -----------------------------------------------------------
376
### -----------------------------------------------------------
370
rpm --quiet -q kernel     && UP_installed=true
377
rpm --quiet -q kernel     && UP_installed=true
371
rpm --quiet -q kernel-smp && SMP_installed=true
378
rpm --quiet -q kernel-smp && SMP_installed=true
372
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
379
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
373
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
380
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
374
if [ ! $KERNEL_VERSION ]; then
381
if [ ! $KERNEL_VERSION ]; then
375
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
382
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
376
    exit_now 1
383
    exit_now 1
377
fi    
384
fi    
378
 
385
 
379
 
386
 
380
 
387
 
381
if [ ! $NOGRUB ]; then
388
if [ ! $NOGRUB ]; then
382
 
389
 
383
    ### Backup Master Boot Record MBR
390
    ### Backup Master Boot Record MBR
384
    ### -----------------------------------------------------------
391
    ### -----------------------------------------------------------
385
    if [ ! $NOGRUB ]; then
392
    if [ ! $NOGRUB ]; then
386
	# do we have already a backup?
393
	# do we have already a backup?
387
	MBR_FILENAME="MBR$( echo $MBR_DEV | tr / _ ).bak"
394
	MBR_FILENAME="MBR$( echo $MBR_DEV | tr / _ ).bak"
388
	if [ ! -e /tmp/$MBR_FILENAME ]; then
395
	if [ ! -e /tmp/$MBR_FILENAME ]; then
389
	    echo "Backup Master Boot Record (MBR) of $MBR_DEV ..."
396
	    echo "Backup Master Boot Record (MBR) of $MBR_DEV ..."
390
	    dd if=$MBR_DEV of=/tmp/$MBR_FILENAME bs=512 count=1
397
	    dd if=$MBR_DEV of=/tmp/$MBR_FILENAME bs=512 count=1
391
	fi
398
	fi
392
	cp -a /tmp/$MBR_FILENAME $NEW/$MBR_FILENAME
399
	cp -a /tmp/$MBR_FILENAME $NEW/$MBR_FILENAME
393
	echo "MBR saved as $MBR_FILENAME on $INSTALL_PART and on /tmp"
400
	echo "MBR saved as $MBR_FILENAME on $INSTALL_PART and on /tmp"
394
	echo
401
	echo
395
    fi
402
    fi
396
 
403
 
397
 
404
 
398
    ### install grub
405
    ### install grub
399
    ### -----------------------------------------------------------
406
    ### -----------------------------------------------------------
400
    echo "Run grub-install ... "
407
    echo "Run grub-install ... "
401
    mkdir -p $NEW/boot/grub
408
    mkdir -p $NEW/boot/grub
402
    if [ $FLOPPY ]; then
409
    if [ $FLOPPY ]; then
403
	grub-install --root-directory=$NEW $MBR_DEV
410
	grub-install --root-directory=$NEW $MBR_DEV
404
    else
411
    else
405
	grub-install --no-floppy --root-directory=$NEW $MBR_DEV
412
	grub-install --no-floppy --root-directory=$NEW $MBR_DEV
406
    fi
413
    fi
407
    echo "done."; echo
414
    echo "done."; echo
408
 
415
 
409
 
416
 
410
    ### check for device.map file 
417
    ### check for device.map file 
411
    ### -----------------------------------------------------------
418
    ### -----------------------------------------------------------
412
    DEVICE_MAP=$NEW/boot/grub/device.map
419
    DEVICE_MAP=$NEW/boot/grub/device.map
413
    if [ ! -e $NEW/boot/grub/device.map ]; then
420
    if [ ! -e $NEW/boot/grub/device.map ]; then
414
	echo "ERROR: $NEW/boot/grub/device.map not found"
421
	echo "ERROR: $NEW/boot/grub/device.map not found"
415
	exit_now 1
422
	exit_now 1
416
    fi
423
    fi
417
 
424
 
418
 
425
 
419
    ### convert dev syntax to grub syntax
426
    ### convert dev syntax to grub syntax
420
    ### -----------------------------------------------------------
427
    ### -----------------------------------------------------------
421
    GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $DEVICE_MAP | awk '{ print $1 }' )
428
    GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $DEVICE_MAP | awk '{ print $1 }' )
422
    GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
429
    GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
423
 
430
 
424
 
431
 
425
    ### find active Windows partition
432
    ### find active Windows partition
426
    ### -----------------------------------------------------------
433
    ### -----------------------------------------------------------
427
    if [ ! $WIN_PART ]; then
434
    if [ ! $WIN_PART ]; then
428
        # try to find active Windows partition
435
        # try to find active Windows partition
429
	WIN_PART=$( fdisk -l 2>/dev/null | awk '{ if ($2 == "*" && $7 ~ "NTFS") print $1 }' | head -1 )
436
	WIN_PART=$( fdisk -l 2>/dev/null | awk '{ if ($2 == "*" && $7 ~ "NTFS") print $1 }' | head -1 )
430
    fi
437
    fi
431
 
438
 
432
    if [ $WIN_PART ]; then
439
    if [ $WIN_PART ]; then
433
	WIN_installed=true
440
	WIN_installed=true
434
	WIN_DISK=$( echo "$WIN_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
441
	WIN_DISK=$( echo "$WIN_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
435
	WIN_PART_NR=$( echo "$WIN_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
442
	WIN_PART_NR=$( echo "$WIN_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
436
        # convert dev syntax to grub syntax
443
        # convert dev syntax to grub syntax
437
	GRUB_WIN_DEV=$( grep $WIN_DISK $DEVICE_MAP | awk '{ print $1 }' )
444
	GRUB_WIN_DEV=$( grep $WIN_DISK $DEVICE_MAP | awk '{ print $1 }' )
438
	GRUB_WIN_PART=$( echo "$GRUB_WIN_DEV" | sed "s%)$%,`expr $WIN_PART_NR - 1`)%" )
445
	GRUB_WIN_PART=$( echo "$GRUB_WIN_DEV" | sed "s%)$%,`expr $WIN_PART_NR - 1`)%" )
439
 
446
 
440
        # $GRUB_WIN_PART should be something like (hd0,0)
447
        # $GRUB_WIN_PART should be something like (hd0,0)
441
	echo "Found active Windows partition ( $WIN_PART = $GRUB_WIN_PART )" 
448
	echo "Found active Windows partition ( $WIN_PART = $GRUB_WIN_PART )" 
442
	echo "Will add entry for Windows in GRUB."
449
	echo "Will add entry for Windows in GRUB."
443
	echo
450
	echo
444
    fi
451
    fi
445
 
452
 
446
 
453
 
447
    ### create grub.conf file
454
    ### create grub.conf file
448
    ### -----------------------------------------------------------
455
    ### -----------------------------------------------------------
449
    echo "Create grub.conf ..."
456
    echo "Create grub.conf ..."
450
 
457
 
451
    TITLE="Linux"
458
    TITLE="Linux"
452
    [ -e $NEW//etc/redhat-release ] && TITLE=$( cat $NEW/etc/redhat-release )
459
    [ -e $NEW//etc/redhat-release ] && TITLE=$( cat $NEW/etc/redhat-release )
453
 
460
 
454
    cat > $NEW/boot/grub/grub.conf <<EOF
461
    cat > $NEW/boot/grub/grub.conf <<EOF
455
# grub.conf generated by $SCRIPTNAME
462
# grub.conf generated by $SCRIPTNAME
456
default=0
463
default=0
457
timeout=5
464
timeout=5
458
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
465
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
459
#hiddenmenu
466
#hiddenmenu
460
EOF
467
EOF
461
 
468
 
462
    if [ $UP_installed ]; then
469
    if [ $UP_installed ]; then
463
	echo "Add entry for UP kernel into grub.conf"
470
	echo "Add entry for UP kernel into grub.conf"
464
	cat >> $NEW/boot/grub/grub.conf <<EOF
471
	cat >> $NEW/boot/grub/grub.conf <<EOF
465
title $TITLE (${KERNEL_VERSION})
472
title $TITLE (${KERNEL_VERSION})
466
        root $GRUB_ROOT_PART
473
        root $GRUB_ROOT_PART
467
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
474
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
468
	initrd /boot/initrd-$KERNEL_VERSION.img
475
	initrd /boot/initrd-$KERNEL_VERSION.img
469
EOF
476
EOF
470
    fi
477
    fi
471
 
478
 
472
    if [ $SMP_installed ]; then
479
    if [ $SMP_installed ]; then
473
	echo "Add entry for SMP kernel into grub.conf"
480
	echo "Add entry for SMP kernel into grub.conf"
474
	cat >> $NEW/boot/grub/grub.conf <<EOF
481
	cat >> $NEW/boot/grub/grub.conf <<EOF
475
title $TITLE (${KERNEL_VERSION}smp)
482
title $TITLE (${KERNEL_VERSION}smp)
476
        root $GRUB_ROOT_PART
483
        root $GRUB_ROOT_PART
477
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
484
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
478
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
485
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
479
EOF
486
EOF
480
    fi
487
    fi
481
 
488
 
482
    if [ $WIN_installed ]; then
489
    if [ $WIN_installed ]; then
483
	echo "Add entry for Windows into grub.conf"
490
	echo "Add entry for Windows into grub.conf"
484
	cat >> $NEW/boot/grub/grub.conf <<EOF
491
	cat >> $NEW/boot/grub/grub.conf <<EOF
485
title Windows
492
title Windows
486
        rootnoverify $GRUB_WIN_PART
493
        rootnoverify $GRUB_WIN_PART
487
        chainloader +1
494
        chainloader +1
488
EOF
495
EOF
489
    fi
496
    fi
490
 
497
 
491
    chmod 600 $NEW/boot/grub/grub.conf
498
    chmod 600 $NEW/boot/grub/grub.conf
492
    ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
499
    ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
493
    ln -s ./grub.conf $NEW/boot/grub/menu.lst
500
    ln -s ./grub.conf $NEW/boot/grub/menu.lst
494
    echo "done."; echo
501
    echo "done."; echo
495
 
502
 
496
fi
503
fi
497
 
504
 
498
 
505
 
499
### install kernel and other files into /boot
506
### install kernel and other files into /boot
500
### -----------------------------------------------------------
507
### -----------------------------------------------------------
501
echo "Install kernel(s) ..."
508
echo "Install kernel(s) ..."
502
 
509
 
503
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
510
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
504
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
511
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
505
 
512
 
506
if [ ! $BOOT_DIR ]; then
513
if [ ! $BOOT_DIR ]; then
507
    echo "ERROR: No kernel found - installation failed"; echo
514
    echo "ERROR: No kernel found - installation failed"; echo
508
    exit_now 1
515
    exit_now 1
509
fi
516
fi
510
 
517
 
511
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
518
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
512
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
519
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
513
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
520
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
514
cp -a $BOOT_DIR/config-*           $NEW/boot/
521
cp -a $BOOT_DIR/config-*           $NEW/boot/
515
cp -a $BOOT_DIR/symvers-*.gz       $NEW/boot/        2>/dev/null
522
cp -a $BOOT_DIR/symvers-*.gz       $NEW/boot/        2>/dev/null
516
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/
523
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/
517
cp -a $BOOT_DIR/message.ja         $NEW/boot/        2>/dev/null
524
cp -a $BOOT_DIR/message.ja         $NEW/boot/        2>/dev/null
518
cp -a $BOOT_DIR/message            $NEW/boot/        2>/dev/null
525
cp -a $BOOT_DIR/message            $NEW/boot/        2>/dev/null
519
 
526
 
520
echo "done."; echo
527
echo "done."; echo
521
 
528
 
522
 
529
 
523
### create /etc/fstab
530
### create /etc/fstab
524
### -----------------------------------------------------------
531
### -----------------------------------------------------------
525
cat > $NEW/etc/fstab <<EOF
532
cat > $NEW/etc/fstab <<EOF
526
$INSTALL_PART         /                    ext3    defaults        1 1
533
$INSTALL_PART         /                    ext3    defaults        1 1
527
devpts            /dev/pts             devpts  gid=5,mode=620  0 0
534
devpts            /dev/pts             devpts  gid=5,mode=620  0 0
528
tmpfs             /dev/shm             tmpfs   defaults        0 0
535
tmpfs             /dev/shm             tmpfs   defaults        0 0
529
proc              /proc                proc    defaults        0 0
536
proc              /proc                proc    defaults        0 0
530
sysfs             /sys                 sysfs   defaults        0 0
537
sysfs             /sys                 sysfs   defaults        0 0
531
EOF
538
EOF
532
if [ $SWAP_PART ]; then
539
if [ $SWAP_PART ]; then
533
    echo "$SWAP_PART         swap                 swap    defaults        0 0" >> $NEW/etc/fstab
540
    echo "$SWAP_PART         swap                 swap    defaults        0 0" >> $NEW/etc/fstab
534
fi
541
fi
535
 
542
 
536
 
543
 
537
### make initrd 
544
### make initrd 
538
### (needs $NEW/etc/fstab to find correct modules for root filesystem !!)
545
### (needs $NEW/etc/fstab to find correct modules for root filesystem !!)
539
### -----------------------------------------------------------
546
### -----------------------------------------------------------
540
echo "Create initrd(s) ..."
547
echo "Create initrd(s) ..."
541
# initrd should not be build on tmpfs (we take $NEW/tmp instead of /tmp)
548
# initrd should not be build on tmpfs (we take $NEW/tmp instead of /tmp)
542
sed -i "s|^TMPDIR=.*|TMPDIR=\"$NEW/tmp\"|" /usr/sbin/livecd-mkinitrd
549
sed -i "s|^TMPDIR=.*|TMPDIR=\"$NEW/tmp\"|" /usr/sbin/livecd-mkinitrd
543
 
550
 
544
if [ $UP_installed ]; then
551
if [ $UP_installed ]; then
545
    depmod -a ${KERNEL_VERSION}
552
    depmod -a ${KERNEL_VERSION}
546
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
553
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
547
                    $NEW//boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
554
                    $NEW//boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
548
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
555
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
549
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
556
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
550
	exit_now 1
557
	exit_now 1
551
    fi
558
    fi
552
fi
559
fi
553
if [ $SMP_installed ]; then
560
if [ $SMP_installed ]; then
554
    depmod -a ${KERNEL_VERSION}smp
561
    depmod -a ${KERNEL_VERSION}smp
555
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
562
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
556
                    $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
563
                    $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
557
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
564
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
558
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
565
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
559
	exit_now 1
566
	exit_now 1
560
    fi
567
    fi
561
fi
568
fi
562
echo "done."; echo
569
echo "done."; echo
563
 
570
 
564
 
571
 
565
### remove LiveCD init.d scripts
572
### remove LiveCD init.d scripts
566
### -----------------------------------------------------------
573
### -----------------------------------------------------------
567
for file in $LIVECD_INIT_SCRIPTS; do
574
for file in $LIVECD_INIT_SCRIPTS; do
568
    rm -f $NEW/etc/init.d/$file
575
    rm -f $NEW/etc/init.d/$file
569
    for n in 0 1 2 3 4 5 6; do
576
    for n in 0 1 2 3 4 5 6; do
570
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
577
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
571
    done
578
    done
572
done
579
done
573
 
580
 
574
 
581
 
575
### restore cronjobs
582
### restore cronjobs
576
### -----------------------------------------------------------
583
### -----------------------------------------------------------
577
mv $NEW/etc/cron_backup/sysstat $NEW/etc/cron.d/ 2>/dev/null
584
mv $NEW/etc/cron_backup/sysstat $NEW/etc/cron.d/ 2>/dev/null
578
mv $NEW/etc/cron_backup/00-makewhatis.cron.weekly $NEW/etc/cron.weekly/00-makewhatis.cron 2>/dev/null
585
mv $NEW/etc/cron_backup/00-makewhatis.cron.weekly $NEW/etc/cron.weekly/00-makewhatis.cron 2>/dev/null
579
mv $NEW/etc/cron_backup/* $NEW/etc/cron.daily/
586
mv $NEW/etc/cron_backup/* $NEW/etc/cron.daily/
580
 
587
 
581
 
588
 
582
### prepare chroot to $NEW
589
### prepare chroot to $NEW
583
### -----------------------------------------------------------
590
### -----------------------------------------------------------
584
mount --bind /dev $NEW/dev
591
mount --bind /dev $NEW/dev
585
mount --bind /sys $NEW/sys
592
mount --bind /sys $NEW/sys
586
mount -t proc proc $NEW/proc
593
mount -t proc proc $NEW/proc
587
 
594
 
588
 
595
 
589
### turn on kudzu again
596
### turn on kudzu again
590
### -----------------------------------------------------------
597
### -----------------------------------------------------------
591
chroot $NEW chkconfig kudzu on
598
chroot $NEW chkconfig kudzu on
592
 
599
 
593
 
600
 
594
### remove RPMs that can break future updates  
601
### remove RPMs that can break future updates  
595
### -----------------------------------------------------------
602
### -----------------------------------------------------------
596
if [ ! $NORPMREMOVE ]; then
603
if [ ! $NORPMREMOVE ]; then
597
    echo "Remove RPMs that may break future updates ..."
604
    echo "Remove RPMs that may break future updates ..."
598
    chroot $NEW rpm -qa 2>/dev/null > /tmp/rpmlist
605
    chroot $NEW rpm -qa 2>/dev/null > /tmp/rpmlist
599
 
606
 
600
    # Scientific Linux RPMs
607
    # Scientific Linux RPMs
601
    RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_SL"
608
    RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_SL"
602
 
609
 
603
    # PSI Scientific Linux RPMs
610
    # PSI Scientific Linux RPMs
604
    if [ -e /etc/sysconfig/cfengine ]; then
611
    if [ -e /etc/sysconfig/cfengine ]; then
605
	RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_PSI"
612
	RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_PSI"
606
    fi
613
    fi
607
 
614
 
608
    for rpm in $RPMSTOREMOVE; do
615
    for rpm in $RPMSTOREMOVE; do
609
	rpms_remove=$( cat /tmp/rpmlist | grep "^$rpm" )
616
	rpms_remove=$( cat /tmp/rpmlist | grep "^$rpm" )
610
	for rpm_remove in $rpms_remove; do	
617
	for rpm_remove in $rpms_remove; do	
611
	    chroot $NEW rpm -e --nodeps $rpm_remove 2>/dev/null
618
	    chroot $NEW rpm -e --nodeps $rpm_remove 2>/dev/null
612
	    [ "$?" = "0" ] && echo "$rpm_remove removed"
619
	    [ "$?" = "0" ] && echo "$rpm_remove removed"
613
	done
620
	done
614
    done
621
    done
615
    echo "done."; echo
622
    echo "done."; echo
616
fi
623
fi
617
 
624
 
618
 
625
 
619
### umount $INSTALL_PART
626
### umount $INSTALL_PART
620
### -----------------------------------------------------------
627
### -----------------------------------------------------------
621
umount $NEW/dev
628
umount $NEW/dev
622
umount $NEW/sys
629
umount $NEW/sys
623
umount $NEW/proc
630
umount $NEW/proc
624
umount $INSTALL_PART
631
umount $INSTALL_PART
625
 
632
 
626
 
633
 
627
### print summary
634
### print summary
628
### -----------------------------------------------------------
635
### -----------------------------------------------------------
629
echo                     "--------------------------------------------------------------"
636
echo                     "--------------------------------------------------------------"
630
echo                     "  LiveCD installed on partition $INSTALL_PART"
637
echo                     "  LiveCD installed on partition $INSTALL_PART"
631
[ "$SWAP_PART" ] && echo "  Partition $SWAP_PART will be used as swap partition"
638
[ "$SWAP_PART" ] && echo "  Partition $SWAP_PART will be used as swap partition"
632
echo
639
echo
633
[ ! $NOGRUB ]    && echo "  GRUB installed in Master Boot Record (MBR) of $MBR_DEV"
640
[ ! $NOGRUB ]    && echo "  GRUB installed in Master Boot Record (MBR) of $MBR_DEV"
634
[ ! $NOGRUB ]    && echo "  MBR saved as $MBR_FILENAME on $INSTALL_PART and in /tmp"
641
[ ! $NOGRUB ]    && echo "  MBR saved as $MBR_FILENAME on $INSTALL_PART and in /tmp"
635
[ ! $NOGRUB ]    && echo "  If you have to restore MBR, execute under Linux:"
642
[ ! $NOGRUB ]    && echo "  If you have to restore MBR, execute under Linux:"
636
[ ! $NOGRUB ]    && echo "  # dd if=$MBR_FILENAME of=$MBR_DEV bs=512 count=1"
643
[ ! $NOGRUB ]    && echo "  # dd if=$MBR_FILENAME of=$MBR_DEV bs=512 count=1"
637
echo 
644
echo 
638
[ $WIN_PART ]    && echo "  Entry created in grub.conf for Windows partition $WIN_PART"
645
[ $WIN_PART ]    && echo "  Entry created in grub.conf for Windows partition $WIN_PART"
639
echo                     "--------------------------------------------------------------"
646
echo                     "--------------------------------------------------------------"
640
echo                     "End of $SCRIPTNAME"
647
echo                     "End of $SCRIPTNAME"
641
echo
648
echo