Subversion Repositories livecd

Rev

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

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