1 |
#!/bin/sh |
#!/bin/sh |
2 |
# |
# |
3 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.8 2008-06-27 22:43:02 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.15 2008-06-28 00:37:45 niro Exp $ |
4 |
# |
# |
5 |
# AutoSta_LX Installation Script |
# AutoSta_LX Installation Script |
6 |
# |
# |
17 |
#Includes |
#Includes |
18 |
source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null |
source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null |
19 |
### bugfix ############################### |
### bugfix ############################### |
20 |
cdromdev="`echo $cdromdev|sed -e 's/ //'`" |
cdromdev="$(echo ${cdromdev} | sed 's/ //')" |
21 |
######################################## |
######################################## |
22 |
|
|
23 |
### System/Config Version |
### System/Config Version |
24 |
VERSION="0.3" |
VERSION="0.3.2" |
25 |
TITLE="alxinstall-ng - ${VERSION}" |
TITLE="alxinstall-ng - ${VERSION}" |
26 |
|
|
|
#CONFIGS_TEMPLATE="/opt/alx-config/configs" |
|
|
|
|
27 |
CDPATH="/mnt/cdrom" |
CDPATH="/mnt/cdrom" |
28 |
INSTALLPATH="/mnt/magellan" |
INSTALLPATH="/mnt/magellan" |
29 |
|
|
266 |
{ |
{ |
267 |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
268 |
do |
do |
269 |
CURRENTLINE=$(grep --count . /tmp/install.log) |
CURRENTLINE=$(grep -c . /tmp/install.log) |
270 |
PERCENT=$(expr ${CURRENTLINE} \* 100 / ${TOTALLINES}) |
PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) |
271 |
echo ${PERCENT} |
echo ${PERCENT} |
272 |
sleep 1 |
sleep 1 |
273 |
done |
done |
318 |
"3" "Beenden und neustarten" \ |
"3" "Beenden und neustarten" \ |
319 |
"4" "Beenden und eine Shell starten") |
"4" "Beenden und eine Shell starten") |
320 |
RES=$? |
RES=$? |
321 |
if [[ ${RES} -eq 1 ]] && exit 1 |
[[ ${RES} -eq 1 ]] && exit 1 |
322 |
if [[ ${RES} -eq 0 ]] |
if [[ ${RES} -eq 0 ]] |
323 |
then |
then |
324 |
case ${METHOD} in |
case ${METHOD} in |
402 |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
403 |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
404 |
|
|
405 |
echo "default 0" > ${INSTALLPATH}/boot/grub/grub.conf || die |
local grubconf=${INSTALLPATH}/boot/grub/grub.conf |
406 |
echo "timeout 0" >> ${INSTALLPATH}/boot/grub/grub.conf ||die |
: > ${grubconf} || die |
407 |
|
echo "default 0" >> ${grubconf} || die |
408 |
|
echo "timeout 3" >> ${grubconf} || die |
409 |
|
# using current root password |
410 |
|
echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || die |
411 |
|
|
412 |
|
echo >> ${grubconf} || die |
413 |
|
echo "# normal boot" >> ${grubconf} || die |
414 |
|
echo "title ${KRNVER}" >> ${grubconf} || die |
415 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
416 |
|
echo "kernel /boot/vmlinuz root=${ROOTHDD} quiet" >> ${grubconf} || die |
417 |
|
echo "initrd /boot/initrd" >> ${grubconf} || die |
418 |
|
|
419 |
|
echo >> ${grubconf} || die |
420 |
|
echo "# admin boot" >> ${grubconf} || die |
421 |
|
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die |
422 |
|
echo "lock" >> ${grubconf} || die |
423 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
424 |
|
echo "kernel /boot/vmlinuz root=${ROOTHDD} quiet hardware-auto-detection" >> ${grubconf} || die |
425 |
|
echo "initrd /boot/initrd" >> ${grubconf} || die |
426 |
|
|
427 |
|
echo >> ${grubconf} || die |
428 |
|
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die |
429 |
|
echo "lock" >> ${grubconf} || die |
430 |
|
echo "root (hd0,0)" >> ${grubconf} || die |
431 |
|
echo "kernel /boot/vmlinuz root=${ROOTHDD} quiet alx-reset-settings" >> ${grubconf} || die |
432 |
|
echo "initrd /boot/initrd" >> ${grubconf} || die |
433 |
|
|
|
echo -e "\ntitle=${KRNVER}" >> ${INSTALLPATH}/boot/grub/grub.conf || die |
|
|
echo "root (hd0,0)" >> ${INSTALLPATH}/boot/grub/grub.conf || die |
|
|
|
|
|
echo "kernel /boot/vmlinuz root=${ROOTHDD} quiet" >> ${INSTALLPATH}/boot/grub/grub.conf || die |
|
|
echo "initrd /boot/initrd" >> ${INSTALLPATH}/boot/grub/grub.conf || die |
|
|
|
|
434 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
435 |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
436 |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
443 |
|
|
444 |
## enters chroot |
## enters chroot |
445 |
mount -t proc proc ${INSTALLPATH}/proc |
mount -t proc proc ${INSTALLPATH}/proc |
446 |
mount -t sysfs sysfs ${INSTALLPATH}/sysfs |
mount -t sysfs sysfs ${INSTALLPATH}/sys |
447 |
|
mount -o bind /dev ${INSTALLPATH}/dev |
448 |
|
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
449 |
|
umount ${INSTALLPATH}/proc |
450 |
|
umount ${INSTALLPATH}/sys |
451 |
|
umount ${INSTALLPATH}/dev |
452 |
|
rm ${INSTALLPATH}/root/.bashrc |
453 |
|
} |
454 |
|
|
455 |
|
install_mkinitrd_chroot() |
456 |
|
{ |
457 |
|
cat > ${INSTALLPATH}/root/.bashrc << CHROOTEOF |
458 |
|
echo "MODULES=\"ext3 amd74xx piix sis5513 via82cxxx\"" > /etc/conf.d/mkinitrd |
459 |
|
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
460 |
|
exit 0 |
461 |
|
CHROOTEOF |
462 |
|
|
463 |
|
## enters chroot |
464 |
|
mount -t proc proc ${INSTALLPATH}/proc |
465 |
|
mount -t sysfs sysfs ${INSTALLPATH}/sys |
466 |
mount -o bind /dev ${INSTALLPATH}/dev |
mount -o bind /dev ${INSTALLPATH}/dev |
467 |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
chroot ${INSTALLPATH} /bin/bash --rcfile /root/.bashrc -i |
468 |
umount ${INSTALLPATH}/proc |
umount ${INSTALLPATH}/proc |
479 |
echo -e "${SWAPHDD}\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "${SWAPHDD}\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
480 |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
481 |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die |
482 |
|
|
483 |
|
# install network config skeleton |
484 |
|
install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die |
485 |
} |
} |
486 |
|
|
487 |
install_system_settings_flash() |
install_system_settings_flash() |
531 |
dialog_install_settings |
dialog_install_settings |
532 |
sleep 1 |
sleep 1 |
533 |
install_system_settings |
install_system_settings |
534 |
|
install_mkinitrd_chroot |
535 |
install_umount_rootfs |
install_umount_rootfs |
536 |
dialog_install_successful |
dialog_install_successful |
537 |
} |
} |
552 |
dialog_install_settings |
dialog_install_settings |
553 |
sleep 1 |
sleep 1 |
554 |
install_system_settings_flash |
install_system_settings_flash |
555 |
|
install_mkinitrd_chroot |
556 |
install_umount_rootfs_flash |
install_umount_rootfs_flash |
557 |
dialog_install_successful |
dialog_install_successful |
558 |
} |
} |