Magellan Linux

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

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

revision 2344 by niro, Fri Jan 3 15:01:06 2014 UTC revision 2402 by niro, Tue Jan 7 13:17:47 2014 UTC
# Line 16  INSTALLER_LIBDIR="%LIBDIR%" Line 16  INSTALLER_LIBDIR="%LIBDIR%"
16  # -> now in images.conf  # -> now in images.conf
17  CURRENTLINE=0  CURRENTLINE=0
18    
19  # configuration  die()
20  if [ -e %SYSCONFDIR%/installer.conf ]  {
21  then   echo "Error: $@"
22   source %SYSCONFDIR%/installer.conf   exit 1
23  else  }
24   die "/etc/installer.conf not found"  
25  fi  # load common includes
26    for inc in %SYSCONFDIR%/installer.conf \
27     ${INSTALLER_LIBDIR}/functions/common.sh \
28     ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \
29     ${INSTALLER_LIBDIR}/functions/hwdetection.sh \
30     ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh
31    do
32     if [ -e ${inc} ]
33     then
34     source "${inc}"
35     else
36     die "'${inc}' not found"
37     fi
38    done
39    
40  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
41  # -> now in images.conf  # -> now in images.conf
# Line 70  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM} Line 83  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}
83  #  DIALOG BOXEN #  #  DIALOG BOXEN #
84  #################################################  #################################################
85    
 die()  
 {  
  echo "Error: $@"  
  exit 1  
 }  
   
86  dialog_die()  dialog_die()
87  {  {
88   ERROR="$1"   ERROR="$1"
# Line 86  dialog_die() Line 93  dialog_die()
93    
94  dialog_warning()  dialog_warning()
95  {  {
96   dialog \   local retval
97   --backtitle "${TITLE}" \  
98   --colors \   yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"
99   --defaultno \   retval=$?
100   --yesno "\Z1 !!! Achtung !!! \Zn\n\n\   if [[ ${retval} -eq 1 ]]
  Diese Festplatte wird unwiederruflich geloescht werden.\n\n\  
  Soll ich wirklich fortfahren ?" 10 70  
  RES=$?  
  if [[ ${RES} -eq 1 ]]  
101   then   then
102   clear   clear
103   echo "Der Vorgang wurde abgebrochen."   echo $"The process was aborted."
104   exit 1   exit 1
105   fi   fi
106  }  }
107    
108  dialog_setup_hdd_info()  dialog_setup_hdd_info()
109  {  {
  local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"  
   
  dialog \  
  --colors \  
  --title "[ Festplatten Partitionierung ]" \  
  --backtitle "${TITLE}" \  
  --ok-label "Weiter" \  
  --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\  
  [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\  
  [ \Z3${SHDD}2\Zn ] Typ: \Z3Linux Swap\Zn mit ca. 256MB\n\  
  [ \Z3${SHDD}3\Zn ] Typ: \Z3Linux \Zn mit dem Rest (min. 256MB)\n\n\  
  Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81  
 }  
   
 dialog_setup_hdd_info_flash()  
 {  
110   local SHDD="$(echo $HDD | sed 's/\/dev\///')"   local SHDD="$(echo $HDD | sed 's/\/dev\///')"
111    
112   dialog \   dialog \
# Line 161  dialog_setup_system_menu() Line 148  dialog_setup_system_menu()
148   "" "" \   "" "" \
149   "" "\Z1Experten Modi:\Zn" \   "" "\Z1Experten Modi:\Zn" \
150   "2" "Normale IDE-Disk (Manuell)" \   "2" "Normale IDE-Disk (Manuell)" \
  "3" "Flash-Speicher (Manuell)")  
151   RES=$?   RES=$?
152   [[ ${RES} -eq 1 ]] && return 1   [[ ${RES} -eq 1 ]] && return 1
153   if [[ ${RES} -eq 0 ]]   if [[ ${RES} -eq 0 ]]
# Line 169  dialog_setup_system_menu() Line 155  dialog_setup_system_menu()
155   case "${i}" in   case "${i}" in
156   "1") run_install_auto ;;   "1") run_install_auto ;;
157   "2") run_install_normal ;;   "2") run_install_normal ;;
  "3") run_install_flash ;;  
158   "") dialog_setup_system_menu;;   "") dialog_setup_system_menu;;
159   esac   esac
160   fi   fi
# Line 180  dialog_hardware_detection() Line 165  dialog_hardware_detection()
165   local i   local i
166   local hwtmp   local hwtmp
167    
168   if [ -x $(which mktemp &> /dev/null) ]   if [ -x $(type -P mktemp) ]
169   then   then
170   hwtmp="$(mktemp)"   hwtmp="$(mktemp)"
171   else   else
# Line 277  dialog_setup_hdd_partitions_manuell() Line 262  dialog_setup_hdd_partitions_manuell()
262   fi   fi
263  }  }
264    
 dialog_setup_hdd_partitions_manuell_flash()  
 {  
  local i  
   
  if [[ -z ${installdevs} ]]  
  then  
  dialog \  
  --backtitle "${TITLE}" \  
  --ok-label "Beenden" \  
  --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70  
  exit 1  
  else  
   
  echo "dialog \\" > /tmp/hddtmp.sh  
  echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh  
  echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh  
  echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh  
  echo "--stdout \\" >> /tmp/hddtmp.sh  
  echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh  
   
  for i in ${installdevs}  
  do  
  echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh  
  done  
  echo -e "\n" >> /tmp/hddtmp.sh  
   
  chmod a+x /tmp/hddtmp.sh  
  HDD="$(/tmp/hddtmp.sh)"  
  RES=$?  
  [[ ${RES} -eq 1 ]] && return 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  dialog_setup_hdd_info_flash  
  setup_hdd_partitions_manuell_flash  
  fi  
  fi  
 }  
   
265  dialog_setup_hdd_partitions_auto()  dialog_setup_hdd_partitions_auto()
266  {  {
267   local i   local i
# Line 608  EOF Line 555  EOF
555    
556  setup_hdd_partitions_manuell()  setup_hdd_partitions_manuell()
557  {  {
  BOOTHDD="${HDD}1"  
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
   
  ## hdds partitionieren manuell  
  cfdisk ${HDD} || dialog_die  
 }  
   
 setup_hdd_partitions_manuell_flash()  
 {  
558   ROOTHDD="${HDD}1"   ROOTHDD="${HDD}1"
559    
560   ## hdds partitionieren manuell   ## hdds partitionieren manuell
# Line 626  setup_hdd_partitions_manuell_flash() Line 563  setup_hdd_partitions_manuell_flash()
563    
564  setup_hdd_format()  setup_hdd_format()
565  {  {
  mkswap ${SWAPHDD} || dialog_die  
  mke2fs -j -q ${BOOTHDD} || dialog_die  
  mke2fs -j -q ${ROOTHDD} || dialog_die  
 }  
   
 setup_hdd_format_flash()  
 {  
566   mke2fs -j -q ${ROOTHDD} || dialog_die   mke2fs -j -q ${ROOTHDD} || dialog_die
567  }  }
568    
569  install_mount_rootfs()  install_mount_rootfs()
570  {  {
  swapon ${SWAPHDD} || dialog_die  
  mount ${ROOTHDD} ${INSTALLROOT} || dialog_die  
  install -d ${INSTALLROOT}/boot || dialog_die  
  mount ${BOOTHDD} ${INSTALLROOT}/boot || dialog_die  
  cd ${INSTALLROOT} || dialog_die  
 }  
   
 install_mount_rootfs_flash()  
 {  
571   mount ${ROOTHDD} ${INSTALLROOT} || dialog_die   mount ${ROOTHDD} ${INSTALLROOT} || dialog_die
572   install -d ${INSTALLROOT}/boot || dialog_die   install -d ${INSTALLROOT}/boot || dialog_die
573   cd ${INSTALLROOT} || dialog_die   cd ${INSTALLROOT} || dialog_die
# Line 831  CHROOTEOF Line 752  CHROOTEOF
752    
753  is_uuid_supported()  is_uuid_supported()
754  {  {
755   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   if [[ -x $(type -P busybox.mkinitrd) ]]
756   then   then
757   # only detect uuids if supported   # only detect uuids if supported
758   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
# Line 867  install_system_settings() Line 788  install_system_settings()
788   # schreibe fstab   # schreibe fstab
789   if is_uuid_supported   if is_uuid_supported
790   then   then
  echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die  
791   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
792   else   else
  echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die  
793   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
794   fi   fi
795   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   # not needed busybox loads all with swapon -a, even if not mentioned in fstab
# Line 895  install_system_settings() Line 814  install_system_settings()
814   fi   fi
815  }  }
816    
 install_system_settings_flash()  
 {  
  # schreibe fstab  
  if is_uuid_supported  
  then  
  echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die  
  else  
  echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die  
  fi  
  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  
 }  
   
817  install_umount_rootfs()  install_umount_rootfs()
818  {  {
819   cd /   cd /
820   umount ${INSTALLROOT}/boot || dialog_die   umount ${INSTALLROOT}/boot || dialog_die
821   umount ${INSTALLROOT} || dialog_die   umount ${INSTALLROOT} || dialog_die
  swapoff ${SWAPHDD} || dialog_die  
 }  
   
 install_umount_rootfs_flash()  
 {  
  cd /  
  umount ${INSTALLROOT} || dialog_die  
822  }  }
823    
824  install_do_reboot()  install_do_reboot()
# Line 953  run_install_normal() Line 852  run_install_normal()
852   dialog_install_successful   dialog_install_successful
853  }  }
854    
 run_install_flash()  
 {  
  dialog_hardware_detection  
   
  dialog_setup_hdd_partitions_manuell_flash  
  dialog_setup_hdd_format  
  setup_hdd_format_flash > /dev/null  
  install_mount_rootfs_flash  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
   
  dialog_install_settings  
  sleep 1  
  install_system_settings_flash  
  install_initrd_chroot  
   
  dialog_install_bootsector  
  install_bootsector_chroot  
   
  install_umount_rootfs_flash  
  dialog_install_successful  
 }  
   
855  run_install_auto()  run_install_auto()
856  {  {
857   dialog_hardware_detection   dialog_hardware_detection
858    
859   dialog_setup_hdd_partitions_auto   dialog_setup_hdd_partitions_auto
860   dialog_setup_hdd_format   dialog_setup_hdd_format
861   setup_hdd_format_flash > /dev/null   setup_hdd_format > /dev/null
862   install_mount_rootfs_flash   install_mount_rootfs
863   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
864    
865   dialog_install_settings   dialog_install_settings
866   sleep 1   sleep 1
867   install_system_settings_flash   install_system_settings
868   install_initrd_chroot   install_initrd_chroot
869    
870   dialog_install_bootsector   dialog_install_bootsector
871   install_bootsector_chroot   install_bootsector_chroot
872    
873   install_umount_rootfs_flash   install_umount_rootfs
874   dialog_install_successful   dialog_install_successful
875  }  }
876    

Legend:
Removed from v.2344  
changed lines
  Added in v.2402