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 6843 by niro, Thu Jul 23 13:26:00 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 487  setup_hdd_partitions() Line 516  setup_hdd_partitions()
516   SWAPHDD=""   SWAPHDD=""
517   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
518   ;;   ;;
519    
520     flash)
521     BOOTHDD="${HDD}1"
522     SWAPHDD=""
523     ROOTHDD="${HDD}2"
524     ;;
525   esac   esac
526    
527   if [[ ${INSTALL_METHOD} = auto ]]   if [[ ${INSTALL_METHOD} = auto ]]
# Line 561  setup_hdd_format() Line 596  setup_hdd_format()
596   fi   fi
597   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
598   then   then
599   mkfs.${FORMAT_FILESYSTEM} -q ${BOOTHDD} || die   mkfs.${FORMAT_FILESYSTEM_BOOTHDD} -q ${BOOTHDD} || die
600   fi   fi
601   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
602   then   then
603   mkfs.${FORMAT_FILESYSTEM} -q ${ROOTHDD} || die   mkfs.${FORMAT_FILESYSTEM_ROOTHDD} -q ${ROOTHDD} || die
604   fi   fi
605  }  }
606    
607  install_mount_rootfs()  install_mount_rootfs()
608  {  {
609     local opts
610    
611   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
612   then   then
613   swapon ${SWAPHDD} || die   swapon ${SWAPHDD} || die
614   fi   fi
615   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
616   then   then
617   mount ${ROOTHDD} ${INSTALLPATH} || die   mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die
618   fi   fi
619   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
620   then   then
621   install -d ${INSTALLPATH}/boot || die   install -d ${INSTALL_ROOT}/boot || die
622   mount ${BOOTHDD} ${INSTALLPATH}/boot || die   mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die
623   fi   fi
624    
625   cd ${INSTALLPATH} || die   cd ${INSTALL_ROOT} || die
626  }  }
627    
628  install_system_image()  install_system_image()
629  {  {
630   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALL_ROOT}
631  }  }
632    
633  install_bootsector_chroot()  install_bootsector_chroot()
634  {  {
635   local my_roothdd   local my_roothdd
636   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   local grubconf=${INSTALL_ROOT}/boot/grub/grub.conf
637   local grub2conf=/boot/grub/grub.cfg   local grub2conf=/boot/grub/grub.cfg
638     local CONFIG
639    
640   # check for grub2   # check for grub2
641   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]   if [[ -f ${INSTALL_ROOT}/sbin/grub-mkconfig ]]
642   then   then
643   # needed by grub-mkconfig on the first run   # needed by grub-mkconfig on the first run
644   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]   if [[ ! -f ${INSTALL_ROOT}/boot/grub/video.lst ]]
645   then   then
646   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
647   fi   fi
648    
649   # set kernelopts   # set kernelopts
650   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALL_ROOT}/etc/conf.d/grub ]]
651   then   then
652   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
653   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
654   else   else
655   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die   CONFIG=${INSTALL_ROOT}/etc/conf.d/grub
656   echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die   clearconfig
657   fi   addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
658   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die   addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\""
659   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   fi
660   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die   CONFIG=${INSTALL_ROOT}/.installrc
661   echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die   clearconfig
662     addconfig 'grub-mkdevicemap'
663     addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"
664     addconfig "grub-install --no-floppy ${HDD} &> /dev/null"
665     addconfig "exit 0"
666    
667   # grub-legacy   # grub-legacy
668   else   else
669   ### grubconf schreiben   ### grubconf schreiben
670   source ${INSTALLPATH}/boot/kernelversion   source ${INSTALL_ROOT}/boot/kernelversion
671    
672   #for alx only   #for alx only
673   if [ -e ${INSTALLPATH}/etc/alx_version ]   if [ -e ${INSTALL_ROOT}/etc/alx_version ]
674   then   then
675   OLD_ALXVER="${ALXVER}"   OLD_ALXVER="${ALXVER}"
676   source ${INSTALLPATH}/etc/alx_version   source ${INSTALL_ROOT}/etc/alx_version
677   KRNVER="ALX-${ALXVER}"   KRNVER="ALX-${ALXVER}"
678   ALXVER="${OLD_ALXVER}"   ALXVER="${OLD_ALXVER}"
679   fi   fi
# Line 648  install_bootsector_chroot() Line 690  install_bootsector_chroot()
690   my_roothdd="${ROOTHDD}"   my_roothdd="${ROOTHDD}"
691   fi   fi
692    
693   : > ${grubconf} || die   CONFIG="${grubconf}"
694   echo "default 0" >> ${grubconf} || die   clearconfig
695   echo "timeout 3" >> ${grubconf} || die   addconfig "default 0"
696     addconfig "timeout 3"
697   # using current root password   # using current root password
698   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)"
699     addconfig
700   echo  >> ${grubconf} || die   addconfig "# normal boot"
701   echo "# normal boot" >> ${grubconf} || die   addconfig "title ${KRNVER}"
702   echo "title ${KRNVER}" >> ${grubconf} || die   addconfig "root (hd0,0)"
703   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  
704   if is_initrd_supported   if is_initrd_supported
705   then   then
706   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
707   fi   fi
708     addconfig
709   echo >> ${grubconf} || die   addconfig "# admin boot"
710   echo "# admin boot" >> ${grubconf} || die   addconfig "title ${KRNVER} - Re-run hardware-detection"
711   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   addconfig "lock"
712   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
713   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  
714   if is_initrd_supported   if is_initrd_supported
715   then   then
716   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
717   fi   fi
718     addconfig
719   echo >> ${grubconf} || die   addconfig "title ${KRNVER} - Reset *all* local settings"
720   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die   addconfig "lock"
721   echo "lock"  >> ${grubconf} || die   addconfig "root (hd0,0)"
722   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  
723   if is_initrd_supported   if is_initrd_supported
724   then   then
725   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   addconfig "initrd /boot/${KRNINITRD}"
726   fi   fi
727    
728   # write bootsector chrooted (lfs/magellan)   # write bootsector chrooted (lfs/magellan)
729   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   CONFIG=${INSTALL_ROOT}/.installrc
730  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   clearconfig
731  root (hd0,0)   addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null'
732  setup (hd0)   addconfig 'root (hd0,0)'
733  quit   addconfig 'setup (hd0)'
734  EOF   addconfig 'quit'
735  exit 0   addconfig 'EOF'
736  CHROOTEOF   addconfig 'exit 0'
737   fi   fi
738    
739   ## enters chroot   ## enter chroot
740   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  
741  }  }
742    
743  is_initrd_supported()  is_initrd_supported()
744  {  {
745   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
746   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0   [[ -x ${INSTALL_ROOT}/sbin/mkinitrd ]] && return 0
747   return 1   return 1
748  }  }
749    
750  install_initrd_chroot()  install_initrd_chroot()
751  {  {
752     local CONFIG
753    
754   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
755   is_initrd_supported || return 0   is_initrd_supported || return 0
756    
757     FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}"
758   DISKMODS="sd_mod"   DISKMODS="sd_mod"
759   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
760   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 777  install_initrd_chroot()
777   fi   fi
778    
779   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
780   install -d ${INSTALLPATH}/etc/modprobe.d || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/uvesafb.conf
781   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   clearconfig
782     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
783    
784   # install an appropriate viafb.conf   # install an appropriate viafb.conf
785   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die   CONFIG=${INSTALL_ROOT}/etc/modprobe.d/viafb.conf
786     clearconfig
787     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
788    
789   # install an appropriate i810fb.conf   # install an appropriate i810fb.conf
790   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
791     clearconfig
792   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
793  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  
794  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null   CONFIG=${INSTALL_ROOT}/.installrc
795  exit 0   clearconfig
796  CHROOTEOF   addconfig 'echo "MODULES=\"${FSMODS} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd'
797     addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null'
798   ## enters chroot   addconfig 'exit 0'
799   mount -t proc proc ${INSTALLPATH}/proc   ## enter chroot
800   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  
801  }  }
802    
803  is_uuid_supported()  is_uuid_supported()
804  {  {
805   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   # f2fs needs special treatments as the old busybox does not support this fs
806     # use the blkid from util-linux instead of busybox
807     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
808   then   then
809   # only detect uuids if supported   if [[ -x $(type -P blkid) ]]
810   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   then
811     return 0
812     fi
813     else
814     if [[ -x $(type -P busybox.mkinitrd) ]]
815   then   then
816   return 0   # only detect uuids if supported
817     if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
818     then
819     return 0
820     fi
821   fi   fi
822   fi   fi
823    
# Line 786  get_uuid() Line 829  get_uuid()
829   local UUID   local UUID
830   local SEC_TYPE   local SEC_TYPE
831   local TYPE   local TYPE
832     local blkidcmd
833    
834   local dev="$1"   local dev="$1"
835   [[ -z ${dev} ]] && die "no dev given"   [[ -z ${dev} ]] && die "no dev given"
# Line 795  get_uuid() Line 839  get_uuid()
839   then   then
840   eval "${dev}"   eval "${dev}"
841   else   else
842   eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')   # f2fs needs special treatments as the old busybox does not support this fs
843     # use the blkid from util-linux instead of busybox
844     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
845     then
846     blkidcmd="blkid"
847     else
848     blkidcmd="busybox.mkinitrd blkid"
849     fi
850     eval $(${blkidcmd} ${dev} | grep "${dev}:" | sed 's/.*:\ //')
851   fi   fi
852   echo "${UUID}"   echo "${UUID}"
853  }  }
854    
855  install_system_settings()  install_system_settings()
856  {  {
857   # schreibe fstab   local CONFIG
858   if is_uuid_supported   local fstype
859    
860     # write fstab
861     CONFIG=${INSTALL_ROOT}/etc/fstab
862     clearconfig
863    
864     if [[ -n ${BOOTHDD} ]]
865   then   then
866   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} ]]  
867   then   then
868   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"
869     else
870     addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
871   fi   fi
872   if [[ -n ${ROOTHDD} ]]   fi
873    
874     if [[ -n ${ROOTHDD} ]]
875     then
876     if is_uuid_supported
877   then   then
878   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"
879     else
880     addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
881   fi   fi
882   fi   fi
883    
884   # 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
885   #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"
886   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
887   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
888    
889   # install network config skeleton   # install network config skeleton
890   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
891    
892   # intel framebufer quirk   # intel framebufer quirk
893   if [[ -e /proc/fb ]]   if [[ -e /proc/fb ]]
# Line 839  install_system_settings() Line 897  install_system_settings()
897   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
898   if [[ ${fbdev} != 0 ]]   if [[ ${fbdev} != 0 ]]
899   then   then
900   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
901   fi   fi
902   fi   fi
903   fi   fi
# Line 850  install_umount_rootfs() Line 908  install_umount_rootfs()
908   cd /   cd /
909   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
910   then   then
911   umount ${INSTALLPATH}/boot || die   umount ${INSTALL_ROOT}/boot || die
912   fi   fi
913   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
914   then   then
915   umount ${INSTALLPATH} || die   umount ${INSTALL_ROOT} || die
916   fi   fi
917   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
918   then   then
# Line 885  run_install() Line 943  run_install()
943    
944   case "${method}" in   case "${method}" in
945   auto)   auto)
946     export FORMAT_FILESYSTEM_BOOTHDD=""
947     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
948   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
949   ;;   ;;
950   normal)   normal)
951     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
952     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
953   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
954   ;;   ;;
955   single)   single)
956     export FORMAT_FILESYSTEM_BOOTHDD=""
957     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
958     export INSTALL_METHOD="${method}"
959     ;;
960     flash)
961     export FORMAT_FILESYSTEM="f2fs"
962     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
963     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
964   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
965   ;;   ;;
966   *)   *)
967   echo "Unknown install method '${method}', aborting."   die "Unknown install method '${method}', aborting."
  exit 1  
968   ;;   ;;
969   esac   esac
970    
# Line 919  run_install() Line 988  run_install()
988   dialog_install_successful   dialog_install_successful
989  }  }
990    
991    # set some proper traps
992    trap "trap_exit" SIGINT SIGQUIT
993    
994  dialog_main  dialog_main
995    
996  exit 0  exit 0

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