Magellan Linux

Diff of /alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 261 by niro, Mon Apr 18 21:28:22 2005 UTC revision 519 by niro, Fri Jun 27 22:01:08 2008 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  #
3  # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.3 2005-04-18 21:28:22 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 $
4  #  #
5  # AutoSta_LX Installation Script  # AutoSta_LX Installation Script
6  # version: 0.8b  # version: 0.9
7  #  #
8  # Niels Rogalla <niro@magellan-linux.de>  # Niels Rogalla <niro@magellan-linux.de>
9  # <rogalla@augusta-bochum.de>  # <rogalla@augusta-bochum.de>
# Line 12  Line 12 
12  # Install Navigation Gui  # Install Navigation Gui
13  #  #
14    
 #source /etc/alx_version  
 #source /opt/alx-config/version  
   
 #source /etc/alx-config/config.rc  
   
15  #images: (get ${CDIMAGENAME})  #images: (get ${CDIMAGENAME})
16  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
17    
# Line 27  cdromdev="`echo $cdromdev|sed -e 's/ //' Line 22  cdromdev="`echo $cdromdev|sed -e 's/ //'
22  ########################################  ########################################
23    
24  ### System/Config Version  ### System/Config Version
25  VERSION="0.1"  VERSION="0.2"
26  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
27    
28  #CONFIGS_TEMPLATE="/opt/alx-config/configs"  #CONFIGS_TEMPLATE="/opt/alx-config/configs"
# Line 45  CURRENTLINE=0 Line 40  CURRENTLINE=0
40  #################################################  #################################################
41    
42  die() {  die() {
  #clear  
  #echo -e "\nhuch, da ist ein script gestorben -> $?\n"  
  #read  
  #exit 0  
43   ERROR=$1   ERROR=$1
44   RETVAL=$?   RETVAL=$?
45   dialog_install_failure   dialog_install_failure
# Line 87  dialog_setup_hdd_info(){ Line 78  dialog_setup_hdd_info(){
78   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
79  }  }
80    
81  dialog_setup_hdd_menu() {  dialog_setup_hdd_info_flash(){
82     local SHDD="`echo $HDD|sed -e 's/\/dev\///'`"
83    
84     dialog \
85     --colors \
86     --title "[ Festplatten Partitionierung ]" \
87     --backtitle "$TITLE" \
88     --ok-label "Weiter" \
89     --msgbox "\nBitte legen Sie 1 Partition an.\n\n\
90     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\
91     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
92    }
93    
94    dialog_setup_system_menu() {
95    
96   I=`dialog \   I=`dialog \
97   --backtitle "$TITLE" \   --backtitle "$TITLE" \
# Line 95  dialog_setup_hdd_menu() { Line 99  dialog_setup_hdd_menu() {
99   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
100   --ok-label "Weiter" \   --ok-label "Weiter" \
101   --stdout \   --stdout \
102   --menu "\nWaehlen Sie zwischen Manuell und Automatisch" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \
103   "1" "Manuell" \   "1" "Normale IDE-Disk" \
104   "2" "Automatisch"`   "2" "Flash-Speicher"`
105   RES=$?   RES=$?
106   if [ "$RES" == "1" ];then   if [ "$RES" == "1" ];then
107   return 1   return 1
# Line 105  dialog_setup_hdd_menu() { Line 109  dialog_setup_hdd_menu() {
109   if [ "$RES" == "0" ];then   if [ "$RES" == "0" ];then
110   case "$I" in   case "$I" in
111           "1")           "1")
112   dialog_setup_hdd_found_manuell   run_install_normal
113   ;;   ;;
114   "2")   "2")
115   dialog_warning   run_install_flash
116   setup_hdd_partitions_silent   ;;
      ;;  
117   esac   esac
118   fi   fi
119  }  }
# Line 202  dialog_setup_hdd_partitions_manuell() { Line 205  dialog_setup_hdd_partitions_manuell() {
205   fi   fi
206  }  }
207    
208    dialog_setup_hdd_partitions_manuell_flash() {
209     if [ -z "$installdevs" ]
210     then
211     dialog \
212     --backtitle "$TITLE" \
213     --ok-label "Beenden" \
214     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
215     exit 1
216     else
217    
218     echo "dialog \\" > /tmp/hddtmp.sh
219     echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh
220     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
221     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
222     echo "--stdout \\" >> /tmp/hddtmp.sh
223     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
224    
225     for I in $installdevs
226     do
227     echo "\"$I\" \"\" \\" >> /tmp/hddtmp.sh
228     done
229     echo -e "\n" >> /tmp/hddtmp.sh
230    
231     chmod a+x /tmp/hddtmp.sh
232     HDD="`/tmp/hddtmp.sh`"
233     RES=$?
234     if [ "$RES" == "1" ]
235     then
236     return 1
237     fi
238     if [ "$RES" == "0" ]
239     then
240     dialog_setup_hdd_info_flash
241     setup_hdd_partitions_manuell_flash
242     fi
243     fi
244    }
245    
246  dialog_setup_hdd_partitions_silent() {  dialog_setup_hdd_partitions_silent() {
247   dialog \   dialog \
248   --backtitle "$TITLE" \   --backtitle "$TITLE" \
# Line 329  dialog_main() { Line 370  dialog_main() {
370   if [ "$RES" == "0" ];then   if [ "$RES" == "0" ];then
371   case "$METHOD" in   case "$METHOD" in
372           "1")           "1")
373   #only for now later it will be used again   dialog_setup_system_menu
  #with 6.1-r2 only one install method available  
  #dialog_install_method  
  run_install_normal  
374   ;;   ;;
375   "2") dialog_setup_hdd_found_manuell   "2") dialog_setup_hdd_found_manuell
376   ;;   ;;
# Line 357  setup_hdd_partitions_manuell() { Line 395  setup_hdd_partitions_manuell() {
395   cfdisk $HDD || die   cfdisk $HDD || die
396  }  }
397    
398    setup_hdd_partitions_manuell_flash() {
399     ROOTHDD="${HDD}1"
400    
401     ## hdds partitionieren manuell
402     cfdisk $HDD || die
403    }
404    
405  setup_hdd_partitions_silent() {  setup_hdd_partitions_silent() {
406   ## hdds löschen   ## hdds löschen
407   dd if=/dev/zero of=$HDD bs=1024k count=1 || die   dd if=/dev/zero of=$HDD bs=1024k count=1 || die
# Line 372  setup_hdd_format() { Line 417  setup_hdd_format() {
417   mke2fs -j -q $ROOTHDD || die   mke2fs -j -q $ROOTHDD || die
418  }  }
419    
420    setup_hdd_format_flash() {
421     mke2fs -j -q $ROOTHDD || die
422    }
423    
424  install_mount_rootfs() {  install_mount_rootfs() {
425   swapon $SWAPHDD || die   swapon $SWAPHDD || die
426   mount $ROOTHDD $INSTALLPATH || die   mount $ROOTHDD $INSTALLPATH || die
# Line 380  install_mount_rootfs() { Line 429  install_mount_rootfs() {
429   cd $INSTALLPATH || die   cd $INSTALLPATH || die
430  }  }
431    
432    install_mount_rootfs_flash() {
433     mount $ROOTHDD $INSTALLPATH || die
434     install -d $INSTALLPATH/boot || die
435     cd $INSTALLPATH || die
436    }
437    
438  install_system_image() {  install_system_image() {
  #tar xvzpf $CDPATH/system/autosta_lx.tar.gz  
439   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}
440  }  }
441    
# Line 390  install_kernel_image() { Line 444  install_kernel_image() {
444   declare -i CPUTYPE=`cat /proc/cpuinfo |grep "cpu family"|cut -d ' ' -f3`   declare -i CPUTYPE=`cat /proc/cpuinfo |grep "cpu family"|cut -d ' ' -f3`
445    
446   if [ $CPUTYPE -le 5 ];then   if [ $CPUTYPE -le 5 ];then
                 #echo -e "\033[1;6m\033[36m""i386 Architektur gefunden.""\033[0m"  
                 #echo -e "Installiere i386 Kernel..."  
447    
448   lastdir="`pwd`"   lastdir="`pwd`"
449    
# Line 408  install_kernel_image() { Line 460  install_kernel_image() {
460   cd $lastdir || die   cd $lastdir || die
461    
462          elif [ $CPUTYPE -ge 6 ];then          elif [ $CPUTYPE -ge 6 ];then
                 #echo -e "\033[1;6m\033[36m""i686 Architektur gefunden.""\033[0m"  
                 #echo -e "Installiere i686 Kernel..."  
463    
464   lastdir="`pwd`"   lastdir="`pwd`"
465    
# Line 448  install_bootsector() { Line 498  install_bootsector() {
498    
499   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die
500   echo -e "timeout 03" >> $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  
501   echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die   echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die
502   echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die   echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die
503    
  #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:  
504   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die   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  
505    
506   ### bootsector schreiben   ### bootsector schreiben
  #grub --no-floppy < $CONFIGS_TEMPLATE/grubsettings || die  
507   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die
508  root (hd0,0)  root (hd0,0)
509  setup (hd0)  setup (hd0)
# Line 472  EOF Line 513  EOF
513    
514  install_bootsector_chroot() {  install_bootsector_chroot() {
515   ### grubconf schreiben   ### grubconf schreiben
  #source $INSTALLPATH/INSTALL/kernel/kernelversion  
516   source $INSTALLPATH/boot/kernelversion   source $INSTALLPATH/boot/kernelversion
517    
518   #for alx only   #for alx only
# Line 500  install_bootsector_chroot() { Line 540  install_bootsector_chroot() {
540   fi   fi
541    
542   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die
543   echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die   echo -e "timeout 0" >> $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  
544    
545   echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die   echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die
546   echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die   echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die
547    
  #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:  
548   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die   echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die
549    
  #not needed without bootsplash support  
  #echo -e "initrd=/boot/${KRNINITRD}" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
   
550   ### bootsector schreiben chrooted schreiben (gentoo)   ### bootsector schreiben chrooted schreiben (gentoo)
551   if [ -f $INSTALLPATH/sbin/grub ]   if [ -f $INSTALLPATH/sbin/grub ]
552   then   then
# Line 545  CHROOTEOF Line 575  CHROOTEOF
575    
576   ##enters chroot   ##enters chroot
577   mount -t proc none $INSTALLPATH/proc   mount -t proc none $INSTALLPATH/proc
  # bind /dev to get the devices right,  
  # if bootet from a 2.6 kernel with udev  
578   mount -o bind /dev $INSTALLPATH/dev   mount -o bind /dev $INSTALLPATH/dev
579   chroot $INSTALLPATH /bin/bash --rcfile /root/.bashrc -i   chroot $INSTALLPATH /bin/bash --rcfile /root/.bashrc -i
580   umount $INSTALLPATH/proc   umount $INSTALLPATH/proc
# Line 570  install_alxconfig(){ Line 598  install_alxconfig(){
598    
599  install_system_settings(){  install_system_settings(){
600   ### schreibe fstab   ### schreibe fstab
601   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
602   echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" >> $INSTALLPATH/etc/fstab || die   echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" >> $INSTALLPATH/etc/fstab || die
603   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
604   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
605    
  #deprecated  
  #echo -e "devpts\t/dev/pts\tdevpts\tgid=4,mode=620\t0 0" >> $INSTALLPATH/etc/fstab || die  
   
606   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
607   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
608  }  }
609    
610    install_system_settings_flash(){
611     ### schreibe fstab
612     echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" > $INSTALLPATH/etc/fstab || die
613     echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
614    
615     echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
616     echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die
617    }
618  install_hotfixes(){  install_hotfixes(){
619   if [ -f $CDPATH/hotfixes/hotfixes.sh ]   if [ -f $CDPATH/hotfixes/hotfixes.sh ]
620   then   then
# Line 598  install_umount_rootfs() { Line 631  install_umount_rootfs() {
631   swapoff $SWAPHDD || die   swapoff $SWAPHDD || die
632  }  }
633    
634    install_umount_rootfs_flash() {
635     cd /
636     umount $INSTALLPATH || die
637    }
638    
639  install_do_reboot() {  install_do_reboot() {
640    
  #only for now later it will be used again  
  #with 6.1-r2 these options are not available  
  #cd /  
  #umount $CDPATH  
  #eject  
  #clear  
   
641   reboot   reboot
642  }  }
643    
# Line 615  install_do_reboot() { Line 646  install_do_reboot() {
646  #################################################  #################################################
647    
648  run_install_normal() {  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  
649   dialog_setup_hdd_found_manuell   dialog_setup_hdd_found_manuell
650    
651   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions_manuell
# Line 626  run_install_normal() { Line 654  run_install_normal() {
654   install_mount_rootfs   install_mount_rootfs
655   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
656    
  #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  
   
657   dialog_install_bootsector   dialog_install_bootsector
658   install_bootsector_chroot   install_bootsector_chroot
659    
  #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  
   
660   dialog_install_settings   dialog_install_settings
661   sleep 1   sleep 1
662   install_system_settings   install_system_settings
# Line 648  run_install_normal() { Line 665  run_install_normal() {
665   dialog_install_successful   dialog_install_successful
666  }  }
667    
668    run_install_flash() {
669     dialog_setup_hdd_found_manuell
670    
671     dialog_setup_hdd_partitions_manuell_flash
672     dialog_setup_hdd_format
673     setup_hdd_format_flash > /dev/null
674     install_mount_rootfs_flash
675     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
676    
677    
678     dialog_install_bootsector
679     install_bootsector_chroot
680    
681     dialog_install_settings
682     sleep 1
683     install_system_settings_flash
684     install_hotfixes
685     install_umount_rootfs_flash
686     dialog_install_successful
687    }
688    
689  run_install_silent() {  run_install_silent() {
690   echo "starting silent install ..."   echo "starting silent install ..."
691   sleep 1   sleep 1

Legend:
Removed from v.261  
changed lines
  Added in v.519