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 2642 by niro, Wed Apr 2 11:28:21 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 41  do Line 40  do
40   fi   fi
41  done  done
42    
 # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !  
 # -> now in images.conf  
 CDIMAGENAME=""  
 TOTALLINES=""  
 CURRENTLINE=0  
 if [ -e /mnt/cdrom/system/images.conf ]  
 then  
  source /mnt/cdrom/system/images.conf  
  # check if all required variables are set  
  [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf"  
  [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf"  
 else  
  die "/mnt/cdrom/system/images.conf not found"  
 fi  
   
43  ### System/Config Version  ### System/Config Version
44  VERSION="%VERSIONTAG%"  VERSION="%VERSIONTAG%"
45  TITLE="${DEFAULT_TITLE} - ${VERSION}"  TITLE="${DEFAULT_TITLE} - ${VERSION}"
46    
47  # some sane defaults  # some sane defaults
48  CDROOT="${DEFAULT_CDROOT}"  IMAGEROOT="${DEFAULT_IMAGEROOT}"
49  INSTALLROOT="${DEFAULT_INSTALLROOT}"  INSTALLROOT="${DEFAULT_INSTALLROOT}"
50  KERNELPKG="${DEFAULT_KERNELPKG}"  KERNELPKG="${DEFAULT_KERNELPKG}"
51  KERNELOPTS="${DEFAULT_KERNELOPTS}"  KERNELOPTS="${DEFAULT_KERNELOPTS}"
# Line 72  SPECIALDEVICE="" Line 56  SPECIALDEVICE=""
56  FORMFACTOR="${DEFAULT_FORMFACTOR}"  FORMFACTOR="${DEFAULT_FORMFACTOR}"
57  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
58    
59  #################################################  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
60  #  DIALOG BOXEN #  # -> now in images.conf
61  #################################################  CDIMAGENAME=""
62    TOTALLINES=""
63    CURRENTLINE=0
64    if [ -e ${IMAGEROOT}/images.conf ]
65    then
66     source ${IMAGEROOT}/images.conf
67     # check if all required variables are set
68     [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf"
69     [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf"
70    else
71     die "${IMAGEROOT}/images.conf not found"
72    fi
73    
74    ### helper scripts ###
75    
76  trap_exit()  trap_exit()
77  {  {
# Line 88  trap_exit() Line 85  trap_exit()
85   exit 1   exit 1
86  }  }
87    
 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  
 }  
   
88  install_meter()  install_meter()
89  {  {
90   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
# Line 228  install_meter() Line 98  install_meter()
98   return 0   return 0
99  }  }
100    
101  task_main()  mount_rootfs()
102  {  {
  local method=0  
103   local retval   local retval
104    
105   while [[ ${method} -le 2 ]]   if is_mounted --location "${INSTALLROOT}"
106   do   then
107   method=$(dialog_main)   echo $"${INSTALLROOT} already mounted" >&2
108   retval=$?   else
109   [[ ${retval} -eq 1 ]] && exit 1   mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'"
110   if [[ ${retval} -eq 0 ]]   fi
111   then   [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot
112   case ${method} in  }
113   "1") task_setup_system_menu ;;  
114   "2") task_hardware_detection ;;  umount_rootfs()
115   "3") install_do_reboot ;;  {
116   "4") /bin/bash --login -i ;;   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot
117   esac   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}
118   fi  }
119   done  
120    install_do_reboot()
121    {
122     reboot
123  }  }
124    
 #################################################  
 # Install Komandos #  
 #################################################  
125  run_hardware_detection()  run_hardware_detection()
126  {  {
127   local hwinfo   local hwinfo
# Line 340  setup_hdd_partitions_auto() Line 209  setup_hdd_partitions_auto()
209   # run this only if FDISKPARTITIONBELOW256MB is not already 1   # run this only if FDISKPARTITIONBELOW256MB is not already 1
210   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
211   then   then
212   if hdd_size_below_256mb ${HDD}   if device_minimum_size "${HDD}" 256
213   then   then
214   FDISKPARTIONBELOW256MB=1   FDISKPARTIONBELOW256MB=1
215   else   else
# Line 415  setup_hdd_format() Line 284  setup_hdd_format()
284   mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die   mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die
285  }  }
286    
 install_mount_rootfs()  
 {  
  is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}"  
  install -d ${INSTALLROOT}/boot || dialog_die  
 }  
   
287  install_system_image()  install_system_image()
288  {  {
289   pushd ${INSTALLROOT} > /dev/null   pushd ${INSTALLROOT} > /dev/null
290   tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT}   tar xvjpf ${IMAGEROOT}}/${CDIMAGENAME} -C ${INSTALLROOT}
291   popd > /dev/null   popd > /dev/null
292  }  }
293    
# Line 446  install_system_settings() Line 309  install_system_settings()
309   addconfig 'NETWORKING="dhcp"'   addconfig 'NETWORKING="dhcp"'
310    
311   # intel framebuffer quirk   # intel framebuffer quirk
312   if [ -e ${INSTALLROOT}/etc/splash/splash.conf ]   CONFIG="${INSTALLROOT}/etc/splash/splash.conf"
313     if [ -e ${CONFIG} ] && [ -e /proc/fb ]
314   then   then
315   if [ -e /proc/fb ]   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
316   then   then
317   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
318   then   [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die
  fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')  
  if [[ ${fbdev} != 0 ]]  
  then  
  sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die  
  fi  
  fi  
319   fi   fi
320   fi   fi
321  }  }
322    
323  install_umount_rootfs()  
324    ### installer dialogs ###
325    
326    dialog_die()
327  {  {
328   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot   ERROR="$1"
329   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}   RETVAL="$?"
330     dialog_install_failure
331     exit 1
332  }  }
333    
334  install_do_reboot()  dialog_warning()
335  {  {
336   reboot   local retval
337    
338     yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"
339     retval=$?
340     if [[ ${retval} -eq 1 ]]
341     then
342     clear
343     echo $"The process was aborted."
344     exit 1
345     fi
346  }  }
347    
348  #################################################  
349  #     Install Ablauf Scripte #  ### installer tasks ###
350  #################################################  
351    task_setup_system_menu()
352    {
353     local mode
354     local retval
355    
356     mode="$(dialog_setup_system_menu)"
357     retval=$?
358     [[ ${retval} -eq 1 ]] && return 1
359     if [[ ${retval} -eq 0 ]]
360     then
361     case "${mode}" in
362     "1") run_install_auto ;;
363     "2") run_install_normal ;;
364     "") task_setup_system_menu;;
365     esac
366     fi
367    }
368    
369    task_hardware_detection()
370    {
371     local message
372    
373     run_hardware_detection_disks
374    
375     message+=$"Harddrives:\n"
376    
377     if [[ ! -z ${ALL_DISKS} ]]
378     then
379     for i in ${ALL_DISKS}
380     do
381     message+="\Z3${i}\Zn "
382     done
383     message+="\n"
384     fi
385    
386     if [[ ! -z ${ALL_CDROMS} ]]
387     then
388     message+="\n"
389     message+=$"Optical disk drives:\n"
390     for i in ${ALL_CDROMS}
391     do
392     message+="\Z3${i}\Zn"
393     done
394     message+="\n"
395     fi
396    
397     # other devices
398     run_hardware_detection
399     case "${SPECIALDEVICE}" in
400     zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
401     rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
402     maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
403     *) message+=$"\n\ZnCommon device detected.\Zn" ;;
404     esac
405     if [[ ${FORMFACTOR} = laptop ]]
406     then
407     message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
408     fi
409    
410     messagebox -y 12 -h $"Detected hardware:" "${message}"
411    }
412    
413    task_setup_hdd_partitions_manual()
414    {
415     local i
416     local retval
417    
418     if [[ -z ${ALL_DISKS} ]]
419     then
420     dialog_no_harddrive_found
421     exit 1
422     else
423     HDD=$(dialog_select_target_harddrive)
424     retval=$?
425     [[ ${retval} -eq 1 ]] && return 1
426     if [[ ${retval} -eq 0 ]]
427     then
428     dialog_setup_hdd_info
429     setup_hdd_partitions_manual
430     fi
431     fi
432    }
433    
434    task_setup_hdd_partitions_auto()
435    {
436     local i
437     local retval
438    
439     if [[ -z ${ALL_DISKS} ]]
440     then
441     dialog_no_harddrive_found
442     exit 1
443     else
444     HDD=$(dialog_select_target_harddrive)
445     retval=$?
446     [[ ${retval} -eq 1 ]] && return 1
447     if [[ ${retval} -eq 0 ]]
448     then
449     dialog_setup_hdd_info_auto
450     dialog_setup_hdd_create_partitions
451     setup_hdd_partitions_auto
452     fi
453     fi
454    }
455    
456    task_main()
457    {
458     local method=0
459     local retval
460    
461     while [[ ${method} -le 2 ]]
462     do
463     method=$(dialog_main)
464     retval=$?
465     [[ ${retval} -eq 1 ]] && exit 1
466     if [[ ${retval} -eq 0 ]]
467     then
468     case ${method} in
469     "1") task_setup_system_menu ;;
470     "2") task_hardware_detection ;;
471     "3") install_do_reboot ;;
472     "4") /bin/bash --login -i ;;
473     esac
474     fi
475     done
476    }
477    
478  run_install_normal()  run_install_normal()
479  {  {
# Line 484  run_install_normal() Line 482  run_install_normal()
482   task_setup_hdd_partitions_manual   task_setup_hdd_partitions_manual
483   dialog_setup_hdd_format   dialog_setup_hdd_format
484   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
485   install_mount_rootfs   mount_rootfs
486   (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
487    
488   dialog_install_settings   dialog_install_settings
# Line 501  run_install_normal() Line 499  run_install_normal()
499   bootloader_config   bootloader_config
500   bootloader_install   bootloader_install
501    
502   install_umount_rootfs   umount_rootfs
503   dialog_install_successful   dialog_install_successful
504  }  }
505    
# Line 512  run_install_auto() Line 510  run_install_auto()
510   task_setup_hdd_partitions_auto   task_setup_hdd_partitions_auto
511   dialog_setup_hdd_format   dialog_setup_hdd_format
512   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
513   install_mount_rootfs   mount_rootfs
514   (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
515    
516   dialog_install_settings   dialog_install_settings
# Line 529  run_install_auto() Line 527  run_install_auto()
527   bootloader_config   bootloader_config
528   bootloader_install   bootloader_install
529    
530   install_umount_rootfs   umount_rootfs
531   dialog_install_successful   dialog_install_successful
532  }  }
533    

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