Magellan Linux

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

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

revision 6828 by niro, Thu Jul 23 11:39:57 2015 UTC revision 6850 by niro, Thu Jul 23 14:23:44 2015 UTC
# Line 10  MLIBDIR="/usr/lib/alxinstall-ng" Line 10  MLIBDIR="/usr/lib/alxinstall-ng"
10  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
11    
12  # includes  # includes
13    source ${MLIBDIR}/functions/generic.sh
14  source ${MLIBDIR}/functions/hwdetection.sh  source ${MLIBDIR}/functions/hwdetection.sh
15    
16  ### System/Config Version  ### System/Config Version
# Line 18  TITLE="alxinstall-ng - ${VERSION}" Line 19  TITLE="alxinstall-ng - ${VERSION}"
19    
20  # locations  # locations
21  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
22  INSTALLPATH="/mnt/magellan"  INSTALL_ROOT="/mnt/magellan"
23    
24  # default system settings  # default system settings
25  # standard kernel opts  # standard kernel opts
# Line 43  GRUB2OPTS="" Line 44  GRUB2OPTS=""
44  GRUB2GFXPAYLOAD=""  GRUB2GFXPAYLOAD=""
45  FORMFACTOR=""  FORMFACTOR=""
46  FORMAT_FILESYSTEM=""  FORMAT_FILESYSTEM=""
47    FORMAT_FILESYSTEM_BOOTHDD=""
48    FORMAT_FILESYSTEM_ROOTHDD=""
49  FDISKPARTIONBELOW256MB=0  FDISKPARTIONBELOW256MB=0
50  SPECIALDEVICE=""  SPECIALDEVICE=""
51    FLASHDISK=0
52  ### linecount of system.tar.gz -1 !  ### linecount of system.tar.gz -1 !
53  CURRENTLINE=0  CURRENTLINE=0
54  #TOTALLINES=11072 # -> now in images.conf  #TOTALLINES=11072 # -> now in images.conf
# Line 58  die() Line 62  die()
62   ERROR=$1   ERROR=$1
63   RETVAL=$?   RETVAL=$?
64   dialog_install_failure   dialog_install_failure
65     trap_exit
66   exit 1   exit 1
67  }  }
68    
# Line 88  dialog_setup_hdd_info() Line 93  dialog_setup_hdd_info()
93   ;;   ;;
94   normal) dialog_setup_hdd_info_normal ;;   normal) dialog_setup_hdd_info_normal ;;
95   single) dialog_setup_hdd_info_single ;;   single) dialog_setup_hdd_info_single ;;
96     flash) dialog_setup_hdd_info_flash ;;
97   esac   esac
98  }  }
99    
# Line 121  dialog_setup_hdd_info_single() Line 127  dialog_setup_hdd_info_single()
127   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
128  }  }
129    
130    dialog_setup_hdd_info_flash()
131    {
132     local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
133    
134     dialog \
135     --colors \
136     --title "[ Festplatten Partitionierung ]" \
137     --backtitle "${TITLE}" \
138     --ok-label "Weiter" \
139     --msgbox "\nBitte legen Sie 2 Partitionen an.\n\n\
140     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\
141     [ \Z3${SHDD}2\Zn ] Typ: \Z3Linux \Zn mit dem Rest (min. 256MB)\n\n\
142     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
143    }
144    
145  dialog_setup_hdd_info_auto()  dialog_setup_hdd_info_auto()
146  {  {
147   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
# Line 145  dialog_setup_system_menu() Line 166  dialog_setup_system_menu()
166   --ok-label "Weiter" \   --ok-label "Weiter" \
167   --stdout \   --stdout \
168   --colors \   --colors \
169   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 6 \
170   "1" "Automatisches Setup (Empfohlen)" \   "1" "Automatisches Setup (Empfohlen)" \
171   "" "" \   "" "" \
172   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
173   "2" "Normale IDE-Disk (Manuell)" \   "2" "Normale IDE-Disk (Manuell)" \
174   "3" "Normale IDE Disk (Single)")   "3" "Normale IDE Disk (Single)" \
175     "4" "Flash SDHC/NAND oder USBStick (Manuell)")
176   RES=$?   RES=$?
177   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
178   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
# Line 159  dialog_setup_system_menu() Line 181  dialog_setup_system_menu()
181   "1") run_install auto ;;   "1") run_install auto ;;
182   "2") run_install normal ;;   "2") run_install normal ;;
183   "3") run_install single ;;   "3") run_install single ;;
184     "4") run_install flash ;;
185   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
186   esac   esac
187   fi   fi
# Line 169  dialog_hardware_detection() Line 192  dialog_hardware_detection()
192   local i   local i
193   local hwtmp   local hwtmp
194    
195   if [ -x $(which mktemp &> /dev/null) ]   if [ -x $(type -P mktemp) ]
196   then   then
197   hwtmp="$(mktemp)"   hwtmp="$(mktemp)"
198   else   else
# Line 217  dialog_hardware_detection() Line 240  dialog_hardware_detection()
240   then   then
241   echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}   echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
242   fi   fi
243     if [[ ${FLASHDISK} = 1 ]]
244     then
245     echo " \n \\ZnFlash Speicher erkannt, F2FS wird als Dateisystem benutzt.\\Zn \\" >> ${hwtmp}
246     fi
247    
248   echo " \" 14 70" >> ${hwtmp}   echo " \" 14 70" >> ${hwtmp}
249   chmod a+x ${hwtmp}   chmod a+x ${hwtmp}
# Line 344  dialog_main() Line 371  dialog_main()
371   --no-cancel \   --no-cancel \
372   --ok-label "Weiter" \   --ok-label "Weiter" \
373   --stdout \   --stdout \
374   --menu "Konfiguration" 14 70 5 \   --menu "Konfiguration" 14 70 6 \
375   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
376   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
377   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
# Line 381  run_hardware_detection() Line 408  run_hardware_detection()
408   if [[ $(< ${i}) = 1 ]]   if [[ $(< ${i}) = 1 ]]
409   then   then
410   removable=1   removable=1
411     # we assume that all removable disks are flash disks
412     export FLASHDISK=1
413   fi   fi
414   done   done
415    
# Line 476  hdd_size_below_256mb() Line 505  hdd_size_below_256mb()
505  setup_hdd_partitions()  setup_hdd_partitions()
506  {  {
507   case "${INSTALL_METHOD}" in   case "${INSTALL_METHOD}" in
508     auto)
509     if [[ ${FLASHDISK} =1 ]]
510     then
511     BOOTHDD="${HDD}1"
512     SWAPHDD=""
513     ROOTHDD="${HDD}2"
514     else
515     BOOTHDD=""
516     SWAPHDD=""
517     ROOTHDD="${HDD}1"
518     fi
519     ;;
520    
521   normal)   normal)
522   BOOTHDD="${HDD}1"   BOOTHDD="${HDD}1"
523   SWAPHDD="${HDD}2"   SWAPHDD="${HDD}2"
524   ROOTHDD="${HDD}3"   ROOTHDD="${HDD}3"
525   ;;   ;;
526    
527   single|auto)   single)
528   BOOTHDD=""   BOOTHDD=""
529   SWAPHDD=""   SWAPHDD=""
530   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
531   ;;   ;;
532    
533     flash)
534     BOOTHDD="${HDD}1"
535     SWAPHDD=""
536     ROOTHDD="${HDD}2"
537     ;;
538   esac   esac
539    
540   if [[ ${INSTALL_METHOD} = auto ]]   if [[ ${INSTALL_METHOD} = auto ]]
# Line 505  setup_hdd_partitions() Line 553  setup_hdd_partitions()
553   ## delete disk   ## delete disk
554   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
555    
556   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FLASHDISK} = 1 ]]
557   then   then
558   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
559   #1. n= new disk   then
560   #2. p= primary disk   ## setup one bootable partition
561   #3. 1= first partition   # 1. n= new disk
562   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   # 2. p= primary disk
563   #5. ''= defaul sector end   # 3. 1= first partition
564   #6. a= bootable flag   # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
565   #7. 1= boot flag for partition 1   # 5. ''= defaul sector end
566   #8. w= write/quit   # 6. a= bootable flag
567   fdisk ${HDD} &> /dev/null << EOF   # 7. 1= boot flag for partition 1
568     # 8. n= new disk
569     #10. p= primary disk
570     #11. 2= second partition
571     #12. ''= default sector start
572     #13. ''= defaul sector end
573     #14. w= write/quit
574     fdisk ${HDD} &> /dev/null << EOF
575  n  n
576  p  p
577  1  1
578  2  2
579    +50M
580    a
581    1
582    n
583    p
584    2
585    
586    
587    w
588    EOF
589     else
590     ## setup one bootable partition
591     # 1. n= new disk
592     # 2. p= primary disk
593     # 3. 1= first partition
594     # 4. ''= default sector start
595     # 5. ''= defaul sector end
596     # 6. a= bootable flag
597     # 7. 1= boot flag for partition 1
598     # 8. n= new disk
599     #10. p= primary disk
600     #11. 2= second partition
601     #12. ''= default sector start
602     #13. ''= defaul sector end
603     #14. w= write/quit
604     fdisk ${HDD} &> /dev/null << EOF
605    n
606    p
607    1
608    
609    +50M
610  a  a
611  1  1
612    n
613    p
614    2
615    
616    
617  w  w
618  EOF  EOF
619     fi
620   else   else
621   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
622   #1. n= new disk   then
623   #2. p= primary disk   ## setup one bootable partition
624   #3. 1= first partition   #1. n= new disk
625   #4. ''= default sector start   #2. p= primary disk
626   #5. ''= defaul sector end   #3. 1= first partition
627   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
628   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
629   #8. w= write/quit   #6. a= bootable flag
630   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
631     #8. w= write/quit
632     fdisk ${HDD} &> /dev/null << EOF
633    n
634    p
635    1
636    2
637    
638    a
639    1
640    w
641    EOF
642     else
643     ## setup one bootable partition
644     #1. n= new disk
645     #2. p= primary disk
646     #3. 1= first partition
647     #4. ''= default sector start
648     #5. ''= defaul sector end
649     #6. a= bootable flag
650     #7. 1= boot flag for partition 1
651     #8. w= write/quit
652     fdisk ${HDD} &> /dev/null << EOF
653  n  n
654  p  p
655  1  1
# Line 546  a Line 659  a
659  1  1
660  w  w
661  EOF  EOF
662     fi
663   fi   fi
664   else   else
665   ## hdds partitionieren manuell   ## hdds partitionieren manuell
# Line 555  EOF Line 669  EOF
669    
670  setup_hdd_format()  setup_hdd_format()
671  {  {
672     install -d /tmp
673     :> /tmp/format.log
674    
675   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
676   then   then
677   mkswap ${SWAPHDD} || die   mkswap ${SWAPHDD} || die
678   fi   fi
679   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
680   then   then
681   mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die   mkfs.${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} &> /tmp/format.log || die
682   fi   fi
683   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
684   then   then
685   mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die   mkfs.${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} &> /tmp/format.log || die
686   fi   fi
687  }  }
688    
689  install_mount_rootfs()  install_mount_rootfs()
690  {  {
691     local opts
692    
693   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
694   then   then
695   swapon ${SWAPHDD} || die   swapon ${SWAPHDD} || die
696   fi   fi
697   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
698   then   then
699   mount ${ROOTHDD} ${INSTALLPATH} || die   mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die
700   fi   fi
701   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
702   then   then
703   install -d ${INSTALLPATH}/boot || die   install -d ${INSTALL_ROOT}/boot || die
704   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die
705   fi   fi
706    
707   cd ${INSTALLPATH} || die   cd ${INSTALL_ROOT} || die
708  }  }
709    
710  install_system_image()  install_system_image()
711  {  {
712   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALL_ROOT}
713  }  }
714    
715  install_bootsector_chroot()  install_bootsector_chroot()
716  {  {
717   local my_roothdd   local my_roothdd
718   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   local grubconf=${INSTALL_ROOT}/boot/grub/grub.conf
719   local grub2conf=/boot/grub/grub.cfg   local grub2conf=/boot/grub/grub.cfg
720     local CONFIG
721    
722   # check for grub2   # check for grub2
723   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]   if [[ -f ${INSTALL_ROOT}/sbin/grub-mkconfig ]]
724   then   then
725   # needed by grub-mkconfig on the first run   # needed by grub-mkconfig on the first run
726   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]   if [[ ! -f ${INSTALL_ROOT}/boot/grub/video.lst ]]
727   then   then
728   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die   install -m0644 ${INSTALL_ROOT}/lib/grub/*/video.lst ${INSTALL_ROOT}/boot/grub/video.lst || die
729   fi   fi
730    
731   # set kernelopts   # set kernelopts
732   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALL_ROOT}/etc/conf.d/grub ]]
733   then   then
734   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
735   sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die   sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
736   else   else
737   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die   CONFIG=${INSTALL_ROOT}/etc/conf.d/grub
738   echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die   clearconfig
739     addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
740     addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\""
741   fi   fi
742   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die   CONFIG=${INSTALL_ROOT}/.installrc
743   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   clearconfig
744   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   addconfig 'grub-mkdevicemap'
745   echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die   addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"
746     addconfig "grub-install --no-floppy ${HDD} &> /dev/null"
747     addconfig "exit 0"
748    
749   # grub-legacy   # grub-legacy
750   else   else
751   ### grubconf schreiben   ### grubconf schreiben
752   source ${INSTALLPATH}/boot/kernelversion   source ${INSTALL_ROOT}/boot/kernelversion
753    
754   #for alx only   #for alx only
755   if [ -e ${INSTALLPATH}/etc/alx_version ]   if [ -e ${INSTALL_ROOT}/etc/alx_version ]
756   then   then
757   OLD_ALXVER="${ALXVER}"   OLD_ALXVER="${ALXVER}"
758   source ${INSTALLPATH}/etc/alx_version   source ${INSTALL_ROOT}/etc/alx_version
759   KRNVER="ALX-${ALXVER}"   KRNVER="ALX-${ALXVER}"
760   ALXVER="${OLD_ALXVER}"   ALXVER="${OLD_ALXVER}"
761   fi   fi
# Line 648  install_bootsector_chroot() Line 772  install_bootsector_chroot()
772   my_roothdd="${ROOTHDD}"   my_roothdd="${ROOTHDD}"
773   fi   fi
774    
775   : > ${grubconf} || die   CONFIG="${grubconf}"
776   echo "default 0" >> ${grubconf} || die   clearconfig
777   echo "timeout 3" >> ${grubconf} || die   addconfig "default 0"
778     addconfig "timeout 3"
779   # using current root password   # using current root password
780   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   addconfig "password --md5 $(cat ${INSTALL_ROOT}/etc/shadow | grep root | cut -d: -f2)"
781     addconfig
782   echo  >> ${grubconf} || die   addconfig "# normal boot"
783   echo "# normal boot" >> ${grubconf} || die   addconfig "title ${KRNVER}"
784   echo "title ${KRNVER}" >> ${grubconf} || die   addconfig "root (hd0,0)"
785   echo "root (hd0,0)" >> ${grubconf} || die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die  
786   if is_initrd_supported   if is_initrd_supported
787   then   then
788   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
789   fi   fi
790     addconfig
791   echo >> ${grubconf} || die   addconfig "# admin boot"
792   echo "# admin boot" >> ${grubconf} || die   addconfig "title ${KRNVER} - Re-run hardware-detection"
793   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   addconfig "lock"
794   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
795   echo "root (hd0,0)" >> ${grubconf} || die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die  
796   if is_initrd_supported   if is_initrd_supported
797   then   then
798   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
799   fi   fi
800     addconfig
801   echo >> ${grubconf} || die   addconfig "title ${KRNVER} - Reset *all* local settings"
802   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   addconfig "lock"
803   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
804   echo "root (hd0,0)" >> ${grubconf} || die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die  
805   if is_initrd_supported   if is_initrd_supported
806   then   then
807   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
808   fi   fi
809    
810   # write bootsector chrooted (lfs/magellan)   # write bootsector chrooted (lfs/magellan)
811   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   CONFIG=${INSTALL_ROOT}/.installrc
812  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   clearconfig
813  root (hd0,0)   addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null'
814  setup (hd0)   addconfig 'root (hd0,0)'
815  quit   addconfig 'setup (hd0)'
816  EOF   addconfig 'quit'
817  exit 0   addconfig 'EOF'
818  CHROOTEOF   addconfig 'exit 0'
819   fi   fi
820    
821   ## enters chroot   ## enter chroot
822   mount -t proc proc ${INSTALLPATH}/proc   enter_chroot_installrc
  mount -t sysfs sysfs ${INSTALLPATH}/sys  
  mount -o bind /dev ${INSTALLPATH}/dev  
  chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i  
  umount ${INSTALLPATH}/proc  
  umount ${INSTALLPATH}/sys  
  umount ${INSTALLPATH}/dev  
  rm ${INSTALLPATH}/root/.installrc  
823  }  }
824    
825  is_initrd_supported()  is_initrd_supported()
826  {  {
827   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
828   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0   [[ -x ${INSTALL_ROOT}/sbin/mkinitrd ]] && return 0
829   return 1   return 1
830  }  }
831    
832  install_initrd_chroot()  install_initrd_chroot()
833  {  {
834     local CONFIG
835    
836   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
837   is_initrd_supported || return 0   is_initrd_supported || return 0
838    
839     FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}"
840   DISKMODS="sd_mod"   DISKMODS="sd_mod"
841   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
842   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
# Line 741  install_initrd_chroot() Line 859  install_initrd_chroot()
859   fi   fi
860    
861   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
862   install -d ${INSTALLPATH}/etc/modprobe.d || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/uvesafb.conf
863   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   clearconfig
864     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
865    
866   # install an appropriate viafb.conf   # install an appropriate viafb.conf
867   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/viafb.conf
868     clearconfig
869     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
870    
871   # install an appropriate i810fb.conf   # install an appropriate i810fb.conf
872   echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/i810fb.conf
873     clearconfig
874   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
875  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  
876  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null   CONFIG=${INSTALL_ROOT}/.installrc
877  exit 0   clearconfig
878  CHROOTEOF   addconfig "echo \"MODULES=\\\"${FSMODS} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\\\"\" > /etc/conf.d/mkinitrd"
879     addconfig "mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null"
880   ## enters chroot   addconfig "exit 0"
881   mount -t proc proc ${INSTALLPATH}/proc   ## enter chroot
882   mount -t sysfs sysfs ${INSTALLPATH}/sys   enter_chroot_installrc
  mount -o bind /dev ${INSTALLPATH}/dev  
  chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i  
  umount ${INSTALLPATH}/proc  
  umount ${INSTALLPATH}/sys  
  umount ${INSTALLPATH}/dev  
  rm ${INSTALLPATH}/root/.installrc  
883  }  }
884    
885  is_uuid_supported()  is_uuid_supported()
886  {  {
887   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   # f2fs needs special treatments as the old busybox does not support this fs
888     # use the blkid from util-linux instead of busybox
889     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
890   then   then
891   # only detect uuids if supported   if [[ -x $(type -P blkid) ]]
892   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   then
893     return 0
894     fi
895     else
896     if [[ -x $(type -P busybox.mkinitrd) ]]
897   then   then
898   return 0   # only detect uuids if supported
899     if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
900     then
901     return 0
902     fi
903   fi   fi
904   fi   fi
905    
# Line 786  get_uuid() Line 911  get_uuid()
911   local UUID   local UUID
912   local SEC_TYPE   local SEC_TYPE
913   local TYPE   local TYPE
914     local blkidcmd
915    
916   local dev="$1"   local dev="$1"
917   [[ -z ${dev} ]] && die "no dev given"   [[ -z ${dev} ]] && die "no dev given"
# Line 795  get_uuid() Line 921  get_uuid()
921   then   then
922   eval "${dev}"   eval "${dev}"
923   else   else
924   eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')   # f2fs needs special treatments as the old busybox does not support this fs
925     # use the blkid from util-linux instead of busybox
926     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
927     then
928     blkidcmd="blkid"
929     else
930     blkidcmd="busybox.mkinitrd blkid"
931     fi
932     eval $(${blkidcmd} ${dev} | grep "${dev}:" | sed 's/.*:\ //')
933   fi   fi
934   echo "${UUID}"   echo "${UUID}"
935  }  }
936    
937  install_system_settings()  install_system_settings()
938  {  {
939   # schreibe fstab   local CONFIG
940   if is_uuid_supported   local fstype
941    
942     # write fstab
943     CONFIG=${INSTALL_ROOT}/etc/fstab
944     clearconfig
945    
946     if [[ -n ${BOOTHDD} ]]
947   then   then
948   if [[ -n ${BOOTHDD} ]]   if is_uuid_supported
  then  
  echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die  
  fi  
  if [[ -n ${ROOTHDD} ]]  
  then  
  echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  fi  
  else  
  if [[ -n ${BOOTHDD} ]]  
949   then   then
950   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
951     else
952     addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
953   fi   fi
954   if [[ -n ${ROOTHDD} ]]   fi
955    
956     if [[ -n ${ROOTHDD} ]]
957     then
958     if is_uuid_supported
959   then   then
960   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
961     else
962     addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
963   fi   fi
964   fi   fi
965    
966   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   # not needed busybox loads all with swapon -a, even if not mentioned in fstab
967   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die   #addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
968   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
969   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
970    
971   # install network config skeleton   # install network config skeleton
972   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die   install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die
973    
974   # intel framebufer quirk   # intel framebufer quirk
975   if [[ -e /proc/fb ]]   if [[ -e /proc/fb ]]
# Line 839  install_system_settings() Line 979  install_system_settings()
979   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
980   if [[ ${fbdev} != 0 ]]   if [[ ${fbdev} != 0 ]]
981   then   then
982   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALL_ROOT}/etc/splash/splash.conf || die
983   fi   fi
984   fi   fi
985   fi   fi
# Line 850  install_umount_rootfs() Line 990  install_umount_rootfs()
990   cd /   cd /
991   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
992   then   then
993   umount ${INSTALLPATH}/boot || die   umount ${INSTALL_ROOT}/boot || die
994   fi   fi
995   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
996   then   then
997   umount ${INSTALLPATH} || die   umount ${INSTALL_ROOT} || die
998   fi   fi
999   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
1000   then   then
# Line 885  run_install() Line 1025  run_install()
1025    
1026   case "${method}" in   case "${method}" in
1027   auto)   auto)
1028     if [[ ${FLASHDISK} = 1 ]]
1029     then
1030     export FORMAT_FILESYSTEM="f2fs"
1031     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1032     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1033     else
1034     export FORMAT_FILESYSTEM_BOOTHDD=""
1035     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1036     fi
1037   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1038   ;;   ;;
1039   normal)   normal)
1040     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
1041     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1042   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1043   ;;   ;;
1044   single)   single)
1045     export FORMAT_FILESYSTEM_BOOTHDD=""
1046     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1047     export INSTALL_METHOD="${method}"
1048     ;;
1049     flash)
1050     export FORMAT_FILESYSTEM="f2fs"
1051     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
1052     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
1053   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
1054   ;;   ;;
1055   *)   *)
1056   echo "Unknown install method '${method}', aborting."   die "Unknown install method '${method}', aborting."
  exit 1  
1057   ;;   ;;
1058   esac   esac
1059    
# Line 919  run_install() Line 1077  run_install()
1077   dialog_install_successful   dialog_install_successful
1078  }  }
1079    
1080    # set some proper traps
1081    trap "trap_exit" SIGINT SIGQUIT
1082    
1083  dialog_main  dialog_main
1084    
1085  exit 0  exit 0

Legend:
Removed from v.6828  
changed lines
  Added in v.6850