Subversion Repositories livecd

Rev

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

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