Magellan Linux

Diff of /trunk/installer-simple/bin/installer.sh.in

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

revision 2439 by niro, Tue Jan 7 14:37:35 2014 UTC revision 2474 by niro, Wed Jan 8 08:55:40 2014 UTC
# Line 7  Line 7 
7  # Niels Rogalla <niro@magellan-linux.de>  # Niels Rogalla <niro@magellan-linux.de>
8  #  #
9    
10  # ignore the environment  # setup locales
11  LC_ALL=C  TEXTDOMAIN=installer
12    LC_MESSAGES=C
13    
14  # include dir  # include dir
15  INSTALLER_LIBDIR="%LIBDIR%"  INSTALLER_LIBDIR="%LIBDIR%"
16    
# Line 108  dialog_warning() Line 110  dialog_warning()
110   fi   fi
111  }  }
112    
 dialog_setup_hdd_info()  
 {  
  local SHDD="${HDD//\/dev\/}"  
   
  messagebox -h $"[ Harddrive partitioning ]" \  
  $"\nPlease create 1 partition.\n\n\[ \Z3${SHDD}1\Zn ] type: \Z3linux\Zn with the whole diskspace\n\Please mark ${SHDD}1 \Z3bootable\Zn."  
 }  
   
 dialog_setup_hdd_info_auto()  
 {  
  local SHDD="${HDD//\/dev\/}"  
   
  messagebox -h $"[ Harddrive partitioning ]" \  
  $"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!"  
 }  
   
113  dialog_setup_system_menu()  dialog_setup_system_menu()
114  {  {
115   local mode   local mode
# Line 180  dialog_hardware_detection() Line 166  dialog_hardware_detection()
166   zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;   zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
167   rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;   rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
168   maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;   maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
169   *) message+=$"\n \\ZnCommon device detected.\Zn" ;;   *) message+=$"\n\ZnCommon device detected.\Zn" ;;
170   esac   esac
171   if [[ ${FORMFACTOR} = laptop ]]   if [[ ${FORMFACTOR} = laptop ]]
172   then   then
173   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving  mode.\Zn"   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
174   fi   fi
175    
176   messagebox -y 15 -h $"Detected hardware:" "${message}"   messagebox -y 12 -h $"Detected hardware:" "${message}"
177  }  }
178    
179  dialog_setup_hdd_partitions_manual()  dialog_setup_hdd_partitions_manual()
# Line 253  dialog_main() Line 239  dialog_main()
239    
240   while [[ ${method} -le 2 ]]   while [[ ${method} -le 2 ]]
241   do   do
242   method=$(menubox $"Configuration:" \   method=$(CANCEL_LABEL=$"Exit" menubox $"Configuration:" \
243   $"1:Install system" \   $"1:Install system" \
244   $"2:Show detected harddrives" \   $"2:Show detected harddrives" \
245   $"3:Exit and reboot" \   $"3:Exit and reboot" \
# Line 468  install_system_image() Line 454  install_system_image()
454   popd > /dev/null   popd > /dev/null
455  }  }
456    
457  install_bootsector_chroot()  disabled_install_bootsector_chroot()
458  {  {
459   local my_roothdd   local my_roothdd
460   local grubconf=${INSTALLROOT}/boot/grub/grub.conf   local grubconf="${INSTALLROOT}/boot/grub/grub.conf"
461   local grub2conf=/boot/grub/grub.cfg   local grub2conf="/boot/grub/grub.cfg"
462    
463   # check for grub2   # check for grub2
464   if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]   if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]
# Line 488  install_bootsector_chroot() Line 474  install_bootsector_chroot()
474   then   then
475   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die
476   else   else
477   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLROOT}/etc/conf.d/grub || dialog_die   CONFIG="${INSTALLROOT}/etc/conf.d/grub"
478   fi   clearconfig
479   echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die   addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
480   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die   fi
481   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die   CONFIG="${INSTALLROOT}/root/.installrc"
482   echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die   clearconfig
483     # only grub 1.99
484     addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap'
485     addconfig "grub-install --no-floppy ${HDD} &> /dev/null"
486     addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"
487     addconfig "exit 0"
488    
489   # grub-legacy   # grub-legacy
490   else   else
  ### grubconf schreiben  
491   source ${INSTALLROOT}/boot/kernelversion   source ${INSTALLROOT}/boot/kernelversion
492    
  #for alx only  
493   if [ -e ${INSTALLROOT}/etc/alx_version ]   if [ -e ${INSTALLROOT}/etc/alx_version ]
494   then   then
495   OLD_ALXVER="${ALXVER}"   OLD_ALXVER="${ALXVER}"
# Line 514  install_bootsector_chroot() Line 503  install_bootsector_chroot()
503   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"   [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
504    
505   # uuid support   # uuid support
506   if is_uuid_supported   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
  then  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
  else  
  my_roothdd="${ROOTHDD}"  
  fi  
507    
508   : > ${grubconf} || dialog_die   CONFIG="${grubconf}"
509   echo "default 0" >> ${grubconf} || dialog_die   clearconfig
510   echo "timeout 3" >> ${grubconf} || dialog_die   addconfig "default 0"
511     addconfig "timeout 3"
512   # using current root password   # using current root password
513   echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || dialog_die   addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"
514    
515   echo  >> ${grubconf} || dialog_die   addconfig
516   echo "# normal boot" >> ${grubconf} || dialog_die   addconfig "# normal boot"
517   echo "title ${KRNVER}" >> ${grubconf} || dialog_die   addconfig "title ${KRNVER}"
518   echo "root (hd0,0)" >> ${grubconf} || dialog_die   addconfig "root (hd0,0)"
519   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || dialog_die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"
520   if is_initrd_supported   if is_initrd_supported
521   then   then
522   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die   addconfig "initrd /boot/${KRNINITRD}"
523   fi   fi
524    
525   echo >> ${grubconf} || dialog_die   addconfig
526   echo "# admin boot" >> ${grubconf} || dialog_die   addconfig "# admin boot"
527   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die   addconfig "title ${KRNVER} - Re-run hardware-detection"
528   echo "lock"  >> ${grubconf} || dialog_die   addconfig "lock"
529   echo "root (hd0,0)" >> ${grubconf} || dialog_die   addconfig "root (hd0,0)"
530   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"
531   if is_initrd_supported   if is_initrd_supported
532   then   then
533   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die   addconfig "initrd /boot/${KRNINITRD}"
534   fi   fi
535    
536   echo >> ${grubconf} || dialog_die   addconfig
537   echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die   addconfig "title ${KRNVER} - Reset *all* local settings"
538   echo "lock"  >> ${grubconf} || dialog_die   addconfig "lock"
539   echo "root (hd0,0)" >> ${grubconf} || dialog_die   addconfig "root (hd0,0)"
540   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die   addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"
541   if is_initrd_supported   if is_initrd_supported
542   then   then
543   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die   addconfig "initrd /boot/${KRNINITRD}"
544   fi   fi
545    
546   # bootsector schreiben chrooted schreiben (lfs/magellan)   # bootsector schreiben chrooted schreiben (lfs/magellan)
# Line 574  CHROOTEOF Line 559  CHROOTEOF
559   rm ${INSTALLROOT}/root/.installrc   rm ${INSTALLROOT}/root/.installrc
560  }  }
561    
562  install_initrd_chroot()  disabled_install_initrd_chroot()
563  {  {
564   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
565   is_initrd_supported || return 0   is_initrd_supported || return 0
# Line 602  install_initrd_chroot() Line 587  install_initrd_chroot()
587    
588   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
589   install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die   install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die
590   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die   CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf"
591     clearconfig
592     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
593    
594   # install an appropriate viafb.conf   # install an appropriate viafb.conf
595   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die   CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf"
596     clearconfig
597     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
598    
599   # install an appropriate i810fb.conf   # install an appropriate i810fb.conf
600   echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLROOT}/etc/modprobe.d/i810fb.conf || dialog_die   CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf"
601     clearconfig
602     addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
603    
604   cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF   cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF
605  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
# Line 621  CHROOTEOF Line 612  CHROOTEOF
612   rm ${INSTALLROOT}/root/.installrc   rm ${INSTALLROOT}/root/.installrc
613  }  }
614    
 is_uuid_supported()  
 {  
  if [[ -x $(type -P busybox.mkinitrd) ]]  
  then  
  # only detect uuids if supported  
  if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]  
  then  
  return 0  
  fi  
  fi  
   
  return 1  
 }  
   
615  install_system_settings()  install_system_settings()
616  {  {
617   # schreibe fstab   local CONFIG
618   if is_uuid_supported  
619   then   # write fstab
620   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die   CONFIG="${INSTALLROOT}/etc/fstab"
621   else   clearconfig
622   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1"
623   fi   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
624   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
  #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die  
  echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die  
  echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die  
625    
626   # install network config skeleton   # install network config skeleton
627   install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die   CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0"
628     clearconfig
629     addconfig 'ONBOOT="yes"'
630     addconfig 'NETWORKING="dhcp"'
631    
632   # intel framebufer quirk   # intel framebuffer quirk
633   if [[ -e /proc/fb ]]   if [ -e ${INSTALLROOT}/etc/splash/splash.conf ]
634   then   then
635   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]   if [ -e /proc/fb ]
636   then   then
637   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
  if [[ ${fbdev} != 0 ]]  
638   then   then
639   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
640     if [[ ${fbdev} != 0 ]]
641     then
642     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die
643     fi
644   fi   fi
645   fi   fi
646   fi   fi
# Line 694  run_install_normal() Line 674  run_install_normal()
674   dialog_install_settings   dialog_install_settings
675   sleep 1   sleep 1
676   install_system_settings   install_system_settings
677   dialog_install_initrd   if is_initrd_supported
678   install_initrd_chroot   then
679     dialog_install_initrd
680     initrd_config
681     initrd_install
682     fi
683    
684   dialog_install_bootsector   dialog_install_bootsector
685   install_bootsector_chroot   bootloader_config
686     bootloader_install
687    
688   install_umount_rootfs   install_umount_rootfs
689   dialog_install_successful   dialog_install_successful
# Line 717  run_install_auto() Line 702  run_install_auto()
702   dialog_install_settings   dialog_install_settings
703   sleep 1   sleep 1
704   install_system_settings   install_system_settings
705   dialog_install_initrd   if is_initrd_supported
706   install_initrd_chroot   then
707     dialog_install_initrd
708     initrd_config
709     initrd_install
710     fi
711    
712   dialog_install_bootsector   dialog_install_bootsector
713   install_bootsector_chroot   bootloader_config
714     bootloader_install
715    
716   install_umount_rootfs   install_umount_rootfs
717   dialog_install_successful   dialog_install_successful

Legend:
Removed from v.2439  
changed lines
  Added in v.2474