Magellan Linux

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

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

revision 2474 by niro, Wed Jan 8 08:55:40 2014 UTC revision 2480 by niro, Wed Jan 8 10:25:50 2014 UTC
# Line 110  dialog_warning() Line 110  dialog_warning()
110   fi   fi
111  }  }
112    
113  dialog_setup_system_menu()  task_setup_system_menu()
114  {  {
115   local mode   local mode
116   local retval   local retval
117    
118   mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \   mode="$(dialog_setup_system_menu)"
  $"1:Automatic setup (recommended)" \  
  ":" \  
  $":\Z1Expert modes:\Zn" \  
  $"2:Common IDE-disk (manual setup)")  
119   retval=$?   retval=$?
120   [[ ${retval} -eq 1 ]] && return 1   [[ ${retval} -eq 1 ]] && return 1
121   if [[ ${retval} -eq 0 ]]   if [[ ${retval} -eq 0 ]]
# Line 127  dialog_setup_system_menu() Line 123  dialog_setup_system_menu()
123   case "${mode}" in   case "${mode}" in
124   "1") run_install_auto ;;   "1") run_install_auto ;;
125   "2") run_install_normal ;;   "2") run_install_normal ;;
126   "") dialog_setup_system_menu;;   "") task_setup_system_menu;;
127   esac   esac
128   fi   fi
129  }  }
# Line 176  dialog_hardware_detection() Line 172  dialog_hardware_detection()
172   messagebox -y 12 -h $"Detected hardware:" "${message}"   messagebox -y 12 -h $"Detected hardware:" "${message}"
173  }  }
174    
175  dialog_setup_hdd_partitions_manual()  task_setup_hdd_partitions_manual()
176  {  {
177   local i   local i
178   local retval   local retval
# Line 197  dialog_setup_hdd_partitions_manual() Line 193  dialog_setup_hdd_partitions_manual()
193   fi   fi
194  }  }
195    
196  dialog_setup_hdd_partitions_auto()  task_setup_hdd_partitions_auto()
197  {  {
198   local i   local i
199   local retval   local retval
# Line 232  install_meter() Line 228  install_meter()
228   return 0   return 0
229  }  }
230    
231  dialog_main()  task_main()
232  {  {
233   local method=0   local method=0
234   local retval   local retval
235    
236   while [[ ${method} -le 2 ]]   while [[ ${method} -le 2 ]]
237   do   do
238   method=$(CANCEL_LABEL=$"Exit" menubox $"Configuration:" \   method=$(dialog_main)
  $"1:Install system" \  
  $"2:Show detected harddrives" \  
  $"3:Exit and reboot" \  
  $"4:Exit and drop into a shell")  
239   retval=$?   retval=$?
240   [[ ${retval} -eq 1 ]] && exit 1   [[ ${retval} -eq 1 ]] && exit 1
241   if [[ ${retval} -eq 0 ]]   if [[ ${retval} -eq 0 ]]
242   then   then
243   case ${method} in   case ${method} in
244   "1") dialog_setup_system_menu ;;   "1") task_setup_system_menu ;;
245   "2") dialog_hardware_detection ;;   "2") dialog_hardware_detection ;;
246   "3") install_do_reboot ;;   "3") install_do_reboot ;;
247   "4") /bin/bash --login -i ;;   "4") /bin/bash --login -i ;;
# Line 334  run_hardware_detection_disks() Line 326  run_hardware_detection_disks()
326   export ALL_CDROMS="$(get_hwinfo cdrom)"   export ALL_CDROMS="$(get_hwinfo cdrom)"
327  }  }
328    
 hdd_size_below_256mb()  
 {  
  local hdd="$1"  
  local size  
  local retval  
  [[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!"  
   
  size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')  
  if [[ ${size} -le 257000000 ]]  
  then  
  retval="0"  
  else  
  retval="1"  
  fi  
   
  return "${retval}"  
 }  
   
329  setup_hdd_partitions_auto()  setup_hdd_partitions_auto()
330  {  {
331   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
# Line 454  install_system_image() Line 428  install_system_image()
428   popd > /dev/null   popd > /dev/null
429  }  }
430    
 disabled_install_bootsector_chroot()  
 {  
  local my_roothdd  
  local grubconf="${INSTALLROOT}/boot/grub/grub.conf"  
  local grub2conf="/boot/grub/grub.cfg"  
   
  # check for grub2  
  if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]  
  then  
  # needed by grub-mkconfig on the first run  
  if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]]  
  then  
  install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die  
  fi  
   
  # set kernelopts  
  if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]]  
  then  
  sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die  
  else  
  CONFIG="${INSTALLROOT}/etc/conf.d/grub"  
  clearconfig  
  addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""  
  fi  
  CONFIG="${INSTALLROOT}/root/.installrc"  
  clearconfig  
  # only grub 1.99  
  addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap'  
  addconfig "grub-install --no-floppy ${HDD} &> /dev/null"  
  addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"  
  addconfig "exit 0"  
   
  # grub-legacy  
  else  
  source ${INSTALLROOT}/boot/kernelversion  
   
  if [ -e ${INSTALLROOT}/etc/alx_version ]  
  then  
  OLD_ALXVER="${ALXVER}"  
  source ${INSTALLROOT}/etc/alx_version  
  KRNVER="ALX-${ALXVER}"  
  ALXVER="${OLD_ALXVER}"  
  fi  
   
  [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"  
  [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"  
  [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"  
   
  # uuid support  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
   
  CONFIG="${grubconf}"  
  clearconfig  
  addconfig "default 0"  
  addconfig "timeout 3"  
  # using current root password  
  addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"  
   
  addconfig  
  addconfig "# normal boot"  
  addconfig "title ${KRNVER}"  
  addconfig "root (hd0,0)"  
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"  
  if is_initrd_supported  
  then  
  addconfig "initrd /boot/${KRNINITRD}"  
  fi  
   
  addconfig  
  addconfig "# admin boot"  
  addconfig "title ${KRNVER} - Re-run hardware-detection"  
  addconfig "lock"  
  addconfig "root (hd0,0)"  
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"  
  if is_initrd_supported  
  then  
  addconfig "initrd /boot/${KRNINITRD}"  
  fi  
   
  addconfig  
  addconfig "title ${KRNVER} - Reset *all* local settings"  
  addconfig "lock"  
  addconfig "root (hd0,0)"  
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"  
  if is_initrd_supported  
  then  
  addconfig "initrd /boot/${KRNINITRD}"  
  fi  
   
  # bootsector schreiben chrooted schreiben (lfs/magellan)  
  cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF  
 /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  
 root (hd0,0)  
 setup (hd0)  
 quit  
 EOF  
 exit 0  
 CHROOTEOF  
  fi  
   
  # run installrc  
  chrooted /bin/bash --rcfile /root/.installrc -i  
  rm ${INSTALLROOT}/root/.installrc  
 }  
   
 disabled_install_initrd_chroot()  
 {  
  # only generate initrds if the cmd exists  
  is_initrd_supported || return 0  
   
  DISKMODS="sd_mod"  
  OLDPATAMODS="amd74xx piix sis5513 via82cxxx"  
  PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"  
  SATAMODS="sata_via sata_sis sata_nv"  
  DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"  
  OTHERMODS=""  
  case ${SPECIALDEVICE} in  
  zotac_intel) FBMODS=""; DRMMODS="i915" ;;  
  zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;  
  rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards  
  # not working with kms enabled drivers -> segfaults  
  #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer  
  maxdata) FBMODS="" ;;  
  *) FBMODS="uvesafb" ;;  
  esac  
   
  if [[ ${FORMFACTOR} = laptop ]]  
  then  
  OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"  
  fi  
   
  # install an appropriate uvesafb.conf  
  install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf"  
  clearconfig  
  addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"  
   
  # install an appropriate viafb.conf  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf"  
  clearconfig  
  addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"  
   
  # install an appropriate i810fb.conf  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf"  
  clearconfig  
  addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  
   
  cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF  
 echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  
 mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null  
 exit 0  
 CHROOTEOF  
   
  # run installrc  
  chrooted /bin/bash --rcfile /root/.installrc -i  
  rm ${INSTALLROOT}/root/.installrc  
 }  
   
431  install_system_settings()  install_system_settings()
432  {  {
433   local CONFIG   local CONFIG
# Line 665  run_install_normal() Line 481  run_install_normal()
481  {  {
482   dialog_hardware_detection   dialog_hardware_detection
483    
484   dialog_setup_hdd_partitions_manual   task_setup_hdd_partitions_manual
485   dialog_setup_hdd_format   dialog_setup_hdd_format
486   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
487   install_mount_rootfs   install_mount_rootfs
# Line 693  run_install_auto() Line 509  run_install_auto()
509  {  {
510   dialog_hardware_detection   dialog_hardware_detection
511    
512   dialog_setup_hdd_partitions_auto   task_setup_hdd_partitions_auto
513   dialog_setup_hdd_format   dialog_setup_hdd_format
514   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
515   install_mount_rootfs   install_mount_rootfs
# Line 720  run_install_auto() Line 536  run_install_auto()
536  # set some proper traps  # set some proper traps
537  trap "trap_exit" SIGINT SIGQUIT  trap "trap_exit" SIGINT SIGQUIT
538    
539  dialog_main  task_main
540    
541  exit 0  exit 0

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