Subversion Repositories livecd

Rev

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

Rev 16 Rev 17
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
###############################################################
3
###############################################################
4
#
4
#
5
# Installes the LiveCD on local harddisk
5
# Installes the LiveCD on local harddisk
6
# 
6
# 
7
# Boot LiveCD and run this script as root
7
# Boot LiveCD and run this script as root
8
#
8
#
9
# Urs Beyerle, PSI
9
# Urs Beyerle, PSI
10
#
10
#
11
###############################################################
11
###############################################################
12
 
12
 
13
 
13
 
14
###############################################################
14
###############################################################
15
# Definitions
15
# Definitions
16
###############################################################
16
###############################################################
17
 
17
 
18
# files which should be restored from .ori files
18
# files which should be restored from .ori files
19
FILES_RESTORE="/etc/init.d/netfs \
19
FILES_RESTORE="/etc/init.d/netfs \
20
           /etc/init.d/autofs \
20
           /etc/init.d/autofs \
21
           /etc/init.d/halt \
21
           /etc/init.d/halt \
22
           /etc/init.d/network
22
           /etc/init.d/network
23
           /etc/init.d/functions \
23
           /etc/init.d/functions \
24
           /etc/rc.d/rc.sysinit \
24
           /etc/rc.d/rc.sysinit \
25
           /etc/sysconfig/afs \
25
           /etc/sysconfig/afs \
26
           /etc/motd \
26
           /etc/motd \
27
           /etc/redhat-release \
27
           /etc/redhat-release \
28
	   /etc/rc.d/rc.local \
28
	   /etc/rc.d/rc.local \
29
           /etc/rc.d/rc.sysinit"
29
           /etc/rc.d/rc.sysinit"
30
 
30
 
31
LIVECD_INIT_SCRIPTS="runfirst \
31
LIVECD_INIT_SCRIPTS="runfirst \
32
                    runveryfirst \
32
                    runveryfirst \
33
                    runlast \
33
                    runlast \
34
                    kudzu-auto"
34
                    kudzu-auto"
35
 
35
 
36
# Main directories which should be not be copied
36
# Main directories which should be not be copied
37
DIR_NOT_COPY="/proc \
37
DIR_NOT_COPY="/proc \
38
              /dev \
38
              /dev \
39
              /livecd \
39
              /livecd \
40
              /boot \
40
              /boot \
41
              /afs \
41
              /afs \
42
              /sys \
42
              /sys \
43
              /mnt \
43
              /mnt \
44
              /media"
44
              /media"
45
 
45
 
46
# Mount point of the new SL system
46
# Mount point of the new SL system
47
NEW=/mnt/harddisk
47
NEW=/mnt/harddisk
48
 
48
 
49
SCRIPTNAME=$( basename $0 )
49
SCRIPTNAME=$( basename $0 )
50
 
50
 
51
 
51
 
52
 
52
 
53
###############################################################
53
###############################################################
54
# Functions
54
# Functions
55
###############################################################
55
###############################################################
56
 
56
 
57
function usage() {
57
function usage() {
58
 
58
 
59
   ## Usage
59
   ## Usage
60
   # ----------------------------------------------------------
60
   # ----------------------------------------------------------
61
 
61
 
62
   cat <<EOF
62
   cat <<EOF
63
 
63
 
64
   $SCRIPTNAME [OPTIONS] -mbr [DEVICE] [PARTITION]
64
   $SCRIPTNAME [OPTIONS] -mbr [DEVICE] [PARTITION]
65
 
65
 
66
   Installes LiveCD on PARTITION and the boot loader grub
66
   Installes LiveCD on PARTITION and the boot loader grub
67
   into the Master Boot Record (MBR) of DEVICE.
67
   into the Master Boot Record (MBR) of DEVICE.
68
 
68
 
69
   OPTIONS:
69
   OPTIONS:
70
 
70
 
71
    -h                  print this screen
71
    -h                  print this screen
72
    -swap [partition]  	use [partition] as swap
72
    -swap [partition]  	use [partition] as swap
73
    -nogrub             do not install grub
73
    -nogrub             do not install grub
74
    -y                  answer all questions with yes
74
    -y                  answer all questions with yes
75
 
75
 
76
EOF
76
EOF
77
}
77
}
78
 
78
 
79
 
79
 
80
###############################################################
80
###############################################################
81
# Main
81
# Main
82
###############################################################
82
###############################################################
83
 
83
 
84
### are we root?
84
### are we root?
85
### -----------------------------------------------------------
85
### -----------------------------------------------------------
86
if [ "$( whoami )" != "root" ]; then
86
if [ "$( whoami )" != "root" ]; then
87
    echo "Please run this script as root."
87
    echo "Please run this script as root."
88
    # exit 1
88
    # exit 1
89
fi
89
fi
90
 
90
 
91
 
91
 
92
### read options from command-line
92
### read options from command-line
93
### -----------------------------------------------------------
93
### -----------------------------------------------------------
94
while [ $# -gt 0 ]; do
94
while [ $# -gt 0 ]; do
95
 
95
 
96
    case "$1" in
96
    case "$1" in
97
       -h)
97
       -h)
98
            usage; exit;;
98
            usage; exit;;
99
       -swap)
99
       -swap)
100
            shift; SWAP_PART=$1; shift; continue;;
100
            shift; SWAP_PART=$1; shift; continue;;
101
       -mbr)
101
       -mbr)
102
            shift; MBR_DEV=$1; shift; continue;;
102
            shift; MBR_DEV=$1; shift; continue;;
103
       -nogrub)
103
       -nogrub)
104
            NOGRUB=$1; shift; continue;;
104
            NOGRUB=$1; shift; continue;;
105
       -y)
105
       -y)
106
            YES=$1; shift; continue;;
106
            YES=$1; shift; continue;;
107
 
107
 
108
       *)
108
       *)
109
            INSTALL_PART=$1; break;;
109
            INSTALL_PART=$1; break;;
110
    esac
110
    esac
111
 
111
 
112
done
112
done
113
echo
113
echo
114
 
114
 
115
 
115
 
116
### test if MBR_DEV is given
116
### test if MBR_DEV is given
117
### -----------------------------------------------------------
117
### -----------------------------------------------------------
118
if [ ! $NOGRUB ]; then
118
if [ ! $NOGRUB ]; then
119
    if [ ! $MBR_DEV ]; then
119
    if [ ! $MBR_DEV ]; then
120
	echo "No MBR device defined - where should grub be installed?"
120
	echo "No MBR device defined - where should grub be installed?"
121
	echo "Please see '$SCRIPTNAME -h'."; echo
121
	echo "Please see '$SCRIPTNAME -h'."; echo
122
	exit 1
122
	exit 1
123
    fi
123
    fi
124
fi
124
fi
125
 
125
 
126
 
126
 
127
### test if $INSTALL_PART defined and exists
127
### test if $INSTALL_PART defined and exists
128
### -----------------------------------------------------------
128
### -----------------------------------------------------------
129
if [ ! $INSTALL_PART ]; then
129
if [ ! $INSTALL_PART ]; then
130
    echo "No partition defined for installation"
130
    echo "No partition defined for installation"
131
    echo "Please see '$SCRIPTNAME -h'."; echo
131
    echo "Please see '$SCRIPTNAME -h'."; echo
132
    exit 1
132
    exit 1
133
fi
133
fi
134
 
134
 
135
 
135
 
136
### test if $INSTALL_PART exists
136
### test if $INSTALL_PART exists
137
### -----------------------------------------------------------
137
### -----------------------------------------------------------
138
fdisk -l | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
138
fdisk -l | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
139
if [ "$?" != "0" ]; then
139
if [ "$?" != "0" ]; then
140
    echo "Partition $INSTALL_PART not found! (see 'disk -l')"; echo
140
    echo "Partition $INSTALL_PART not found! (see 'disk -l')"; echo
141
    exit 1
141
    exit 1
142
fi
142
fi
143
 
143
 
144
 
144
 
145
### set $INSTALL_DEV (eg. /dev/sda)
145
### set $INSTALL_DEV (eg. /dev/sda)
146
### -----------------------------------------------------------
146
### -----------------------------------------------------------
147
INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
147
INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
148
INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
148
INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
149
 
149
 
150
 
150
 
151
### test if $SWAP_PART exists
151
### test if $SWAP_PART exists
152
### -----------------------------------------------------------
152
### -----------------------------------------------------------
153
if [ $SWAP_PART ]; then
153
if [ $SWAP_PART ]; then
154
    fdisk -l | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
154
    fdisk -l | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
155
    if [ "$?" != "0" ]; then
155
    if [ "$?" != "0" ]; then
156
	echo "Swap partition $SWAP_PART not found! (see 'disk -l')"; echo
156
	echo "Swap partition $SWAP_PART not found! (see 'disk -l')"; echo
157
	exit 1
157
	exit 1
158
    fi
158
    fi
159
    fdisk -l | grep "Linux swap" | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
159
    fdisk -l | grep "Linux swap" | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
160
    if [ "$?" != "0" ]; then
160
    if [ "$?" != "0" ]; then
161
	echo "Partition $SWAP_PART is not a Linux swap partition! (see 'disk -l')"; echo
161
	echo "Partition $SWAP_PART is not a Linux swap partition! (see 'disk -l')"; echo
162
	exit 1
162
	exit 1
163
    fi
163
    fi
164
fi
164
fi
165
 
165
 
166
 
166
 
167
### print warning
167
### print warning
168
### -----------------------------------------------------------
168
### -----------------------------------------------------------
169
echo "-----------------------------------------------------------"
169
echo "-----------------------------------------------------------"
170
echo "   LiveCD will be installed on partition $INSTALL_PART."
170
echo "   LiveCD will be installed on partition $INSTALL_PART."
171
[ "$SWAP_PART" ] && echo " Partition $SWAP_PART will be used as swap partition."
171
[ "$SWAP_PART" ] && echo " Partition $SWAP_PART will be used as swap partition."
172
 
172
 
173
echo
173
echo
174
[ ! $NOGRUB ] && echo " !! Master Boot Record of $MBR_DEV will be overwritten !!"
174
[ ! $NOGRUB ] && echo " !! Master Boot Record of $MBR_DEV will be overwritten !!"
175
 
175
 
176
echo "     !! All data on $INSTALL_PART will be lost !!"
176
echo "     !! All data on $INSTALL_PART will be lost !!"
177
echo "-----------------------------------------------------------"
177
echo "-----------------------------------------------------------"
178
echo
178
echo
179
 
179
 
180
 
180
 
181
### continue ?
181
### continue ?
182
### -----------------------------------------------------------
182
### -----------------------------------------------------------
183
if [ ! $YES ]; then
183
if [ ! $YES ]; then
184
    echo -n "Continue (y/N)? "
184
    echo -n "Continue (y/N)? "
185
    read -n 1 key
185
    read -n 1 key
186
    echo
186
    echo
187
    [ "$key" != "y" ] && exit 0
187
    [ "$key" != "y" ] && exit 0
188
fi
188
fi
189
echo
189
echo
190
 
190
 
191
 
191
 
192
### format $INSTALL_PART
192
### format $INSTALL_PART
193
### -----------------------------------------------------------
193
### -----------------------------------------------------------
194
echo -n "Format $INSTALL_PART, please wait ... " 
194
echo -n "Format $INSTALL_PART, please wait ... " 
195
mkfs.ext3 -q $INSTALL_PART || exit 1
195
mkfs.ext3 -q $INSTALL_PART || exit 1
196
echo "done."; echo
196
echo "done."; echo
197
 
197
 
198
 
198
 
199
### mount $INSTALL_PART
199
### mount $INSTALL_PART
200
### -----------------------------------------------------------
200
### -----------------------------------------------------------
201
echo -n "Try to mount $INSTALL_PART to $NEW ... "
201
echo -n "Try to mount $INSTALL_PART to $NEW ... "
202
mkdir -p $NEW
202
mkdir -p $NEW
203
mount $INSTALL_PART $NEW || exit 1
203
mount $INSTALL_PART $NEW || exit 1
204
echo "done."; echo
204
echo "done."; echo
205
 
205
 
206
 
206
 
207
### copy root dirs
207
### copy root dirs
208
### -----------------------------------------------------------
208
### -----------------------------------------------------------
209
echo "Copy Live System to $INSTALL_PART:"
209
echo "Copy Live System to $INSTALL_PART:"
210
root_dirs=$( ls / )
210
root_dirs=$( ls / )
211
for dir in $root_dirs; do
211
for dir in $root_dirs; do
212
    # check if dir is not in $DIR_NOT_COPY
212
    # check if dir is not in $DIR_NOT_COPY
213
    do_not_copy=""
213
    do_not_copy=""
214
    for not_dir in $DIR_NOT_COPY; do
214
    for not_dir in $DIR_NOT_COPY; do
215
	if [ "$not_dir" = "/$dir" ]; then 
215
	if [ "$not_dir" = "/$dir" ]; then 
216
	    do_not_copy="yes"
216
	    do_not_copy="yes"
217
	    break
217
	    break
218
	fi
218
	fi
219
    done
219
    done
220
    # do not copy links
220
    # do not copy links
221
    [ -L /$dir ] && do_not_copy="yes"
221
    [ -L /$dir ] && do_not_copy="yes"
222
 
222
 
223
    if [ ! $do_not_copy ]; then
223
    if [ ! $do_not_copy ]; then
224
	echo -n "  * Copy  /$dir ... "
224
	echo -n "  * Copy  /$dir ... "
225
	cp -a /$dir $NEW
225
	cp -a /$dir $NEW
226
	echo "done."
226
	echo "done."
227
    fi
227
    fi
228
done
228
done
229
echo
229
echo
230
 
230
 
231
 
231
 
232
### move /usr/opt back to /opt
232
### move /usr/opt back to /opt
233
### -----------------------------------------------------------
233
### -----------------------------------------------------------
234
if [ -d $NEW/usr/opt ]; then
234
if [ -d $NEW/usr/opt ]; then
235
    echo -n "Move /opt back ... "
235
    echo -n "Move /opt back ... "
236
    mv $NEW/usr/opt $NEW/
236
    mv $NEW/usr/opt $NEW/
237
    echo "done."; echo
237
    echo "done."; echo
238
fi
238
fi
239
 
239
 
240
 
240
 
241
### create dirs which were not copied
241
### create dirs which were not copied
242
### -----------------------------------------------------------
242
### -----------------------------------------------------------
243
for dir in $DIR_NOT_COPY; do
243
for dir in $DIR_NOT_COPY; do
244
    mkdir $NEW/$dir
244
    mkdir $NEW/$dir
245
done
245
done
246
rmdir $NEW/livecd $NEW/mnt
246
rmdir $NEW/livecd $NEW/mnt
247
 
247
 
248
 
248
 
249
### copy back original files
249
### copy back original files
250
### -----------------------------------------------------------
250
### -----------------------------------------------------------
251
echo -n "Restore original files ... " 
251
echo -n "Restore original files ... " 
252
for file in $FILES_RESTORE; do
252
for file in $FILES_RESTORE; do
253
    [ -r $NEW/${file}.ori ] && cp -a $NEW/${file}.ori $NEW/${file} 
253
    [ -r $NEW/${file}.ori ] && cp -a $NEW/${file}.ori $NEW/${file} 
254
done
254
done
255
echo "done."; echo
255
echo "done."; echo
256
 
256
 
257
 
257
 
258
### do some mounts for chroot $NEW
258
### do some mounts for chroot $NEW
259
### -----------------------------------------------------------
259
### -----------------------------------------------------------
260
mount --bind /dev $NEW/dev
260
mount --bind /dev $NEW/dev
261
mount --bind /sys $NEW/sys 
261
mount --bind /sys $NEW/sys 
262
mount -t proc proc $NEW/proc
262
mount -t proc proc $NEW/proc
263
 
263
 
264
 
264
 
265
### install grub
265
### install grub
266
### -----------------------------------------------------------
266
### -----------------------------------------------------------
267
echo "Run grub-install: "; echo
267
echo "Run grub-install: "; echo
268
mkdir -p $NEW/boot/grub
268
mkdir -p $NEW/boot/grub
269
grub-install --root-directory=$NEW $MBR_DEV
269
grub-install --root-directory=$NEW $MBR_DEV
270
echo "done."; echo
270
echo "done."; echo
271
 
271
 
272
 
272
 
273
### define kernel version
273
### define kernel version
274
### -----------------------------------------------------------
274
### -----------------------------------------------------------
275
rpm --quiet -q kernel     && UP_installed=true
275
rpm --quiet -q kernel     && UP_installed=true
276
rpm --quiet -q kernel-smp && SMP_installed=true
276
rpm --quiet -q kernel-smp && SMP_installed=true
277
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
277
[ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
278
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
278
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
279
if [ ! $KERNEL_VERSION ]; then
279
if [ ! $KERNEL_VERSION ]; then
280
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
280
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
281
    exit 1
281
    exit 1
282
fi    
282
fi    
283
 
283
 
284
### convert dev syntax to grub syntax
284
### convert dev syntax to grub syntax
285
### -----------------------------------------------------------
285
### -----------------------------------------------------------
286
device_map=$NEW/boot/grub/device.map
286
device_map=$NEW/boot/grub/device.map
287
GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $device_map | awk '{ print $1 }' )
287
GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $device_map | awk '{ print $1 }' )
288
GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
288
GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
289
 
289
 
290
 
290
 
291
### define active Windows partition -  to be fixed  !!!
291
### define active Windows partition -  to be fixed  !!!
292
### -----------------------------------------------------------
292
### -----------------------------------------------------------
293
WIN_installed=true
293
WIN_installed=true
294
GRUB_WIN_PART=(hd0,0)
294
GRUB_WIN_PART=(hd0,0)
295
 
295
 
296
 
296
 
297
### create grub.conf file
297
### create grub.conf file
298
### -----------------------------------------------------------
298
### -----------------------------------------------------------
299
echo "Create grub.conf"
299
echo "Create grub.conf"
300
 
300
 
301
cat > $NEW/boot/grub/grub.conf <<EOF
301
cat > $NEW/boot/grub/grub.conf <<EOF
302
# grub.conf generated by $SCRIPTNAME
302
# grub.conf generated by $SCRIPTNAME
303
default=0
303
default=0
304
timeout=5
304
timeout=5
305
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
305
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
306
#hiddenmenu
306
#hiddenmenu
307
EOF
307
EOF
308
 
308
 
309
if [ $UP_installed ]; then
309
if [ $UP_installed ]; then
310
    cat >> $NEW/boot/grub/grub.conf <<EOF
310
    cat >> $NEW/boot/grub/grub.conf <<EOF
311
title Scientific Linux (${KERNEL_VERSION})
311
title Scientific Linux (${KERNEL_VERSION})
312
        root $GRUB_ROOT_PART
312
        root $GRUB_ROOT_PART
313
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
313
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
314
	initrd /boot/initrd-$KERNEL_VERSION.img
314
	initrd /boot/initrd-$KERNEL_VERSION.img
315
EOF
315
EOF
316
fi
316
fi
317
 
317
 
318
if [ $SMP_installed ]; then
318
if [ $SMP_installed ]; then
319
    cat >> $NEW/boot/grub/grub.conf <<EOF
319
    cat >> $NEW/boot/grub/grub.conf <<EOF
320
title Scientific Linux (${KERNEL_VERSION}smp)
320
title Scientific Linux (${KERNEL_VERSION}smp)
321
        root $GRUB_ROOT_PART
321
        root $GRUB_ROOT_PART
322
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
322
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
323
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
323
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
324
EOF
324
EOF
325
fi
325
fi
326
 
326
 
327
if [ $WIN_installed ]; then
327
if [ $WIN_installed ]; then
328
    cat >> $NEW/boot/grub/grub.conf <<EOF
328
    cat >> $NEW/boot/grub/grub.conf <<EOF
329
title Windows
329
title Windows
330
        rootnoverify $GRUB_WIN_PART
330
        rootnoverify $GRUB_WIN_PART
331
        chainloader +1
331
        chainloader +1
332
EOF
332
EOF
333
fi
333
fi
334
 
334
 
335
chmod 600 $NEW/boot/grub/grub.conf
335
chmod 600 $NEW/boot/grub/grub.conf
336
ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
336
ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
337
ln -s ./grub.conf $NEW/boot/grub/menu.lst
337
ln -s ./grub.conf $NEW/boot/grub/menu.lst
338
echo "done."; echo
338
echo "done."; echo
339
 
339
 
340
 
340
 
341
### install kernel into /boot
341
### install kernel into /boot
342
### -----------------------------------------------------------
342
### -----------------------------------------------------------
343
echo "Install kernel(s)"
343
echo "Install kernel(s)"
344
 
344
 
345
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
345
[ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
346
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
346
[ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
347
 
347
 
348
if [ ! $BOOT_DIR ]; then
348
if [ ! $BOOT_DIR ]; then
349
    echo "ERROR: No kernel found - installation failed"; echo
349
    echo "ERROR: No kernel found - installation failed"; echo
350
    exit 1
350
    exit 1
351
fi
351
fi
352
 
352
 
353
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
353
cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
354
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
354
cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
355
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
355
cp -a $BOOT_DIR/System.map-*       $NEW/boot/
356
cp -a $BOOT_DIR/config-*           $NEW/boot/
356
cp -a $BOOT_DIR/config-*           $NEW/boot/
357
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/
357
cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/
358
echo "done."; echo
358
echo "done."; echo
359
 
359
 
360
 
360
 
361
### make initrd
361
### make initrd
362
### -----------------------------------------------------------
362
### -----------------------------------------------------------
363
echo "Create initrd(s)"
363
echo "Create initrd(s)"
364
if [ $UP_installed ]; then
364
if [ $UP_installed ]; then
365
    chroot $NEW \
365
    chroot $NEW \
366
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}
366
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}
367
fi
367
fi
368
if [ $SMP_installed ]; then
368
if [ $SMP_installed ]; then
369
    chroot $NEW \
369
    chroot $NEW \
370
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}smp
370
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}smp
371
fi
371
fi
372
echo "done."; echo
372
echo "done."; echo
373
 
373
 
374
 
374
 
375
### create /etc/fstab
375
### create /etc/fstab
376
### -----------------------------------------------------------
376
### -----------------------------------------------------------
377
cat > $NEW/etc/fstab <<EOF
377
cat > $NEW/etc/fstab <<EOF
378
$INSTALL_PART         /                    ext3    defaults        1 1
378
$INSTALL_PART         /                    ext3    defaults        1 1
379
devpts            /dev/pts             devpts  gid=5,mode=620  0 0
379
devpts            /dev/pts             devpts  gid=5,mode=620  0 0
380
tmpfs             /dev/shm             tmpfs   defaults        0 0
380
tmpfs             /dev/shm             tmpfs   defaults        0 0
381
proc              /proc                proc    defaults        0 0
381
proc              /proc                proc    defaults        0 0
382
sysfs             /sys                 sysfs   defaults        0 0
382
sysfs             /sys                 sysfs   defaults        0 0
383
EOF
383
EOF
384
 
384
 
385
if [ $SWAP_PART ]; then
385
if [ $SWAP_PART ]; then
386
    echo "$SWAP_PART         swap                 swap    defaults        0 0" >> $NEW/etc/fstab
386
    echo "$SWAP_PART         swap                 swap    defaults        0 0" >> $NEW/etc/fstab
387
fi
387
fi
388
 
388
 
389
 
389
 
390
### remove LiveCD init.d scripts
390
### remove LiveCD init.d scripts
391
### -----------------------------------------------------------
391
### -----------------------------------------------------------
392
for file in $LIVECD_INIT_SCRIPTS; do
392
for file in $LIVECD_INIT_SCRIPTS; do
393
    rm -f $NEW/etc/init.d/$file
393
    rm -f $NEW/etc/init.d/$file
394
    for n in 0 1 2 3 4 5 6; do
394
    for n in 0 1 2 3 4 5 6; do
395
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
395
	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
396
    done
396
    done
397
done
397
done
398
 
398
 
399
 
399
 
400
### restore cronjobs
400
### restore cronjobs
401
### -----------------------------------------------------------
401
### -----------------------------------------------------------
402
mv /etc/cron_backup/sysstat /etc/cron.d/ 2>/dev/null
402
mv /etc/cron_backup/sysstat /etc/cron.d/ 2>/dev/null
403
mv /etc/cron_backup/00-makewhatis.cron.weekly /etc/cron.weekly/00-makewhatis.cron 2>/dev/null
403
mv /etc/cron_backup/00-makewhatis.cron.weekly /etc/cron.weekly/00-makewhatis.cron 2>/dev/null
404
mv /etc/cron_backup/* /etc/cron.daily/
404
mv /etc/cron_backup/* /etc/cron.daily/
405
 
405
 
406
 
406
 
407
### umount $INSTALL_PART
407
### umount $INSTALL_PART
408
### -----------------------------------------------------------
408
### -----------------------------------------------------------
409
umount $NEW/dev
409
umount $NEW/dev
410
umount $NEW/sys 
410
umount $NEW/sys 
411
umount $NEW/proc
411
umount $NEW/proc
412
umount $INSTALL_PART
412
umount $INSTALL_PART
413
 
413