Subversion Repositories livecd

Rev

Rev 17 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 18
Line 68... Line 68...
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 (leave MBR untouched) 
-
 
74
    -floppy             need, if grub should be isntalled on a floopy
74
    -y                  answer all questions with yes
75
    -y                  answer all questions with yes
75
 
76
 
76
EOF
77
EOF
77
}
78
}
78
 
79
 
Line 100... Line 101...
100
            shift; SWAP_PART=$1; shift; continue;;
101
            shift; SWAP_PART=$1; shift; continue;;
101
       -mbr)
102
       -mbr)
102
            shift; MBR_DEV=$1; shift; continue;;
103
            shift; MBR_DEV=$1; shift; continue;;
103
       -nogrub)
104
       -nogrub)
104
            NOGRUB=$1; shift; continue;;
105
            NOGRUB=$1; shift; continue;;
-
 
106
       -floppy)
-
 
107
            FLOPPY=$1; shift; continue;;
105
       -y)
108
       -y)
106
            YES=$1; shift; continue;;
109
            YES=$1; shift; continue;;
107
 
110
 
108
       *)
111
       *)
109
            INSTALL_PART=$1; break;;
112
            INSTALL_PART=$1; break;;
Line 115... Line 118...
115
 
118
 
116
### test if MBR_DEV is given
119
### test if MBR_DEV is given
117
### -----------------------------------------------------------
120
### -----------------------------------------------------------
118
if [ ! $NOGRUB ]; then
121
if [ ! $NOGRUB ]; then
119
    if [ ! $MBR_DEV ]; then
122
    if [ ! $MBR_DEV ]; then
120
	echo "No MBR device defined - where should grub be installed?"
123
	echo "No MBR device defined."
121
	echo "Please see '$SCRIPTNAME -h'."; echo
124
	echo "Please see '$SCRIPTNAME -h'."; echo
122
	exit 1
125
	exit 1
123
    fi
126
    fi
124
fi
127
fi
125
 
128
 
Line 180... Line 183...
180
 
183
 
181
### continue ?
184
### continue ?
182
### -----------------------------------------------------------
185
### -----------------------------------------------------------
183
if [ ! $YES ]; then
186
if [ ! $YES ]; then
184
    echo -n "Continue (y/N)? "
187
    echo -n "Continue (y/N)? "
185
    read -n 1 key
188
    read key
186
    echo
189
    echo
187
    [ "$key" != "y" ] && exit 0
190
    [ "$key" != "y" ] && exit 0
188
fi
191
fi
189
echo
192
echo
190
 
193
 
Line 264... Line 267...
264
 
267
 
265
### install grub
268
### install grub
266
### -----------------------------------------------------------
269
### -----------------------------------------------------------
267
echo "Run grub-install: "; echo
270
echo "Run grub-install: "; echo
268
mkdir -p $NEW/boot/grub
271
mkdir -p $NEW/boot/grub
-
 
272
if [ $FLOPPY ]; then
269
grub-install --root-directory=$NEW $MBR_DEV
273
    grub-install --root-directory=$NEW $MBR_DEV
-
 
274
else
-
 
275
    grub-install --no-floppy --root-directory=$NEW $MBR_DEV
-
 
276
fi
270
echo "done."; echo
277
echo "done."; echo
271
 
278
 
272
 
279
 
273
### define kernel version
280
### define kernel version
274
### -----------------------------------------------------------
281
### -----------------------------------------------------------
Line 278... Line 285...
278
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
285
[ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
279
if [ ! $KERNEL_VERSION ]; then
286
if [ ! $KERNEL_VERSION ]; then
280
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
287
    echo "ERROR: Kernel version could not be determined - installation failed"; echo
281
    exit 1
288
    exit 1
282
fi    
289
fi    
-
 
290
[ $UP_installed ]   && echo "UP kernel found."
-
 
291
[ $SMP_installed ]  && echo "SMP kernel found."
-
 
292
echo
-
 
293
 
283
 
294
 
284
### convert dev syntax to grub syntax
295
### convert dev syntax to grub syntax
285
### -----------------------------------------------------------
296
### -----------------------------------------------------------
286
device_map=$NEW/boot/grub/device.map
297
device_map=$NEW/boot/grub/device.map
287
GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $device_map | awk '{ print $1 }' )
298
GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $device_map | awk '{ print $1 }' )
Line 305... Line 316...
305
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
316
splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
306
#hiddenmenu
317
#hiddenmenu
307
EOF
318
EOF
308
 
319
 
309
if [ $UP_installed ]; then
320
if [ $UP_installed ]; then
-
 
321
    echo "Add entry for UP kernel into grub.conf"
310
    cat >> $NEW/boot/grub/grub.conf <<EOF
322
    cat >> $NEW/boot/grub/grub.conf <<EOF
311
title Scientific Linux (${KERNEL_VERSION})
323
title Scientific Linux (${KERNEL_VERSION})
312
        root $GRUB_ROOT_PART
324
        root $GRUB_ROOT_PART
313
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
325
	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
314
	initrd /boot/initrd-$KERNEL_VERSION.img
326
	initrd /boot/initrd-$KERNEL_VERSION.img
315
EOF
327
EOF
316
fi
328
fi
317
 
329
 
318
if [ $SMP_installed ]; then
330
if [ $SMP_installed ]; then
-
 
331
    echo "Add entry for SMP kernel into grub.conf"
319
    cat >> $NEW/boot/grub/grub.conf <<EOF
332
    cat >> $NEW/boot/grub/grub.conf <<EOF
320
title Scientific Linux (${KERNEL_VERSION}smp)
333
title Scientific Linux (${KERNEL_VERSION}smp)
321
        root $GRUB_ROOT_PART
334
        root $GRUB_ROOT_PART
322
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
335
	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
323
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
336
	initrd /boot/initrd-${KERNEL_VERSION}smp.img
324
EOF
337
EOF
325
fi
338
fi
326
 
339
 
327
if [ $WIN_installed ]; then
340
if [ $WIN_installed ]; then
-
 
341
    echo "Add entry for Windows into grub.conf"
328
    cat >> $NEW/boot/grub/grub.conf <<EOF
342
    cat >> $NEW/boot/grub/grub.conf <<EOF
329
title Windows
343
title Windows
330
        rootnoverify $GRUB_WIN_PART
344
        rootnoverify $GRUB_WIN_PART
331
        chainloader +1
345
        chainloader +1
332
EOF
346
EOF
Line 360... Line 374...
360
 
374
 
361
### make initrd
375
### make initrd
362
### -----------------------------------------------------------
376
### -----------------------------------------------------------
363
echo "Create initrd(s)"
377
echo "Create initrd(s)"
364
if [ $UP_installed ]; then
378
if [ $UP_installed ]; then
-
 
379
    chroot $NEW depmod -a
365
    chroot $NEW \
380
    chroot $NEW \
366
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}
381
    livecd-mkinitrd $NEW/boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
-
 
382
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
-
 
383
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
-
 
384
	exit 1
-
 
385
    fi
367
fi
386
fi
368
if [ $SMP_installed ]; then
387
if [ $SMP_installed ]; then
-
 
388
    chroot $NEW depmod -a
369
    chroot $NEW \
389
    chroot $NEW \
370
    /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install ${KERNEL_VERSION}smp
390
    livecd-mkinitrd $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
-
 
391
    if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
-
 
392
	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
-
 
393
	exit 1
-
 
394
    fi
371
fi
395
fi
372
echo "done."; echo
396
echo "done."; echo
373
 
397
 
374
 
398
 
375
### create /etc/fstab
399
### create /etc/fstab
Line 402... Line 426...
402
mv /etc/cron_backup/sysstat /etc/cron.d/ 2>/dev/null
426
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
427
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/
428
mv /etc/cron_backup/* /etc/cron.daily/
405
 
429
 
406
 
430
 
-
 
431
### turn on kudzu again
-
 
432
### -----------------------------------------------------------
-
 
433
chkconfig kudzu on
-
 
434
 
-
 
435
 
407
### umount $INSTALL_PART
436
### umount $INSTALL_PART
408
### -----------------------------------------------------------
437
### -----------------------------------------------------------
409
umount $NEW/dev
438
umount $NEW/dev
410
umount $NEW/sys 
439
umount $NEW/sys 
411
umount $NEW/proc
440
umount $NEW/proc
-
 
441
 
412
umount $INSTALL_PART
442
umount $INSTALL_PART
413
 
443