Subversion Repositories livecd

Rev

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

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