Subversion Repositories livecd

Rev

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

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