Subversion Repositories livecd

Rev

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

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