Magellan Linux

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

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

revision 2480 by niro, Wed Jan 8 10:25:50 2014 UTC revision 2491 by niro, Wed Jan 8 12:22:26 2014 UTC
# Line 72  SPECIALDEVICE="" Line 72  SPECIALDEVICE=""
72  FORMFACTOR="${DEFAULT_FORMFACTOR}"  FORMFACTOR="${DEFAULT_FORMFACTOR}"
73  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
74    
75  #################################################  
76  #  DIALOG BOXEN #  ### helper scripts ###
 #################################################  
77    
78  trap_exit()  trap_exit()
79  {  {
# Line 88  trap_exit() Line 87  trap_exit()
87   exit 1   exit 1
88  }  }
89    
 dialog_die()  
 {  
  ERROR="$1"  
  RETVAL="$?"  
  dialog_install_failure  
  exit 1  
 }  
   
 dialog_warning()  
 {  
  local retval  
   
  yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"  
  retval=$?  
  if [[ ${retval} -eq 1 ]]  
  then  
  clear  
  echo $"The process was aborted."  
  exit 1  
  fi  
 }  
   
 task_setup_system_menu()  
 {  
  local mode  
  local retval  
   
  mode="$(dialog_setup_system_menu)"  
  retval=$?  
  [[ ${retval} -eq 1 ]] && return 1  
  if [[ ${retval} -eq 0 ]]  
  then  
  case "${mode}" in  
  "1") run_install_auto ;;  
  "2") run_install_normal ;;  
  "") task_setup_system_menu;;  
  esac  
  fi  
 }  
   
 dialog_hardware_detection()  
 {  
  local message  
   
  run_hardware_detection_disks  
   
  message+=$"Harddrives:\n"  
   
  if [[ ! -z ${ALL_DISKS} ]]  
  then  
  for i in ${ALL_DISKS}  
  do  
  message+="\Z3${i}\Zn "  
  done  
  message+="\n"  
  fi  
   
  if [[ ! -z ${ALL_CDROMS} ]]  
  then  
  message+="\n"  
  message+=$"Optical disk drives:\n"  
  for i in ${ALL_CDROMS}  
  do  
  message+="\Z3${i}\Zn"  
  done  
  message+="\n"  
  fi  
   
  # other devices  
  run_hardware_detection  
  case "${SPECIALDEVICE}" in  
  zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;  
  rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;  
  maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;  
  *) message+=$"\n\ZnCommon device detected.\Zn" ;;  
  esac  
  if [[ ${FORMFACTOR} = laptop ]]  
  then  
  message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"  
  fi  
   
  messagebox -y 12 -h $"Detected hardware:" "${message}"  
 }  
   
 task_setup_hdd_partitions_manual()  
 {  
  local i  
  local retval  
   
  if [[ -z ${ALL_DISKS} ]]  
  then  
  dialog_no_harddrive_found  
  exit 1  
  else  
  HDD=$(dialog_select_target_harddrive)  
  retval=$?  
  [[ ${retval} -eq 1 ]] && return 1  
  if [[ ${retval} -eq 0 ]]  
  then  
  dialog_setup_hdd_info  
  setup_hdd_partitions_manual  
  fi  
  fi  
 }  
   
 task_setup_hdd_partitions_auto()  
 {  
  local i  
  local retval  
   
  if [[ -z ${ALL_DISKS} ]]  
  then  
  dialog_no_harddrive_found  
  exit 1  
  else  
  HDD=$(dialog_select_target_harddrive)  
  retval=$?  
  [[ ${retval} -eq 1 ]] && return 1  
  if [[ ${retval} -eq 0 ]]  
  then  
  dialog_setup_hdd_info_auto  
  dialog_setup_hdd_create_partitions  
  setup_hdd_partitions_auto  
  fi  
  fi  
 }  
   
90  install_meter()  install_meter()
91  {  {
92   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
# Line 228  install_meter() Line 100  install_meter()
100   return 0   return 0
101  }  }
102    
103  task_main()  mount_rootfs()
104  {  {
  local method=0  
105   local retval   local retval
106    
107   while [[ ${method} -le 2 ]]   if is_mounted --location "${INSTALLROOT}"
108   do   then
109   method=$(dialog_main)   echo $"${INSTALLROOT} already mounted" >&2
110   retval=$?   else
111   [[ ${retval} -eq 1 ]] && exit 1   mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive'${ROOTHDD}' -> '${INSTALLROOT}'"
112   if [[ ${retval} -eq 0 ]]   fi
113   then   [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot
114   case ${method} in  }
115   "1") task_setup_system_menu ;;  
116   "2") dialog_hardware_detection ;;  umount_rootfs()
117   "3") install_do_reboot ;;  {
118   "4") /bin/bash --login -i ;;   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot
119   esac   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}
120   fi  }
121   done  
122    install_do_reboot()
123    {
124     reboot
125  }  }
126    
 #################################################  
 # Install Komandos #  
 #################################################  
127  run_hardware_detection()  run_hardware_detection()
128  {  {
129   local hwinfo   local hwinfo
# Line 340  setup_hdd_partitions_auto() Line 211  setup_hdd_partitions_auto()
211   # run this only if FDISKPARTITIONBELOW256MB is not already 1   # run this only if FDISKPARTITIONBELOW256MB is not already 1
212   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
213   then   then
214   if hdd_size_below_256mb ${HDD}   if device_minimum_size "${HDD}" 256
215   then   then
216   FDISKPARTIONBELOW256MB=1   FDISKPARTIONBELOW256MB=1
217   else   else
# Line 415  setup_hdd_format() Line 286  setup_hdd_format()
286   mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die   mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die
287  }  }
288    
 install_mount_rootfs()  
 {  
  is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}"  
  install -d ${INSTALLROOT}/boot || dialog_die  
 }  
   
289  install_system_image()  install_system_image()
290  {  {
291   pushd ${INSTALLROOT} > /dev/null   pushd ${INSTALLROOT} > /dev/null
# Line 462  install_system_settings() Line 327  install_system_settings()
327   fi   fi
328  }  }
329    
330  install_umount_rootfs()  
331    ### installer dialogs ###
332    
333    dialog_die()
334  {  {
335   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot   ERROR="$1"
336   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}   RETVAL="$?"
337     dialog_install_failure
338     exit 1
339  }  }
340    
341  install_do_reboot()  dialog_warning()
342  {  {
343   reboot   local retval
344    
345     yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"
346     retval=$?
347     if [[ ${retval} -eq 1 ]]
348     then
349     clear
350     echo $"The process was aborted."
351     exit 1
352     fi
353  }  }
354    
355  #################################################  
356  #     Install Ablauf Scripte #  ### installer tasks ###
357  #################################################  
358    task_setup_system_menu()
359    {
360     local mode
361     local retval
362    
363     mode="$(dialog_setup_system_menu)"
364     retval=$?
365     [[ ${retval} -eq 1 ]] && return 1
366     if [[ ${retval} -eq 0 ]]
367     then
368     case "${mode}" in
369     "1") run_install_auto ;;
370     "2") run_install_normal ;;
371     "") task_setup_system_menu;;
372     esac
373     fi
374    }
375    
376    task_hardware_detection()
377    {
378     local message
379    
380     run_hardware_detection_disks
381    
382     message+=$"Harddrives:\n"
383    
384     if [[ ! -z ${ALL_DISKS} ]]
385     then
386     for i in ${ALL_DISKS}
387     do
388     message+="\Z3${i}\Zn "
389     done
390     message+="\n"
391     fi
392    
393     if [[ ! -z ${ALL_CDROMS} ]]
394     then
395     message+="\n"
396     message+=$"Optical disk drives:\n"
397     for i in ${ALL_CDROMS}
398     do
399     message+="\Z3${i}\Zn"
400     done
401     message+="\n"
402     fi
403    
404     # other devices
405     run_hardware_detection
406     case "${SPECIALDEVICE}" in
407     zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
408     rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
409     maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
410     *) message+=$"\n\ZnCommon device detected.\Zn" ;;
411     esac
412     if [[ ${FORMFACTOR} = laptop ]]
413     then
414     message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
415     fi
416    
417     messagebox -y 12 -h $"Detected hardware:" "${message}"
418    }
419    
420    task_setup_hdd_partitions_manual()
421    {
422     local i
423     local retval
424    
425     if [[ -z ${ALL_DISKS} ]]
426     then
427     dialog_no_harddrive_found
428     exit 1
429     else
430     HDD=$(dialog_select_target_harddrive)
431     retval=$?
432     [[ ${retval} -eq 1 ]] && return 1
433     if [[ ${retval} -eq 0 ]]
434     then
435     dialog_setup_hdd_info
436     setup_hdd_partitions_manual
437     fi
438     fi
439    }
440    
441    task_setup_hdd_partitions_auto()
442    {
443     local i
444     local retval
445    
446     if [[ -z ${ALL_DISKS} ]]
447     then
448     dialog_no_harddrive_found
449     exit 1
450     else
451     HDD=$(dialog_select_target_harddrive)
452     retval=$?
453     [[ ${retval} -eq 1 ]] && return 1
454     if [[ ${retval} -eq 0 ]]
455     then
456     dialog_setup_hdd_info_auto
457     dialog_setup_hdd_create_partitions
458     setup_hdd_partitions_auto
459     fi
460     fi
461    }
462    
463    task_main()
464    {
465     local method=0
466     local retval
467    
468     while [[ ${method} -le 2 ]]
469     do
470     method=$(dialog_main)
471     retval=$?
472     [[ ${retval} -eq 1 ]] && exit 1
473     if [[ ${retval} -eq 0 ]]
474     then
475     case ${method} in
476     "1") task_setup_system_menu ;;
477     "2") task_hardware_detection ;;
478     "3") install_do_reboot ;;
479     "4") /bin/bash --login -i ;;
480     esac
481     fi
482     done
483    }
484    
485  run_install_normal()  run_install_normal()
486  {  {
487   dialog_hardware_detection   task_hardware_detection
488    
489   task_setup_hdd_partitions_manual   task_setup_hdd_partitions_manual
490   dialog_setup_hdd_format   dialog_setup_hdd_format
491   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
492   install_mount_rootfs   mount_rootfs
493   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image
494    
495   dialog_install_settings   dialog_install_settings
# Line 501  run_install_normal() Line 506  run_install_normal()
506   bootloader_config   bootloader_config
507   bootloader_install   bootloader_install
508    
509   install_umount_rootfs   umount_rootfs
510   dialog_install_successful   dialog_install_successful
511  }  }
512    
513  run_install_auto()  run_install_auto()
514  {  {
515   dialog_hardware_detection   task_hardware_detection
516    
517   task_setup_hdd_partitions_auto   task_setup_hdd_partitions_auto
518   dialog_setup_hdd_format   dialog_setup_hdd_format
519   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
520   install_mount_rootfs   mount_rootfs
521   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image
522    
523   dialog_install_settings   dialog_install_settings
# Line 529  run_install_auto() Line 534  run_install_auto()
534   bootloader_config   bootloader_config
535   bootloader_install   bootloader_install
536    
537   install_umount_rootfs   umount_rootfs
538   dialog_install_successful   dialog_install_successful
539  }  }
540    

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