Subversion Repositories livecd

Rev

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

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