--- alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh 2005/04/18 19:01:41 259 +++ alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh 2008/06/27 22:01:08 519 @@ -1,9 +1,9 @@ #!/bin/sh # -# $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.1.1.1 2005-04-18 19:01:41 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.6 2008-06-27 22:01:08 niro Exp $ # # AutoSta_LX Installation Script -# version: 0.8b +# version: 0.9 # # Niels Rogalla # @@ -12,11 +12,6 @@ # Install Navigation Gui # -#source /etc/alx_version -#source /opt/alx-config/version - -#source /etc/alx-config/config.rc - #images: (get ${CDIMAGENAME}) source /mnt/cdrom/system/images.conf @@ -27,7 +22,7 @@ ######################################## ### System/Config Version -VERSION="0.1" +VERSION="0.2" TITLE="alxinstall-ng - ${VERSION}" #CONFIGS_TEMPLATE="/opt/alx-config/configs" @@ -45,10 +40,6 @@ ################################################# die() { - #clear - #echo -e "\nhuch, da ist ein script gestorben -> $?\n" - #read - #exit 0 ERROR=$1 RETVAL=$? dialog_install_failure @@ -87,7 +78,20 @@ Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 } -dialog_setup_hdd_menu() { +dialog_setup_hdd_info_flash(){ + local SHDD="`echo $HDD|sed -e 's/\/dev\///'`" + + dialog \ + --colors \ + --title "[ Festplatten Partitionierung ]" \ + --backtitle "$TITLE" \ + --ok-label "Weiter" \ + --msgbox "\nBitte legen Sie 1 Partition an.\n\n\ + [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\ + Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 +} + +dialog_setup_system_menu() { I=`dialog \ --backtitle "$TITLE" \ @@ -95,9 +99,9 @@ --cancel-label "Abbrechen" \ --ok-label "Weiter" \ --stdout \ - --menu "\nWaehlen Sie zwischen Manuell und Automatisch" 14 70 5 \ - "1" "Manuell" \ - "2" "Automatisch"` + --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \ + "1" "Normale IDE-Disk" \ + "2" "Flash-Speicher"` RES=$? if [ "$RES" == "1" ];then return 1 @@ -105,12 +109,11 @@ if [ "$RES" == "0" ];then case "$I" in "1") - dialog_setup_hdd_found_manuell + run_install_normal ;; "2") - dialog_warning - setup_hdd_partitions_silent - ;; + run_install_flash + ;; esac fi } @@ -202,6 +205,44 @@ fi } +dialog_setup_hdd_partitions_manuell_flash() { + if [ -z "$installdevs" ] + then + dialog \ + --backtitle "$TITLE" \ + --ok-label "Beenden" \ + --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 + exit 1 + else + + echo "dialog \\" > /tmp/hddtmp.sh + echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh + echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh + echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh + echo "--stdout \\" >> /tmp/hddtmp.sh + echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh + + for I in $installdevs + do + echo "\"$I\" \"\" \\" >> /tmp/hddtmp.sh + done + echo -e "\n" >> /tmp/hddtmp.sh + + chmod a+x /tmp/hddtmp.sh + HDD="`/tmp/hddtmp.sh`" + RES=$? + if [ "$RES" == "1" ] + then + return 1 + fi + if [ "$RES" == "0" ] + then + dialog_setup_hdd_info_flash + setup_hdd_partitions_manuell_flash + fi + fi +} + dialog_setup_hdd_partitions_silent() { dialog \ --backtitle "$TITLE" \ @@ -321,7 +362,7 @@ "1" "AutoSta_LX installieren" \ "2" "Uebersicht gefundener Laufwerke" \ "3" "Beenden und neustarten" \ - "4" "Beenden ohne neustarten" ` + "4" "Beenden und eine Shell starten" ` RES=$? if [ "$RES" == "1" ];then exit 1 @@ -329,15 +370,14 @@ if [ "$RES" == "0" ];then case "$METHOD" in "1") - #only for now later it will be used again - #with 6.1-r2 only one install method available - #dialog_install_method - run_install_normal + dialog_setup_system_menu ;; "2") dialog_setup_hdd_found_manuell ;; "3") install_do_reboot ;; + "4") /bin/bash --login -i + ;; esac fi done @@ -355,6 +395,13 @@ cfdisk $HDD || die } +setup_hdd_partitions_manuell_flash() { + ROOTHDD="${HDD}1" + + ## hdds partitionieren manuell + cfdisk $HDD || die +} + setup_hdd_partitions_silent() { ## hdds löschen dd if=/dev/zero of=$HDD bs=1024k count=1 || die @@ -370,6 +417,10 @@ mke2fs -j -q $ROOTHDD || die } +setup_hdd_format_flash() { + mke2fs -j -q $ROOTHDD || die +} + install_mount_rootfs() { swapon $SWAPHDD || die mount $ROOTHDD $INSTALLPATH || die @@ -378,8 +429,13 @@ cd $INSTALLPATH || die } +install_mount_rootfs_flash() { + mount $ROOTHDD $INSTALLPATH || die + install -d $INSTALLPATH/boot || die + cd $INSTALLPATH || die +} + install_system_image() { - #tar xvzpf $CDPATH/system/autosta_lx.tar.gz tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH} } @@ -388,8 +444,6 @@ declare -i CPUTYPE=`cat /proc/cpuinfo |grep "cpu family"|cut -d ' ' -f3` if [ $CPUTYPE -le 5 ];then - #echo -e "\033[1;6m\033[36m""i386 Architektur gefunden.""\033[0m" - #echo -e "Installiere i386 Kernel..." lastdir="`pwd`" @@ -406,8 +460,6 @@ cd $lastdir || die elif [ $CPUTYPE -ge 6 ];then - #echo -e "\033[1;6m\033[36m""i686 Architektur gefunden.""\033[0m" - #echo -e "Installiere i686 Kernel..." lastdir="`pwd`" @@ -446,21 +498,12 @@ echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die - #no support for splash image in 6.1-r2 - #echo -e "splashimage=(hd0,0)/boot/grub/splash.xpm.gz" >> $INSTALLPATH/boot/grub/grub.conf || die echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die - - #s3 cards don't support this - #echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD vga=0x317 video:vesa:ywrap,mtrr splash=silent quiet" >> $INSTALLPATH/boot/grub/grub.conf || die - #that's more safer: + echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die - - #not needed without bootsplash support - #echo -e "initrd=/boot/${KRNINITRD}" >> $INSTALLPATH/boot/grub/grub.conf || die ### bootsector schreiben - #grub --no-floppy < $CONFIGS_TEMPLATE/grubsettings || die /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die root (hd0,0) setup (hd0) @@ -470,7 +513,6 @@ install_bootsector_chroot() { ### grubconf schreiben - #source $INSTALLPATH/INSTALL/kernel/kernelversion source $INSTALLPATH/boot/kernelversion #for alx only @@ -498,23 +540,13 @@ fi echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die - echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die - - #no support for splash image in 6.1-r2 - #echo -e "splashimage=(hd0,0)/boot/grub/splash.xpm.gz" >> $INSTALLPATH/boot/grub/grub.conf || die + echo -e "timeout 0" >> $INSTALLPATH/boot/grub/grub.conf ||die echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die - #s3 cards don't support this - #echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD vga=0x317 video:vesa:ywrap,mtrr splash=silent quiet" >> $INSTALLPATH/boot/grub/grub.conf || die - #that's more safer: echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die - #not needed without bootsplash support - #echo -e "initrd=/boot/${KRNINITRD}" >> $INSTALLPATH/boot/grub/grub.conf || die - - ### bootsector schreiben chrooted schreiben (gentoo) if [ -f $INSTALLPATH/sbin/grub ] then @@ -524,7 +556,7 @@ setup (hd0) quit EOF -exit +exit 0 CHROOTEOF fi @@ -537,14 +569,16 @@ setup (hd0) quit EOF -exit +exit 0 CHROOTEOF fi ##enters chroot - mount -t proc proc $INSTALLPATH/proc - chroot $INSTALLPATH /bin/bash + mount -t proc none $INSTALLPATH/proc + mount -o bind /dev $INSTALLPATH/dev + chroot $INSTALLPATH /bin/bash --rcfile /root/.bashrc -i umount $INSTALLPATH/proc + umount $INSTALLPATH/dev rm $INSTALLPATH/root/.bashrc } @@ -564,18 +598,23 @@ install_system_settings(){ ### schreibe fstab - echo -e "$BOOTHDD\t/\text3\tnoatime,noauto\t1 1" > $INSTALLPATH/etc/fstab || die + echo -e "$BOOTHDD\t/boot\text3\tnoatime,noauto\t1 1" > $INSTALLPATH/etc/fstab || die echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" >> $INSTALLPATH/etc/fstab || die echo -e "$SWAPHDD\tswap\tswap\tpri=1\t0 0" >> $INSTALLPATH/etc/fstab || die echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die - #deprecated - #echo -e "devpts\t/dev/pts\tdevpts\tgid=4,mode=620\t0 0" >> $INSTALLPATH/etc/fstab || die - echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die } +install_system_settings_flash(){ + ### schreibe fstab + echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" > $INSTALLPATH/etc/fstab || die + echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die + + echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die + echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die +} install_hotfixes(){ if [ -f $CDPATH/hotfixes/hotfixes.sh ] then @@ -592,15 +631,13 @@ swapoff $SWAPHDD || die } +install_umount_rootfs_flash() { + cd / + umount $INSTALLPATH || die +} + install_do_reboot() { - #only for now later it will be used again - #with 6.1-r2 these options are not available - #cd / - #umount $CDPATH - #eject - #clear - reboot } @@ -609,9 +646,6 @@ ################################################# run_install_normal() { - #only for now later it will be used again - #with 6.1-r2 only one install method available - #dialog_setup_hdd_menu dialog_setup_hdd_found_manuell dialog_setup_hdd_partitions_manuell @@ -620,20 +654,9 @@ install_mount_rootfs (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image - #only for now later it will be used again - #with 6.1-r2 variable kernels are not available - #dialog_install_kernel_image - #install_kernel_image - dialog_install_bootsector install_bootsector_chroot - - #only for now later it will be used again - #with 6.1-r2 highest version of alx-config is already included - #dialog_install_alxconfig - #sleep 1 - #install_alxconfig - + dialog_install_settings sleep 1 install_system_settings @@ -642,6 +665,27 @@ dialog_install_successful } +run_install_flash() { + dialog_setup_hdd_found_manuell + + dialog_setup_hdd_partitions_manuell_flash + dialog_setup_hdd_format + setup_hdd_format_flash > /dev/null + install_mount_rootfs_flash + (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image + + + dialog_install_bootsector + install_bootsector_chroot + + dialog_install_settings + sleep 1 + install_system_settings_flash + install_hotfixes + install_umount_rootfs_flash + dialog_install_successful +} + run_install_silent() { echo "starting silent install ..." sleep 1