Magellan Linux

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

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

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

Legend:
Removed from v.2481  
changed lines
  Added in v.2499