Subversion Repositories livecd

Rev

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

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