Subversion Repositories livecd

Rev

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

Rev 244 Rev 259
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
###############################################################
3
###############################################################
4
#
4
#
5
# Installes the LiveCD on local hard disk
5
# Installes the LiveCD on local hard disk
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
9
# Urs Beyerle
10
# Brent L. Bates
10
# Brent L. Bates
11
#
11
#
12
###############################################################
12
###############################################################
13
 
13
 
14
 
14
 
15
###############################################################
15
###############################################################
16
# Definitions
16
# Definitions
17
###############################################################
17
###############################################################
18
 
18
 
19
# set PATH
19
# set PATH
20
PATH="/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin"
20
PATH="/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin"
21
 
21
 
22
# RPMs that are no longer needed and may break future udpates
22
# RPMs that are no longer needed and may break future udpates
23
RPMS_TO_REMOVE="kernel-module-squashfs \
23
RPMS_TO_REMOVE="kernel-module-squashfs \
24
                kernel-module-unionfs \
24
                kernel-module-unionfs \
25
                kernel-module-aufs \
25
                kernel-module-aufs \
26
                unionfs-.* \
26
                unionfs-.* \
27
                aufs-.* \
27
                aufs-.* \
28
                squashfs-.*"
28
                squashfs-.*"
29
 
29
 
30
# RPMs that can break future Scientific Linux updates
30
# RPMs that can break future Scientific Linux updates
31
# because there are not part of Scientific Linux
31
# because there are not part of Scientific Linux
32
RPMS_TO_REMOVE_SL=""
32
RPMS_TO_REMOVE_SL=""
33
                   
33
                   
34
# RPMs that can break future PSI SL updates
34
# RPMs that can break future PSI SL updates
35
# because there are not part of PSI Scientific Linux
35
# because there are not part of PSI Scientific Linux
36
RPMS_TO_REMOVE_PSI=""
36
RPMS_TO_REMOVE_PSI=""
37
                   
37
                   
38
# files which should be restored from .ori files
38
# files which should be restored from .ori files
39
FILES_RESTORE="/etc/init.d/netfs \
39
FILES_RESTORE="/etc/init.d/netfs \
40
           /etc/init.d/autofs \
40
           /etc/init.d/autofs \
41
           /etc/init.d/halt \
41
           /etc/init.d/halt \
42
           /etc/init.d/network
42
           /etc/init.d/network
43
           /etc/init.d/functions \
43
           /etc/init.d/functions \
44
           /etc/rc.d/rc.sysinit \
44
           /etc/rc.d/rc.sysinit \
45
           /etc/sysconfig/afs \
45
           /etc/sysconfig/afs \
46
           /etc/motd \
46
           /etc/motd \
47
           /etc/redhat-release \
47
           /etc/redhat-release \
-
 
48
           /etc/hotplug/blacklist \
-
 
49
           /etc/modprobe.d/blacklist \
-
 
50
           /lib/udev/udev_run_hotpluged \
48
           /etc/rc.d/rc.local"
51
           /etc/rc.d/rc.local"
49
 
52
 
50
# LiveCD init scripts will be removed
53
# LiveCD init scripts will be removed
51
LIVECD_INIT_SCRIPTS="runfirst \
54
LIVECD_INIT_SCRIPTS="runfirst \
52
                    runveryfirst \
55
                    runveryfirst \
53
                    runlast \
56
                    runlast \
54
                    kudzu-auto \
57
                    kudzu-auto \
55
                    login"
58
                    login"
56
 
59
 
57
# Main directories which should be not be copied
60
# Main directories which should be not be copied
58
DIR_NOT_COPY="/proc \
61
DIR_NOT_COPY="/proc \
59
              /dev \
62
              /dev \
60
              /livecd \
63
              /livecd \
61
              /boot \
64
              /boot \
62
              /afs \
65
              /afs \
63
              /sys \
66
              /sys \
64
              /media \
67
              /media \
65
              /misc \
68
              /misc \
66
              /mnt \
69
              /mnt \
67
              /net \
70
              /net \
68
              /initrd"
71
              /initrd"
69
 
72
 
70
# Mount point of the new SL system
73
# Mount point of the new SL system
71
NEW=/mnt/harddisk
74
NEW=/mnt/harddisk
72
 
75
 
73
# Name of the script
76
# Name of the script
74
SCRIPTNAME=$( basename $0 )
77
SCRIPTNAME=$( basename $0 )
75
 
78
 
76
# dir of mounted /$MOUNTDIR/live
79
# dir of mounted /$MOUNTDIR/live
77
MOUNTDIR=livecd
80
MOUNTDIR=livecd
78
 
81
 
79
# Default File System Type
82
# Default File System Type
80
FS_TYPE=ext3
83
FS_TYPE=ext3
81
 
84
 
82
 
85
 
83
###############################################################
86
###############################################################
84
# Functions
87
# Functions
85
###############################################################
88
###############################################################
86
 
89
 
87
function usage() {
90
function usage() {
88
 
91
 
89
   ## Usage
92
   ## Usage
90
   # ----------------------------------------------------------
93
   # ----------------------------------------------------------
91
 
94
 
92
   cat <<EOF
95
   cat <<EOF
93
   
96
   
94
  $SCRIPTNAME [OPTIONS] -mbr=[DEVICE] [PARTITION | MOUNTED FILE SYSTEM]
97
  $SCRIPTNAME [OPTIONS] -mbr=[DEVICE] [PARTITION | MOUNTED FILE SYSTEM]
95
 
98
 
96
    Installes LiveCD on PARTITION and the bootloader grub into 
99
    Installes LiveCD on PARTITION and the bootloader grub into 
97
    the Master Boot Record (MBR) of DEVICE. The MBR will be 
100
    the Master Boot Record (MBR) of DEVICE. The MBR will be 
98
    backed up to PARTITION.
101
    backed up to PARTITION.
99
 
102
 
100
  OPTIONS:
103
  OPTIONS:
101
 
104
 
102
    -h   --help          : Print this screen
105
    -h   --help          : Print this screen
103
    -swap=[partition(s)] : Use [partition(s)] as swap ("," or "|" separated)
106
    -swap=[partition(s)] : Use [partition(s)] as swap ("," or "|" separated)
104
    -win=[partition]     : Your active Windows partition. If not given, 
107
    -win=[partition]     : Your active Windows partition. If not given, 
105
                           $SCRIPTNAME tries to find it
108
                           $SCRIPTNAME tries to find it
106
    -nogrub              : Do not install grub. You have to install 
109
    -nogrub              : Do not install grub. You have to install 
107
                           manually a bootloader (not recommended)
110
                           manually a bootloader (not recommended)
108
    -floppy              : Needed, if grub should be installed on floppy
111
    -floppy              : Needed, if grub should be installed on floppy
109
                           In this case use -mbr=/dev/fd0 -floppy
112
                           In this case use -mbr=/dev/fd0 -floppy
110
    -norpmremove         : Do not remove RPMs that can break future 
113
    -norpmremove         : Do not remove RPMs that can break future 
111
                           updates (not recommended)
114
                           updates (not recommended)
112
    -fstype              : File system type (ext3,xfs,etc.), default is $FS_TYPE
115
    -fstype              : File system type (ext3,xfs,etc.), default is $FS_TYPE
113
    -y                   : Answer all questions with yes
116
    -y                   : Answer all questions with yes
114
 
117
 
115
  Example:
118
  Example:
116
 
119
 
117
  $SCRIPTNAME -swap=/dev/sda3 -mbr=/dev/sda /dev/sda2
120
  $SCRIPTNAME -swap=/dev/sda3 -mbr=/dev/sda /dev/sda2
118
 
121
 
119
    Will install LiveCD on /dev/sda2 (= second partition on 
122
    Will install LiveCD on /dev/sda2 (= second partition on 
120
    first SATA disk). All data on /dev/sda2 will be deleted.
123
    first SATA disk). All data on /dev/sda2 will be deleted.
121
    /dev/sda3 has to be a Linux Swap partion. GRUB will be 
124
    /dev/sda3 has to be a Linux Swap partion. GRUB will be 
122
    installed in the MBR of /dev/sda (= first SATA disk).
125
    installed in the MBR of /dev/sda (= first SATA disk).
123
   
126
   
124
  Remarks:
127
  Remarks:
125
 
128
 
126
    To display your hard disk partitions, user 'fdisk -l'.
129
    To display your hard disk partitions, user 'fdisk -l'.
127
    Use fdisk, qtparted or parted to create an empty Linux
130
    Use fdisk, qtparted or parted to create an empty Linux
128
    partition.
131
    partition.
129
 
132
 
130
EOF
133
EOF
131
}
134
}
132
 
135
 
133
 
136
 
134
function exit_now() {
137
function exit_now() {
135
 
138
 
136
    local exitcode=$1
139
    local exitcode=$1
137
    umount $INSTALL_PART 2>/dev/null
140
    umount $INSTALL_PART 2>/dev/null
138
    exit $exitcode
141
    exit $exitcode
139
}
142
}
140
 
143
 
141
 
144
 
142
 
145
 
143
###############################################################
146
###############################################################
144
# Main
147
# Main
145
###############################################################
148
###############################################################
146
 
149
 
147
### are we root?
150
### are we root?
148
### -----------------------------------------------------------
151
### -----------------------------------------------------------
149
if [ "$( whoami )" != "root" ]; then
152
if [ "$( whoami )" != "root" ]; then
150
    echo; echo "Please run this script as root: 'su - -c $SCRIPTNAME'"; echo
153
    echo; echo "Please run this script as root: 'su - -c $SCRIPTNAME'"; echo
151
    exit_now 1
154
    exit_now 1
152
fi
155
fi
153
 
156
 
154
 
157
 
155
### read options from command-line
158
### read options from command-line
156
### -----------------------------------------------------------
159
### -----------------------------------------------------------
157
while [ $# -gt 0 ]; do
160
while [ $# -gt 0 ]; do
158
 
161
 
159
    case "$1" in
162
    case "$1" in
160
       -h)
163
       -h)
161
            usage; exit_now;;
164
            usage; exit_now;;
162
 
165
 
163
       --help)
166
       --help)
164
            usage; exit_now;;
167
            usage; exit_now;;
165
 
168
 
166
       -swap*)
169
       -swap*)
167
           if echo $1 | grep -q '=' ; then
170
           if echo $1 | grep -q '=' ; then
168
               SWAP_PART=$( echo $1 | sed 's/^-swap=//' )
171
               SWAP_PART=$( echo $1 | sed 's/^-swap=//' )
169
           else
172
           else
170
               shift
173
               shift
171
               SWAP_PART=$1
174
               SWAP_PART=$1
172
           fi
175
           fi
173
           ;;
176
           ;;
174
 
177
 
175
       -mbr*)
178
       -mbr*)
176
           if echo $1 | grep -q '=' ; then
179
           if echo $1 | grep -q '=' ; then
177
               MBR_DEV=$( echo $1 | sed 's/^-mbr=//' )
180
               MBR_DEV=$( echo $1 | sed 's/^-mbr=//' )
178
           else
181
           else
179
               shift
182
               shift
180
               MBR_DEV=$1
183
               MBR_DEV=$1
181
           fi
184
           fi
182
           MBR_DEV=$( echo "$MBR_DEV" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
185
           MBR_DEV=$( echo "$MBR_DEV" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
183
           ;;
186
           ;;
184
 
187
 
185
       -win*)
188
       -win*)
186
           if echo $1 | grep -q '=' ; then
189
           if echo $1 | grep -q '=' ; then
187
               WIN_PART=$( echo $1 | sed 's/^-win=//' )
190
               WIN_PART=$( echo $1 | sed 's/^-win=//' )
188
           else
191
           else
189
               shift
192
               shift
190
               WIN_PART=$1
193
               WIN_PART=$1
191
           fi
194
           fi
192
           ;;
195
           ;;
193
 
196
 
194
       -nogrub)
197
       -nogrub)
195
            NOGRUB=$1;;
198
            NOGRUB=$1;;
196
 
199
 
197
       -norpmremove)
200
       -norpmremove)
198
            NORPMREMOVE=$1;;
201
            NORPMREMOVE=$1;;
199
 
202
 
200
       -floppy)
203
       -floppy)
201
            FLOPPY=$1;;
204
            FLOPPY=$1;;
202
 
205
 
203
       -fstype)
206
       -fstype)
204
            shift
207
            shift
205
	    FS_TYPE=$1;;
208
	    FS_TYPE=$1;;
206
 
209
 
207
       -y)
210
       -y)
208
            YES=$1;;
211
            YES=$1;;
209
 
212
 
210
       *)
213
       *)
211
            INSTALL_PART=$1;;
214
            INSTALL_PART=$1;;
212
    esac
215
    esac
213
 
216
 
214
    shift
217
    shift
215
 
218
 
216
done
219
done
217
echo
220
echo
218
 
221
 
219
 
222
 
220
### display fdisk -l
223
### display fdisk -l
221
### -----------------------------------------------------------
224
### -----------------------------------------------------------
222
echo "Output of 'fdisk -l' ..."
225
echo "Output of 'fdisk -l' ..."
223
fdisk -l 2>/dev/null
226
fdisk -l 2>/dev/null
224
echo
227
echo
225
 
228
 
226
 
229
 
227
### test if $INSTALL_PART is defined
230
### test if $INSTALL_PART is defined
228
### -----------------------------------------------------------
231
### -----------------------------------------------------------
229
if [ ! $INSTALL_PART ]; then
232
if [ ! $INSTALL_PART ]; then
230
    echo "No partition defined for installation."
233
    echo "No partition defined for installation."
231
    echo "Please see '$SCRIPTNAME -h'."; echo
234
    echo "Please see '$SCRIPTNAME -h'."; echo
232
    exit_now 1
235
    exit_now 1
233
fi
236
fi
234
 
237
 
235
 
238
 
236
### test if MBR_DEV is given
239
### test if MBR_DEV is given
237
### -----------------------------------------------------------
240
### -----------------------------------------------------------
238
if [ ! $NOGRUB ]; then
241
if [ ! $NOGRUB ]; then
239
    if [ ! $MBR_DEV ]; then
242
    if [ ! $MBR_DEV ]; then
240
        echo "No MBR device defined."
243
        echo "No MBR device defined."
241
        echo "Please see '$SCRIPTNAME -h'."
244
        echo "Please see '$SCRIPTNAME -h'."
242
        echo
245
        echo
243
        exit_now 1
246
        exit_now 1
244
    fi
247
    fi
245
fi
248
fi
246
 
249
 
247
 
250
 
248
### test if $INSTALL_PART is mounted
251
### test if $INSTALL_PART is mounted
249
### -----------------------------------------------------------
252
### -----------------------------------------------------------
250
df -T -l | sed -e 's/  */ /g' | grep -q "${INSTALL_PART}"
253
df -T -l | sed -e 's/  */ /g' | grep -q "${INSTALL_PART}"
251
 
254
 
252
if [ "$?" = "0" ]; then
255
if [ "$?" = "0" ]; then
253
   ### This is a mounted partition
256
   ### This is a mounted partition
254
   ### -----------------------------------------------------------
257
   ### -----------------------------------------------------------
255
   MOUNTED=1
258
   MOUNTED=1
256
 
259
 
257
   df -T -l | sed -e 's/  */ /g' | cut -d" " -f7 | grep -q "^${INSTALL_PART}$"
260
   df -T -l | sed -e 's/  */ /g' | cut -d" " -f7 | grep -q "^${INSTALL_PART}$"
258
   if [ "$?" = "0" ]; then
261
   if [ "$?" = "0" ]; then
259
 
262
 
260
      ### Was given the mount point
263
      ### Was given the mount point
261
      ### -----------------------------------------------------------
264
      ### -----------------------------------------------------------
262
      NEW=${INSTALL_PART}
265
      NEW=${INSTALL_PART}
263
      INSTALL_PART=`df -T -l | grep "${INSTALL_PART}$" | cut -d" " -f1`
266
      INSTALL_PART=`df -T -l | grep "${INSTALL_PART}$" | cut -d" " -f1`
264
   else
267
   else
265
 
268
 
266
      ### Was given the mount partition
269
      ### Was given the mount partition
267
      ### -----------------------------------------------------------
270
      ### -----------------------------------------------------------
268
      NEW=`df -T -l | grep "^${INSTALL_PART}" | sed -e 's/  */ /g' | cut -d" " -f7`
271
      NEW=`df -T -l | grep "^${INSTALL_PART}" | sed -e 's/  */ /g' | cut -d" " -f7`
269
   fi
272
   fi
270
   FS_TYPE=`df -T -l | sed -e 's/  */ /g' | grep "^${INSTALL_PART}" | cut -d" " -f2`
273
   FS_TYPE=`df -T -l | sed -e 's/  */ /g' | grep "^${INSTALL_PART}" | cut -d" " -f2`
271
 
274
 
272
   ### Get boot defice information
275
   ### Get boot defice information
273
   ###    Check for separate mounted boot partition
276
   ###    Check for separate mounted boot partition
274
   ### -----------------------------------------------------------
277
   ### -----------------------------------------------------------
275
   INSTALL_DEV=`df -T -l | sed -e 's/  */ /g' | grep "boot$" | cut -d" " -f1`
278
   INSTALL_DEV=`df -T -l | sed -e 's/  */ /g' | grep "boot$" | cut -d" " -f1`
276
   if [ "$?" = "0" ]; then
279
   if [ "$?" = "0" ]; then
277
      ###    Separate boot partition
280
      ###    Separate boot partition
278
      ### -----------------------------------------------------------
281
      ### -----------------------------------------------------------
279
      INSTALL_BOOT_DIR=""
282
      INSTALL_BOOT_DIR=""
280
   else
283
   else
281
      ###    Install and boot all one partition
284
      ###    Install and boot all one partition
282
      ### -----------------------------------------------------------
285
      ### -----------------------------------------------------------
283
      INSTALL_DEV=${INSTALL_PART}
286
      INSTALL_DEV=${INSTALL_PART}
284
      INSTALL_BOOT_DIR="/boot"
287
      INSTALL_BOOT_DIR="/boot"
285
   fi
288
   fi
286
 
289
 
287
   ### Is the boot device a RAID device
290
   ### Is the boot device a RAID device
288
   ### -----------------------------------------------------------
291
   ### -----------------------------------------------------------
289
   mdadm -D $INSTALL_DEV 2>/dev/null | grep -q -i Version
292
   mdadm -D $INSTALL_DEV 2>/dev/null | grep -q -i Version
290
   if [ "$?" = "0" ]; then
293
   if [ "$?" = "0" ]; then
291
      ### Boot device is RAID
294
      ### Boot device is RAID
292
      ### -----------------------------------------------------------
295
      ### -----------------------------------------------------------
293
      BOOT_DRIVE=`mdadm -D $INSTALL_DEV | grep -v ':$' | grep "/dev/" | sed -e 's/  */ /g' | cut -d" " -f8 |head -1`
296
      BOOT_DRIVE=`mdadm -D $INSTALL_DEV | grep -v ':$' | grep "/dev/" | sed -e 's/  */ /g' | cut -d" " -f8 |head -1`
294
      INSTALL_PART_NR=$( echo "$BOOT_DRIVE" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
297
      INSTALL_PART_NR=$( echo "$BOOT_DRIVE" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
295
      BOOT_DRIVE=$( echo "$BOOT_DRIVE" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
298
      BOOT_DRIVE=$( echo "$BOOT_DRIVE" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
296
   else
299
   else
297
      ### Boot device not RAID
300
      ### Boot device not RAID
298
      ### -----------------------------------------------------------
301
      ### -----------------------------------------------------------
299
      INSTALL_PART_NR=$( echo "$INSTALL_DEV" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
302
      INSTALL_PART_NR=$( echo "$INSTALL_DEV" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
300
      INSTALL_DEV=$( echo "$INSTALL_DEV" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
303
      INSTALL_DEV=$( echo "$INSTALL_DEV" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
301
      BOOT_DRIVE=$INSTALL_DEV
304
      BOOT_DRIVE=$INSTALL_DEV
302
   fi
305
   fi
303
else
306
else
304
   ### Partition is NOT mounted
307
   ### Partition is NOT mounted
305
   ### -----------------------------------------------------------
308
   ### -----------------------------------------------------------
306
   MOUNTED=0
309
   MOUNTED=0
307
 
310
 
308
   ### test if $INSTALL_PART exists
311
   ### test if $INSTALL_PART exists
309
   ### -----------------------------------------------------------
312
   ### -----------------------------------------------------------
310
   fdisk -l 2>/dev/null | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
313
   fdisk -l 2>/dev/null | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
311
   if [ "$?" != "0" ]; then
314
   if [ "$?" != "0" ]; then
312
       echo "Partition $INSTALL_PART not found! See 'fdisk -l'."
315
       echo "Partition $INSTALL_PART not found! See 'fdisk -l'."
313
       echo "Or you have to reboot first to make the partition table active." 
316
       echo "Or you have to reboot first to make the partition table active." 
314
       echo
317
       echo
315
       exit_now 1
318
       exit_now 1
316
   fi
319
   fi
317
 
320
 
318
 
321
 
319
   ### test if $INSTALL_PART is a Linux partition
322
   ### test if $INSTALL_PART is a Linux partition
320
   ### -----------------------------------------------------------
323
   ### -----------------------------------------------------------
321
   fdisk -l 2>/dev/null | grep "Linux$" | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
324
   fdisk -l 2>/dev/null | grep "Linux$" | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
322
   if [ "$?" != "0" ]; then
325
   if [ "$?" != "0" ]; then
323
       echo "Partition $INSTALL_PART is not a Linux partition! (see 'fdisk -l')."
326
       echo "Partition $INSTALL_PART is not a Linux partition! (see 'fdisk -l')."
324
       echo "Use fdisk and/or qtparted to create a Linux partition!"
327
       echo "Use fdisk and/or qtparted to create a Linux partition!"
325
       echo "You have to reboot first to make the partition table active."
328
       echo "You have to reboot first to make the partition table active."
326
       echo
329
       echo
327
       exit_now 1
330
       exit_now 1
328
   fi
331
   fi
329
 
332
 
330
   ### set $INSTALL_DEV (eg. /dev/sda)
333
   ### set $INSTALL_DEV (eg. /dev/sda)
331
   ### -----------------------------------------------------------
334
   ### -----------------------------------------------------------
332
   INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
335
   INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
333
   BOOT_DRIVE=$INSTALL_DEV
336
   BOOT_DRIVE=$INSTALL_DEV
334
   INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
337
   INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
335
   INSTALL_BOOT_DIR="/boot"
338
   INSTALL_BOOT_DIR="/boot"
336
fi
339
fi
337
 
340
 
338
 
341
 
339
### test if $SWAP_PART exists and is a Linux Swap partition
342
### test if $SWAP_PART exists and is a Linux Swap partition
340
### -----------------------------------------------------------
343
### -----------------------------------------------------------
341
if [ "$SWAP_PART" ]; then
344
if [ "$SWAP_PART" ]; then
342
    SWAP_PART=`echo ${SWAP_PART} |tr '[,|]' ' '`
345
    SWAP_PART=`echo ${SWAP_PART} |tr '[,|]' ' '`
343
    for SWAP_PARTITION in $SWAP_PART ; do
346
    for SWAP_PARTITION in $SWAP_PART ; do
344
       fdisk -l 2>/dev/null | cut -d" " -f1 | grep -q "^${SWAP_PARTITION}$"
347
       fdisk -l 2>/dev/null | cut -d" " -f1 | grep -q "^${SWAP_PARTITION}$"
345
       if [ "$?" != "0" ]; then
348
       if [ "$?" != "0" ]; then
346
           echo "Swap partition $SWAP_PARTITION not found! (see 'fdisk -l')."
349
           echo "Swap partition $SWAP_PARTITION not found! (see 'fdisk -l')."
347
           echo "Or you have to reboot first to make the partition table active."
350
           echo "Or you have to reboot first to make the partition table active."
348
           echo
351
           echo
349
           exit_now 1
352
           exit_now 1
350
       fi
353
       fi
351
       fdisk -l 2>/dev/null | grep "Linux swap" | cut -d" " -f1 | grep -q "^${SWAP_PARTITION}$"
354
       fdisk -l 2>/dev/null | grep "Linux swap" | cut -d" " -f1 | grep -q "^${SWAP_PARTITION}$"
352
       if [ "$?" != "0" ]; then
355
       if [ "$?" != "0" ]; then
353
           echo "Partition(s) $SWAP_PARTITION is/are not a Linux swap partition! (see 'fdisk -l')."
356
           echo "Partition(s) $SWAP_PARTITION is/are not a Linux swap partition! (see 'fdisk -l')."
354
           echo "Use fdisk and/or qtparted to create a Linux Swap partition !"
357
           echo "Use fdisk and/or qtparted to create a Linux Swap partition !"
355
           echo "You have to reboot first to make the partition table active."
358
           echo "You have to reboot first to make the partition table active."
356
           echo
359
           echo
357
           exit_now 1
360
           exit_now 1
358
       fi
361
       fi
359
    done
362
    done
360
fi
363
fi
361
 
364
 
362
 
365
 
363
### print warning
366
### print warning
364
### -----------------------------------------------------------
367
### -----------------------------------------------------------
365
echo                     "------------------------------------------------------------"
368
echo                     "------------------------------------------------------------"
366
echo                     "   LiveCD will be installed on partition $INSTALL_PART"
369
echo                     "   LiveCD will be installed on partition $INSTALL_PART"
367
[ "$SWAP_PART" ] && echo " Partition(s) $SWAP_PART will be used as swap partition(s)."
370
[ "$SWAP_PART" ] && echo " Partition(s) $SWAP_PART will be used as swap partition(s)."
368
[ ! $NOGRUB ]    && echo " GRUB will be installed in Master Boot Record of $MBR_DEV"
371
[ ! $NOGRUB ]    && echo " GRUB will be installed in Master Boot Record of $MBR_DEV"
369
echo                     "       !! All data on $INSTALL_PART will be lost !!"
372
echo                     "       !! All data on $INSTALL_PART will be lost !!"
370
echo                     "------------------------------------------------------------"
373
echo                     "------------------------------------------------------------"
371
echo
374
echo
372
 
375
 
373
 
376
 
374
### continue?
377
### continue?
375
### -----------------------------------------------------------
378
### -----------------------------------------------------------
376
if [ ! $YES ]; then
379
if [ ! $YES ]; then
377
    echo -n "Continue (y/N)? "
380
    echo -n "Continue (y/N)? "
378
    read key
381
    read key
379
    echo
382
    echo
380
    [ "$key" != "y" ] && exit_now 0
383
    [ "$key" != "y" ] && exit_now 0
381
fi
384
fi
382
 
385
 
383
 
386
 
384
### format $SWAP_PART (don't format swap, if already formated)
387
### format $SWAP_PART (don't format swap, if already formated)
385
### -----------------------------------------------------------
388
### -----------------------------------------------------------
386
if [ "$SWAP_PART" ]; then
389
if [ "$SWAP_PART" ]; then
387
    echo "Make swap on $SWAP_PART ..."
390
    echo "Make swap on $SWAP_PART ..."
388
    swapoff -a >/dev/null 2>&1
391
    swapoff -a >/dev/null 2>&1
389
    swapon -p 1 $SWAP_PART 2>/dev/null
392
    swapon -p 1 $SWAP_PART 2>/dev/null
390
    if [ "$?" != "0" ]; then
393
    if [ "$?" != "0" ]; then
391
        for SWAP_PARTITION in $SWAP_PART; do
394
        for SWAP_PARTITION in $SWAP_PART; do
392
           echo "Format $SWAP_PARTITION as swap." 
395
           echo "Format $SWAP_PARTITION as swap." 
393
           mkswap $SWAP_PARTITION
396
           mkswap $SWAP_PARTITION
394
        done
397
        done
395
    fi
398
    fi
396
    echo
399
    echo
397
fi
400
fi
398
 
401
 
399
 
402
 
400
if [ $MOUNTED = "0" ]; then
403
if [ $MOUNTED = "0" ]; then
401
    ### format $INSTALL_PART
404
    ### format $INSTALL_PART
402
    ### -----------------------------------------------------------
405
    ### -----------------------------------------------------------
403
 
406
 
404
    # define force option for mkfs command
407
    # define force option for mkfs command
405
    FORCE=""
408
    FORCE=""
406
    [ "$FS_TYPE" = "xfs" ] && FORCE="-f"
409
    [ "$FS_TYPE" = "xfs" ] && FORCE="-f"
407
    
410
    
408
    echo -n "Format $INSTALL_PART as $FS_TYPE, please wait ... " 
411
    echo -n "Format $INSTALL_PART as $FS_TYPE, please wait ... " 
409
    mkfs.$FS_TYPE $FORCE -q $INSTALL_PART || exit_now 1
412
    mkfs.$FS_TYPE $FORCE -q $INSTALL_PART || exit_now 1
410
    echo "done."; echo
413
    echo "done."; echo
411
 
414
 
412
    ### mount $INSTALL_PART
415
    ### mount $INSTALL_PART
413
    ### -----------------------------------------------------------
416
    ### -----------------------------------------------------------
414
    echo -n "Try to mount $INSTALL_PART to $NEW ... "
417
    echo -n "Try to mount $INSTALL_PART to $NEW ... "
415
    mkdir -p $NEW
418
    mkdir -p $NEW
416
    mount $INSTALL_PART $NEW || exit_now 1
419
    mount $INSTALL_PART $NEW || exit_now 1
417
    echo "done."; echo
420
    echo "done."; echo
418
fi
421
fi
419
 
422
 
420
 
423
 
421
### copy root dirs
424
### copy root dirs
422
### -----------------------------------------------------------
425
### -----------------------------------------------------------
423
echo "Copy Live System to $INSTALL_PART ..."
426
echo "Copy Live System to $INSTALL_PART ..."
424
root_dirs=$( ls / )
427
root_dirs=$( ls / )
425
for dir in $root_dirs; do
428
for dir in $root_dirs; do
426
    # check if dir is not in $DIR_NOT_COPY
429
    # check if dir is not in $DIR_NOT_COPY
427
    do_not_copy=""
430
    do_not_copy=""
428
    for not_dir in $DIR_NOT_COPY; do
431
    for not_dir in $DIR_NOT_COPY; do
429
        if [ "$not_dir" = "/$dir" ]; then 
432
        if [ "$not_dir" = "/$dir" ]; then 
430
            do_not_copy="yes"
433
            do_not_copy="yes"
431
            break
434
            break
432
        fi
435
        fi
433
    done
436
    done
434
    # do not copy links
437
    # do not copy links
435
    [ -L /$dir ] && do_not_copy="yes"
438
    [ -L /$dir ] && do_not_copy="yes"
436
 
439
 
437
    fail=""
440
    fail=""
438
    if [ ! $do_not_copy ]; then
441
    if [ ! $do_not_copy ]; then
439
        echo -n "  * Copy  /$dir ... "
442
        echo -n "  * Copy  /$dir ... "
440
	# first delete $dir on hardisk
443
	# first delete $dir on hardisk
441
	rm -rf $NEW/$dir
444
	rm -rf $NEW/$dir
442
        cp -a -f /$dir $NEW || fail=true
445
        cp -a -f /$dir $NEW || fail=true
443
        echo "done."
446
        echo "done."
444
    fi
447
    fi
445
    fail=""
448
    fail=""
446
done
449
done
447
echo
450
echo
448
if [ $fail ]; then
451
if [ $fail ]; then
449
    echo "ERROR: Not everything was copied to $INSTALL_PART"
452
    echo "ERROR: Not everything was copied to $INSTALL_PART"
450
    exit_now 1
453
    exit_now 1
451
fi
454
fi
452
 
455
 
453
 
456
 
454
### move /usr/opt back to /opt
457
### move /usr/opt back to /opt
455
### -----------------------------------------------------------
458
### -----------------------------------------------------------
456
if [ -d $NEW/usr/opt ]; then
459
if [ -d $NEW/usr/opt ]; then
457
    echo -n "Move /opt back ... "
460
    echo -n "Move /opt back ... "
458
    mv $NEW/usr/opt $NEW/
461
    mv $NEW/usr/opt $NEW/
459
    echo "done."; echo
462
    echo "done."; echo
460
fi
463
fi
461
 
464
 
462
 
465
 
463
### create dirs which were not copied
466
### create dirs which were not copied
464
### -----------------------------------------------------------
467
### -----------------------------------------------------------
465
for dir in $DIR_NOT_COPY; do
468
for dir in $DIR_NOT_COPY; do
466
   if [ ! -d $NEW$dir ]; then
469
   if [ ! -d $NEW$dir ]; then
467
       mkdir $NEW$dir
470
       mkdir $NEW$dir
468
   fi
471
   fi
469
done
472
done
470
# we do not need this directory
473
# we do not need this directory
471
rmdir $NEW/livecd
474
rmdir $NEW/livecd
472
# if not yet existing, create
475
# if not yet existing, create
473
mkdir -p $NEW/srv
476
mkdir -p $NEW/srv
474
mkdir -p $NEW/selinux
477
mkdir -p $NEW/selinux
475
 
478
 
476
 
479
 
477
### copy back original files
480
### copy back original files
478
### -----------------------------------------------------------
481
### -----------------------------------------------------------
479
echo -n "Restore original files ... " 
482
echo -n "Restore original files ... " 
480
for file in $FILES_RESTORE; do
483
for file in $FILES_RESTORE; do
481
    [ -r $NEW${file}.ori ] && mv -f $NEW${file}.ori $NEW${file} 
484
    [ -r $NEW${file}.ori ] && mv -f $NEW${file}.ori $NEW${file} 
482
done
485
done
483
echo "done."; echo
486
echo "done."; echo
484
 
487
 
485
 
488
 
486
### define kernel version
489
### define kernel version
487
### -----------------------------------------------------------
490
### -----------------------------------------------------------
488
rpm --quiet -q kernel     && UP_installed=true
491
rpm --quiet -q kernel     && UP_installed=true
489
rpm --quiet -q kernel-smp && SMP_installed=true
492
rpm --quiet -q kernel-smp && SMP_installed=true
490
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
493
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
491
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
494
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
492
if [ ! $KERNEL_VERSION ]; then
495
if [ ! $KERNEL_VERSION ]; then
493
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
496
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
494
    exit_now 1
497
    exit_now 1
495
fi    
498
fi    
496
 
499
 
497
 
500
 
498
 
501
 
499
if [ ! $NOGRUB ]; then
502
if [ ! $NOGRUB ]; then
500
 
503
 
501
    ### Backup Master Boot Record MBR
504
    ### Backup Master Boot Record MBR
502
    ### -----------------------------------------------------------
505
    ### -----------------------------------------------------------
503
    # do we have already a backup?
506
    # do we have already a backup?
504
    MBR_FILENAME="MBR$( echo $MBR_DEV | tr / _ ).bak"
507
    MBR_FILENAME="MBR$( echo $MBR_DEV | tr / _ ).bak"
505
    if [ ! -e /tmp/$MBR_FILENAME ]; then
508
    if [ ! -e /tmp/$MBR_FILENAME ]; then
506
        echo "Backup Master Boot Record (MBR) of $MBR_DEV ..."
509
        echo "Backup Master Boot Record (MBR) of $MBR_DEV ..."
507
        dd if=$MBR_DEV of=/tmp/$MBR_FILENAME bs=512 count=1
510
        dd if=$MBR_DEV of=/tmp/$MBR_FILENAME bs=512 count=1
508
    fi
511
    fi
509
    cp -a /tmp/$MBR_FILENAME $NEW/$MBR_FILENAME
512
    cp -a /tmp/$MBR_FILENAME $NEW/$MBR_FILENAME
510
    echo "MBR saved as $MBR_FILENAME on $INSTALL_PART and on /tmp"
513
    echo "MBR saved as $MBR_FILENAME on $INSTALL_PART and on /tmp"
511
    echo
514
    echo
512
 
515
 
513
 
516
 
514
    ### install grub
517
    ### install grub
515
    ### -----------------------------------------------------------
518
    ### -----------------------------------------------------------
516
    echo "Run grub-install ... "
519
    echo "Run grub-install ... "
517
    mkdir -p $NEW/boot/grub
520
    mkdir -p $NEW/boot/grub
518
    [ ! $FLOPPY ] && NO_FLOPPY_OPT="--no-floppy"
521
    [ ! $FLOPPY ] && NO_FLOPPY_OPT="--no-floppy"
519
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV 2>/dev/null || GRUB_FAILED="yes"
522
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV 2>/dev/null || GRUB_FAILED="yes"
520
 
523
 
521
    if [ $GRUB_FAILED ]; then
524
    if [ $GRUB_FAILED ]; then
522
	echo "grub installation failed. grub-install will run again at the end."
525
	echo "grub installation failed. grub-install will run again at the end."
523
    else
526
    else
524
	echo "done."
527
	echo "done."
525
    fi
528
    fi
526
    echo
529
    echo
527
 
530
 
528
    ### check for device.map file 
531
    ### check for device.map file 
529
    ### -----------------------------------------------------------
532
    ### -----------------------------------------------------------
530
    DEVICE_MAP=$NEW/boot/grub/device.map
533
    DEVICE_MAP=$NEW/boot/grub/device.map
531
    if [ ! -e $NEW/boot/grub/device.map ]; then
534
    if [ ! -e $NEW/boot/grub/device.map ]; then
532
        echo "ERROR: $NEW/boot/grub/device.map not found"
535
        echo "ERROR: $NEW/boot/grub/device.map not found"
533
        exit_now 1
536
        exit_now 1
534
    fi
537
    fi
535
 
538
 
536
 
539
 
537
    ### convert dev syntax to grub syntax
540
    ### convert dev syntax to grub syntax
538
    ### -----------------------------------------------------------
541
    ### -----------------------------------------------------------
539
    GRUB_INSTALL_DEV=$( grep $BOOT_DRIVE $DEVICE_MAP | awk '{ print $1 }' )
542
    GRUB_INSTALL_DEV=$( grep $BOOT_DRIVE $DEVICE_MAP | awk '{ print $1 }' )
540
    GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
543
    GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
541
 
544
 
542
 
545
 
543
    ### find active Windows partition
546
    ### find active Windows partition
544
    ### -----------------------------------------------------------
547
    ### -----------------------------------------------------------
545
    if [ ! $WIN_PART ]; then
548
    if [ ! $WIN_PART ]; then
546
        # try to find active Windows partition
549
        # try to find active Windows partition
547
        WIN_PART=$( fdisk -l 2>/dev/null | awk '{ if ($2 == "*" && $7 ~ "NTFS") print $1 }' | head -1 )
550
        WIN_PART=$( fdisk -l 2>/dev/null | awk '{ if ($2 == "*" && $7 ~ "NTFS") print $1 }' | head -1 )
548
    fi
551
    fi
549
 
552
 
550
    if [ $WIN_PART ]; then
553
    if [ $WIN_PART ]; then
551
        WIN_installed=true
554
        WIN_installed=true
552
        WIN_DISK=$( echo "$WIN_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
555
        WIN_DISK=$( echo "$WIN_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
553
        WIN_PART_NR=$( echo "$WIN_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
556
        WIN_PART_NR=$( echo "$WIN_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
554
        # convert dev syntax to grub syntax
557
        # convert dev syntax to grub syntax
555
        GRUB_WIN_DEV=$( grep $WIN_DISK $DEVICE_MAP | awk '{ print $1 }' )
558
        GRUB_WIN_DEV=$( grep $WIN_DISK $DEVICE_MAP | awk '{ print $1 }' )
556
        GRUB_WIN_PART=$( echo "$GRUB_WIN_DEV" | sed "s%)$%,`expr $WIN_PART_NR - 1`)%" )
559
        GRUB_WIN_PART=$( echo "$GRUB_WIN_DEV" | sed "s%)$%,`expr $WIN_PART_NR - 1`)%" )
557
 
560
 
558
        # $GRUB_WIN_PART should be something like (hd0,0)
561
        # $GRUB_WIN_PART should be something like (hd0,0)
559
        echo "Found active Windows partition ( $WIN_PART = $GRUB_WIN_PART )" 
562
        echo "Found active Windows partition ( $WIN_PART = $GRUB_WIN_PART )" 
560
        echo "Will add entry for Windows in GRUB."
563
        echo "Will add entry for Windows in GRUB."
561
        echo
564
        echo
562
    fi
565
    fi
563
 
566
 
564
 
567
 
565
    ### create grub.conf file
568
    ### create grub.conf file
566
    ### -----------------------------------------------------------
569
    ### -----------------------------------------------------------
567
    echo "Create grub.conf ..."
570
    echo "Create grub.conf ..."
568
 
571
 
569
    TITLE="Linux"
572
    TITLE="Linux"
570
    [ -e $NEW/etc/redhat-release ] && TITLE=$( cat $NEW/etc/redhat-release )
573
    [ -e $NEW/etc/redhat-release ] && TITLE=$( cat $NEW/etc/redhat-release )
571
 
574
 
572
    DEFAULT=0
575
    DEFAULT=0
573
    # set default=1, if smp kernel is running
576
    # set default=1, if smp kernel is running
574
    uname -r | grep -q smp
577
    uname -r | grep -q smp
575
    [ "$?" = "0" ] && DEFAULT=1
578
    [ "$?" = "0" ] && DEFAULT=1
576
 
579
 
577
    cat > $NEW/boot/grub/grub.conf <<EOF
580
    cat > $NEW/boot/grub/grub.conf <<EOF
578
# grub.conf generated by $SCRIPTNAME
581
# grub.conf generated by $SCRIPTNAME
579
default=$DEFAULT
582
default=$DEFAULT
580
timeout=10
583
timeout=10
581
splashimage=${GRUB_ROOT_PART}${INSTALL_BOOT_DIR}/grub/splash.xpm.gz
584
splashimage=${GRUB_ROOT_PART}${INSTALL_BOOT_DIR}/grub/splash.xpm.gz
582
#hiddenmenu
585
#hiddenmenu
583
EOF
586
EOF
584
 
587
 
585
    if [ $UP_installed ]; then
588
    if [ $UP_installed ]; then
586
        echo "Add entry for UP kernel into grub.conf"
589
        echo "Add entry for UP kernel into grub.conf"
587
        cat >> $NEW/boot/grub/grub.conf <<EOF
590
        cat >> $NEW/boot/grub/grub.conf <<EOF
588
title $TITLE (${KERNEL_VERSION})
591
title $TITLE (${KERNEL_VERSION})
589
        root $GRUB_ROOT_PART
592
        root $GRUB_ROOT_PART
590
        kernel ${INSTALL_BOOT_DIR}/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
593
        kernel ${INSTALL_BOOT_DIR}/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
591
        initrd ${INSTALL_BOOT_DIR}/initrd-$KERNEL_VERSION.img
594
        initrd ${INSTALL_BOOT_DIR}/initrd-$KERNEL_VERSION.img
592
EOF
595
EOF
593
    fi
596
    fi
594
 
597
 
595
    if [ $SMP_installed ]; then
598
    if [ $SMP_installed ]; then
596
        echo "Add entry for SMP kernel into grub.conf"
599
        echo "Add entry for SMP kernel into grub.conf"
597
        cat >> $NEW/boot/grub/grub.conf <<EOF
600
        cat >> $NEW/boot/grub/grub.conf <<EOF
598
title $TITLE (${KERNEL_VERSION}smp)
601
title $TITLE (${KERNEL_VERSION}smp)
599
        root $GRUB_ROOT_PART
602
        root $GRUB_ROOT_PART
600
        kernel ${INSTALL_BOOT_DIR}/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
603
        kernel ${INSTALL_BOOT_DIR}/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
601
        initrd ${INSTALL_BOOT_DIR}/initrd-${KERNEL_VERSION}smp.img
604
        initrd ${INSTALL_BOOT_DIR}/initrd-${KERNEL_VERSION}smp.img
602
EOF
605
EOF
603
    fi
606
    fi
604
 
607
 
605
    if [ $WIN_installed ]; then
608
    if [ $WIN_installed ]; then
606
        echo "Add entry for Windows into grub.conf"
609
        echo "Add entry for Windows into grub.conf"
607
        cat >> $NEW/boot/grub/grub.conf <<EOF
610
        cat >> $NEW/boot/grub/grub.conf <<EOF
608
title Windows
611
title Windows
609
        rootnoverify $GRUB_WIN_PART
612
        rootnoverify $GRUB_WIN_PART
610
        chainloader +1
613
        chainloader +1
611
EOF
614
EOF
612
    fi
615
    fi
613
 
616
 
614
    chmod 600 $NEW/boot/grub/grub.conf
617
    chmod 600 $NEW/boot/grub/grub.conf
615
    ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
618
    ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
616
    ln -s ./grub.conf $NEW/boot/grub/menu.lst
619
    ln -s ./grub.conf $NEW/boot/grub/menu.lst
617
    echo "done."; echo
620
    echo "done."; echo
618
 
621
 
619
 
622
 
620
    ### create /etc/sysconfig/grub file
623
    ### create /etc/sysconfig/grub file
621
    ### -----------------------------------------------------------
624
    ### -----------------------------------------------------------
622
    cat > $NEW/etc/sysconfig/grub <<EOF    
625
    cat > $NEW/etc/sysconfig/grub <<EOF    
623
boot=$INSTALL_DEV
626
boot=$INSTALL_DEV
624
forcelba=0
627
forcelba=0
625
EOF
628
EOF
626
 
629
 
627
 
630
 
628
fi
631
fi
629
 
632
 
630
 
633
 
631
### install kernel and other files into /boot
634
### install kernel and other files into /boot
632
### -----------------------------------------------------------
635
### -----------------------------------------------------------
633
echo "Install kernel(s) ..."
636
echo "Install kernel(s) ..."
634
 
637
 
635
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
638
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
636
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
639
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
637
 
640
 
638
if [ ! $BOOT_DIR ]; then
641
if [ ! $BOOT_DIR ]; then
639
    echo "ERROR: No kernel found - installation failed"; echo
642
    echo "ERROR: No kernel found - installation failed"; echo
640
    exit_now 1
643
    exit_now 1
641
fi
644
fi
642
 
645
 
643
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
646
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
644
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
647
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
645
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
648
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
646
cp -a $BOOT_DIR/config-*           $NEW/boot/
649
cp -a $BOOT_DIR/config-*           $NEW/boot/
647
cp -a $BOOT_DIR/symvers-*.gz       $NEW/boot/        2>/dev/null
650
cp -a $BOOT_DIR/symvers-*.gz       $NEW/boot/        2>/dev/null
648
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/   2>/dev/null
651
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/   2>/dev/null
649
cp -a $BOOT_DIR/message.ja         $NEW/boot/        2>/dev/null
652
cp -a $BOOT_DIR/message.ja         $NEW/boot/        2>/dev/null
650
cp -a $BOOT_DIR/message            $NEW/boot/        2>/dev/null
653
cp -a $BOOT_DIR/message            $NEW/boot/        2>/dev/null
651
 
654
 
652
echo "done."; echo
655
echo "done."; echo
653
 
656
 
654
 
657
 
655
### create /etc/sysconfig/kernel file
658
### create /etc/sysconfig/kernel file
656
### -----------------------------------------------------------
659
### -----------------------------------------------------------
657
cat > $NEW/etc/sysconfig/kernel <<EOF    
660
cat > $NEW/etc/sysconfig/kernel <<EOF    
658
# UPDATEDEFAULT specifies if new-kernel-pkg should make
661
# UPDATEDEFAULT specifies if new-kernel-pkg should make
659
# new kernels the default
662
# new kernels the default
660
UPDATEDEFAULT=yes
663
UPDATEDEFAULT=yes
661
 
664
 
662
# DEFAULTKERNEL specifies the default kernel package type
665
# DEFAULTKERNEL specifies the default kernel package type
663
DEFAULTKERNEL=kernel
666
DEFAULTKERNEL=kernel
664
EOF
667
EOF
665
 
668
 
666
 
669
 
667
### create /etc/fstab
670
### create /etc/fstab
668
### -----------------------------------------------------------
671
### -----------------------------------------------------------
669
cat > $NEW/etc/fstab <<EOF
672
cat > $NEW/etc/fstab <<EOF
670
$INSTALL_PART	/		$FS_TYPE		defaults	1 1
673
$INSTALL_PART	/		$FS_TYPE		defaults	1 1
671
EOF
674
EOF
672
 
675
 
673
if [ -z "$INSTALL_BOOT_DIR" ]; then
676
if [ -z "$INSTALL_BOOT_DIR" ]; then
674
   echo "$INSTALL_DEV	/boot		$FS_TYPE		defaults	1 2" >> $NEW/etc/fstab
677
   echo "$INSTALL_DEV	/boot		$FS_TYPE		defaults	1 2" >> $NEW/etc/fstab
675
fi
678
fi
676
 
679
 
677
cat >> $NEW/etc/fstab <<EOF
680
cat >> $NEW/etc/fstab <<EOF
678
devpts          /dev/pts        devpts          gid=5,mode=620  0 0
681
devpts          /dev/pts        devpts          gid=5,mode=620  0 0
679
tmpfs	        /dev/shm        tmpfs           defaults        0 0
682
tmpfs	        /dev/shm        tmpfs           defaults        0 0
680
proc	        /proc           proc            defaults        0 0
683
proc	        /proc           proc            defaults        0 0
681
sysfs		/sys            sysfs           defaults        0 0
684
sysfs		/sys            sysfs           defaults        0 0
682
EOF
685
EOF
683
 
686
 
684
if [ "$SWAP_PART" ]; then
687
if [ "$SWAP_PART" ]; then
685
    for SWAP_PARTITION in $SWAP_PART ; do
688
    for SWAP_PARTITION in $SWAP_PART ; do
686
        echo "$SWAP_PARTITION	swap		swap		defaults,pri=1	0 0" >> $NEW/etc/fstab
689
        echo "$SWAP_PARTITION	swap		swap		defaults,pri=1	0 0" >> $NEW/etc/fstab
687
    done
690
    done
688
fi
691
fi
689
 
692
 
690
 
693
 
691
### make initrd 
694
### make initrd 
692
### (needs $NEW/etc/fstab to find correct modules for root filesystem !!)
695
### (needs $NEW/etc/fstab to find correct modules for root filesystem !!)
693
### -----------------------------------------------------------
696
### -----------------------------------------------------------
694
echo "Create initrd(s) ..."
697
echo "Create initrd(s) ..."
695
# initrd should not be build on tmpfs (we take $NEW/tmp instead of /tmp)
698
# initrd should not be build on tmpfs (we take $NEW/tmp instead of /tmp)
696
sed -i "s|^TMPDIR=.*|TMPDIR=\"$NEW/tmp\"|" /usr/sbin/livecd-mkinitrd
699
sed -i "s|^TMPDIR=.*|TMPDIR=\"$NEW/tmp\"|" /usr/sbin/livecd-mkinitrd
697
 
700
 
698
if [ $UP_installed ]; then
701
if [ $UP_installed ]; then
699
    depmod -a ${KERNEL_VERSION}
702
    depmod -a ${KERNEL_VERSION}
700
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
703
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
701
                    $NEW/boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
704
                    $NEW/boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
702
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
705
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
703
        echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
706
        echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
704
        exit_now 1
707
        exit_now 1
705
    fi
708
    fi
706
fi
709
fi
707
if [ $SMP_installed ]; then
710
if [ $SMP_installed ]; then
708
    depmod -a ${KERNEL_VERSION}smp
711
    depmod -a ${KERNEL_VERSION}smp
709
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
712
    /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
710
                    $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
713
                    $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
711
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
714
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
712
        echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
715
        echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
713
        exit_now 1
716
        exit_now 1
714
    fi
717
    fi
715
fi
718
fi
716
echo "done."; echo
719
echo "done."; echo
717
 
720
 
718
 
721
 
719
### remove LiveCD init.d scripts
722
### remove LiveCD init.d scripts
720
### -----------------------------------------------------------
723
### -----------------------------------------------------------
721
for file in $LIVECD_INIT_SCRIPTS; do
724
for file in $LIVECD_INIT_SCRIPTS; do
722
    rm -f $NEW/etc/rc.d/init.d/$file
725
    rm -f $NEW/etc/rc.d/init.d/$file
723
    for n in 0 1 2 3 4 5 6; do
726
    for n in 0 1 2 3 4 5 6; do
724
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
727
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
725
    done
728
    done
726
done
729
done
727
 
730
 
728
 
731
 
729
### restore cronjobs
732
### restore cronjobs
730
### -----------------------------------------------------------
733
### -----------------------------------------------------------
731
mv $NEW/etc/cron_backup/sysstat       $NEW/etc/cron.d/ 2>/dev/null
734
mv $NEW/etc/cron_backup/sysstat       $NEW/etc/cron.d/ 2>/dev/null
732
mv $NEW/etc/cron_backup/cfengine      $NEW/etc/cron.d/ 2>/dev/null
735
mv $NEW/etc/cron_backup/cfengine      $NEW/etc/cron.d/ 2>/dev/null
733
mv $NEW/etc/cron_backup/psi-cronjobs  $NEW/etc/cron.d/ 2>/dev/null
736
mv $NEW/etc/cron_backup/psi-cronjobs  $NEW/etc/cron.d/ 2>/dev/null
734
mv $NEW/etc/cron_backup/00-makewhatis.cron.weekly $NEW/etc/cron.weekly/00-makewhatis.cron 2>/dev/null
737
mv $NEW/etc/cron_backup/00-makewhatis.cron.weekly $NEW/etc/cron.weekly/00-makewhatis.cron 2>/dev/null
735
mv $NEW/etc/cron_backup/*             $NEW/etc/cron.daily/ 2>/dev/null
738
mv $NEW/etc/cron_backup/*             $NEW/etc/cron.daily/ 2>/dev/null
736
 
739
 
737
 
740
 
738
### prepare chroot to $NEW
741
### prepare chroot to $NEW
739
### -----------------------------------------------------------
742
### -----------------------------------------------------------
740
mount --bind /dev $NEW/dev
743
mount --bind /dev $NEW/dev
741
mount --bind /sys $NEW/sys
744
mount --bind /sys $NEW/sys
742
mount -t proc proc $NEW/proc
745
mount -t proc proc $NEW/proc
743
 
746
 
744
 
747
 
745
### turn on kudzu again
748
### turn on kudzu again
746
### -----------------------------------------------------------
749
### -----------------------------------------------------------
747
chroot $NEW chkconfig kudzu on
750
chroot $NEW chkconfig kudzu on
748
 
751
 
749
 
752
 
750
### turn on check_update again (only at PSI)
753
### turn on check_update again (only at PSI)
751
### -----------------------------------------------------------
754
### -----------------------------------------------------------
752
chroot $NEW chkconfig check_update on 2>/dev/null
755
chroot $NEW chkconfig check_update on 2>/dev/null
753
 
756
 
754
 
757
 
755
### fix some services which were disabled 
758
### fix some services which were disabled 
756
### because of diskless NFS client
759
### because of diskless NFS client
757
### -----------------------------------------------------------
760
### -----------------------------------------------------------
758
if [ -e /$MOUNTDIR/service.on ]; then
761
if [ -e /$MOUNTDIR/service.on ]; then
759
    cat /$MOUNTDIR/service.on | while read $serv; do
762
    cat /$MOUNTDIR/service.on | while read $serv; do
760
        chroot $NEW chkconfig $serv on
763
        chroot $NEW chkconfig $serv on
761
    done
764
    done
762
fi
765
fi
763
 
766
 
764
 
767
 
765
### remove some files
768
### remove some files
766
### -----------------------------------------------------------
769
### -----------------------------------------------------------
767
rm -rf $NEW/usr/share/applications/livecd-install-gui.desktop
770
rm -rf $NEW/usr/share/applications/livecd-install-gui.desktop
768
rm -rf $NEW/usr/share/applications/save-localdata.desktop
771
rm -rf $NEW/usr/share/applications/save-localdata.desktop
769
 
772
 
770
 
773
 
771
### remove RPMs that can break future updates  
774
### remove RPMs that can break future updates  
772
### -----------------------------------------------------------
775
### -----------------------------------------------------------
773
if [ ! $NORPMREMOVE ]; then
776
if [ ! $NORPMREMOVE ]; then
774
    echo "Remove RPMs that may break future updates ..."
777
    echo "Remove RPMs that may break future updates ..."
775
    chroot $NEW rpm -qa 2>/dev/null > /tmp/rpmlist
778
    chroot $NEW rpm -qa 2>/dev/null > /tmp/rpmlist
776
 
779
 
777
    # Scientific Linux RPMs
780
    # Scientific Linux RPMs
778
    RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_SL"
781
    RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_SL"
779
 
782
 
780
    # PSI Scientific Linux RPMs
783
    # PSI Scientific Linux RPMs
781
    if [ -e /etc/sysconfig/psi ]; then
784
    if [ -e /etc/sysconfig/psi ]; then
782
        RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_PSI"
785
        RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_PSI"
783
    fi
786
    fi
784
 
787
 
785
    for rpm in $RPMSTOREMOVE; do
788
    for rpm in $RPMSTOREMOVE; do
786
        rpms_remove=$( cat /tmp/rpmlist | grep "^$rpm" )
789
        rpms_remove=$( cat /tmp/rpmlist | grep "^$rpm" )
787
        for rpm_remove in $rpms_remove; do        
790
        for rpm_remove in $rpms_remove; do        
788
            chroot $NEW rpm -e --nodeps $rpm_remove >/dev/null 2>&1
791
            chroot $NEW rpm -e --nodeps $rpm_remove >/dev/null 2>&1
789
            [ "$?" = "0" ] && echo " removing $rpm_remove"
792
            [ "$?" = "0" ] && echo " removing $rpm_remove"
790
        done
793
        done
791
    done
794
    done
792
    echo "done."; echo
795
    echo "done."; echo
793
fi
796
fi
794
 
797
 
795
 
798
 
796
### disable nvidia driver 
799
### disable nvidia driver 
797
### -----------------------------------------------------------
800
### -----------------------------------------------------------
798
# not in case of a PSI installation
801
# not in case of a PSI installation
799
if [ ! -e /etc/sysconfig/psi ]; then
802
if [ ! -e /etc/sysconfig/psi ]; then
800
    if [ -e $NEW/etc/X11/xorg.conf.nv_SAVED ]; then
803
    if [ -e $NEW/etc/X11/xorg.conf.nv_SAVED ]; then
801
        echo "Remove nvidia driver and correct xorg.conf ..."
804
        echo "Remove nvidia driver and correct xorg.conf ..."
802
        # correct xorg.conf
805
        # correct xorg.conf
803
        sed -i "s/#nv_SAVED //" $NEW/etc/X11/xorg.conf
806
        sed -i "s/#nv_SAVED //" $NEW/etc/X11/xorg.conf
804
        sed -i "/.*Driver.*nvidia.*/d" $NEW/etc/X11/xorg.conf
807
        sed -i "/.*Driver.*nvidia.*/d" $NEW/etc/X11/xorg.conf
805
        # disable nvidia libs (if not yet done by rpm -e)
808
        # disable nvidia libs (if not yet done by rpm -e)
806
        LIB=lib
809
        LIB=lib
807
        [ $( arch ) = "x86_64" ] && LIB=lib64
810
        [ $( arch ) = "x86_64" ] && LIB=lib64
808
        mv -f $NEW/usr/X11R6/$LIB/modules/extensions/xxx.libGLcore.a.saved_by_nvidia \
811
        mv -f $NEW/usr/X11R6/$LIB/modules/extensions/xxx.libGLcore.a.saved_by_nvidia \
809
              $NEW/usr/X11R6/$LIB/modules/extensions/libGLcore.a 2>/dev/null
812
              $NEW/usr/X11R6/$LIB/modules/extensions/libGLcore.a 2>/dev/null
810
        mv -f $NEW/usr/X11R6/$LIB/modules/extensions/xxx.libglx.a.saved_by_nvidia \
813
        mv -f $NEW/usr/X11R6/$LIB/modules/extensions/xxx.libglx.a.saved_by_nvidia \
811
              $NEW/usr/X11R6/$LIB/modules/extensions/libglx.a 2>/dev/null
814
              $NEW/usr/X11R6/$LIB/modules/extensions/libglx.a 2>/dev/null
812
        rm -f $NEW/usr/X11R6/$LIB/modules/extensions/libglx.so
815
        rm -f $NEW/usr/X11R6/$LIB/modules/extensions/libglx.so
813
        rm -f $NEW/usr/X11R6/$LIB/libGL.so*
816
        rm -f $NEW/usr/X11R6/$LIB/libGL.so*
814
        rm -f $NEW/usr/$LIB/libGLcore.so
817
        rm -f $NEW/usr/$LIB/libGLcore.so
815
        echo "done."; echo
818
        echo "done."; echo
816
    fi
819
    fi
817
fi
820
fi
818
 
821
 
819
 
822
 
820
### umount /dev /sys /proc from chroot
823
### umount /dev /sys /proc from chroot
821
### -----------------------------------------------------------
824
### -----------------------------------------------------------
822
umount $NEW/dev
825
umount $NEW/dev
823
umount $NEW/sys
826
umount $NEW/sys
824
umount $NEW/proc
827
umount $NEW/proc
825
 
828
 
826
 
829
 
827
### install grub for the 2. time, if it failed before 
830
### install grub for the 2. time, if it failed before 
828
### (happens on xfs filesystem), to be sure run it twice.
831
### (happens on xfs filesystem), to be sure run it twice.
829
### -----------------------------------------------------------
832
### -----------------------------------------------------------
830
if [ ! $NOGRUB ] && [ $GRUB_FAILED ]; then
833
if [ ! $NOGRUB ] && [ $GRUB_FAILED ]; then
831
 
834
 
832
    echo "Run grub-install once more ... "
835
    echo "Run grub-install once more ... "
833
 
836
 
834
    [ ! $FLOPPY ] && NO_FLOPPY_OPT="--no-floppy"
837
    [ ! $FLOPPY ] && NO_FLOPPY_OPT="--no-floppy"
835
 
838
 
836
    # 1. run grub-install, before re-mount partition (quite)
839
    # 1. run grub-install, before re-mount partition (quite)
837
    [ $MOUNTED = "0" ] && umount $NEW && mount $INSTALL_PART $NEW
840
    [ $MOUNTED = "0" ] && umount $NEW && mount $INSTALL_PART $NEW
838
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV >/dev/null 2>&1
841
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV >/dev/null 2>&1
839
 
842
 
840
    # 2. run grub-install, before re-mount partition (verbose)
843
    # 2. run grub-install, before re-mount partition (verbose)
841
    [ $MOUNTED = "0" ] && umount $NEW && mount $INSTALL_PART $NEW
844
    [ $MOUNTED = "0" ] && umount $NEW && mount $INSTALL_PART $NEW
842
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV
845
    grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV
843
 
846
 
844
    if [ "$?" != "0" ]; then
847
    if [ "$?" != "0" ]; then
845
	echo "grub-install failed again."
848
	echo "grub-install failed again."
846
	echo "You can try to run grub-install manually as root with:"
849
	echo "You can try to run grub-install manually as root with:"
847
	echo
850
	echo
848
	echo " mount $INSTALL_PART $NEW"
851
	echo " mount $INSTALL_PART $NEW"
849
	echo " grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV"
852
	echo " grub-install $NO_FLOPPY_OPT --root-directory=$NEW $MBR_DEV"
850
	echo
853
	echo
851
	exit_now 1
854
	exit_now 1
852
    fi
855
    fi
853
 
856
 
854
    echo "done."; echo
857
    echo "done."; echo
855
 
858
 
856
fi
859
fi
857
 
860
 
858
 
861
 
859
### umount $INSTALL_PART
862
### umount $INSTALL_PART
860
### -----------------------------------------------------------
863
### -----------------------------------------------------------
861
UMOUNT_LIST=`df -l | grep "$NEW" | sed -e 's/  */ /g' | cut -d" " -f6 | sort -r`
864
UMOUNT_LIST=`df -l | grep "$NEW" | sed -e 's/  */ /g' | cut -d" " -f6 | sort -r`
862
umount $UMOUNT_LIST
865
umount $UMOUNT_LIST
863
 
866
 
864
 
867
 
865
### print summary
868
### print summary
866
### -----------------------------------------------------------
869
### -----------------------------------------------------------
867
echo                     "--------------------------------------------------------------"
870
echo                     "--------------------------------------------------------------"
868
echo                     "  LiveCD installed on partition $INSTALL_PART"
871
echo                     "  LiveCD installed on partition $INSTALL_PART"
869
[ "$SWAP_PART" ] && echo "  Partition(s) $SWAP_PART will be used as swap partition(s)"
872
[ "$SWAP_PART" ] && echo "  Partition(s) $SWAP_PART will be used as swap partition(s)"
870
echo
873
echo
871
[ ! $NOGRUB ]    && echo "  GRUB installed in Master Boot Record (MBR) of $MBR_DEV"
874
[ ! $NOGRUB ]    && echo "  GRUB installed in Master Boot Record (MBR) of $MBR_DEV"
872
[ ! $NOGRUB ]    && echo "  MBR saved as $MBR_FILENAME on $INSTALL_PART and in /tmp"
875
[ ! $NOGRUB ]    && echo "  MBR saved as $MBR_FILENAME on $INSTALL_PART and in /tmp"
873
[ ! $NOGRUB ]    && echo "  If you have to restore MBR, execute under Linux:"
876
[ ! $NOGRUB ]    && echo "  If you have to restore MBR, execute under Linux:"
874
[ ! $NOGRUB ]    && echo "  # dd if=$MBR_FILENAME of=$MBR_DEV bs=512 count=1"
877
[ ! $NOGRUB ]    && echo "  # dd if=$MBR_FILENAME of=$MBR_DEV bs=512 count=1"
875
echo 
878
echo 
876
[ $WIN_PART ]    && echo "  Entry created in grub.conf for Windows partition $WIN_PART"
879
[ $WIN_PART ]    && echo "  Entry created in grub.conf for Windows partition $WIN_PART"
877
echo                     "--------------------------------------------------------------"
880
echo                     "--------------------------------------------------------------"
878
echo                     "End of $SCRIPTNAME"
881
echo                     "End of $SCRIPTNAME"
879
echo
882
echo
880
 
883
 
881
 
884
 
882
### print (warn) message when using xfs and kernel has xfs.ko not included 
885
### print (warn) message when using xfs and kernel has xfs.ko not included 
883
### 
886
### 
884
 
887
 
885
rpm -ql kernel 2>/dev/null | grep -q \/xfs.ko
888
rpm -ql kernel 2>/dev/null | grep -q \/xfs.ko
886
if [ "$?" != "0" ]; then
889
if [ "$?" != "0" ]; then
887
 
890
 
888
    if [ "$FS_TYPE" = "xfs" ]; then
891
    if [ "$FS_TYPE" = "xfs" ]; then
889
	echo "--------------------------------------------------------------"
892
	echo "--------------------------------------------------------------"
890
	echo "IMPORTANT NOTE:"
893
	echo "IMPORTANT NOTE:"
891
	echo
894
	echo
892
	echo "Formating the root file system with xfs can causes problems"
895
	echo "Formating the root file system with xfs can causes problems"
893
	echo "after a regular kernel update."
896
	echo "after a regular kernel update."
894
	echo "Please run the following command after each kernel update" 
897
	echo "Please run the following command after each kernel update" 
895
	echo "in order to correctly build the initial ram disk:"
898
	echo "in order to correctly build the initial ram disk:"
896
	echo
899
	echo
897
	echo "# new-kernel-pkg --package kernel --mkinitrd --depmod \\"
900
	echo "# new-kernel-pkg --package kernel --mkinitrd --depmod \\"
898
	echo "                 --install 2.6.18-128.1.14.el5"
901
	echo "                 --install 2.6.18-128.1.14.el5"
899
	echo
902
	echo
900
	echo "(replace 2.6.18-128.1.14.el5 with the version number of the"
903
	echo "(replace 2.6.18-128.1.14.el5 with the version number of the"
901
	echo "updated kernel)"
904
	echo "updated kernel)"
902
	echo "--------------------------------------------------------------"
905
	echo "--------------------------------------------------------------"
903
	echo
906
	echo
904
    fi
907
    fi
905
fi
908
fi