Magellan Linux

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

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

revision 2882 by niro, Fri Jul 31 09:39:45 2015 UTC revision 2891 by niro, Fri Jul 31 11:13:02 2015 UTC
# Line 44  done Line 44  done
44  VERSION="%VERSIONTAG%"  VERSION="%VERSIONTAG%"
45  TITLE="${DEFAULT_TITLE} - ${VERSION}"  TITLE="${DEFAULT_TITLE} - ${VERSION}"
46    
47    # initialize global variables so they are exportable
48  # some sane defaults  # some sane defaults
49    INSTALL_METHOD=""
50  LIVEROOT="${DEFAULT_LIVEROOT}"  LIVEROOT="${DEFAULT_LIVEROOT}"
51  IMAGEROOT="${DEFAULT_IMAGEROOT}"  IMAGEROOT="${DEFAULT_IMAGEROOT}"
52  INSTALLROOT="${DEFAULT_INSTALLROOT}"  INSTALLROOT="${DEFAULT_INSTALLROOT}"
# Line 56  FDISKPARTIONBELOW256MB=0 Line 58  FDISKPARTIONBELOW256MB=0
58  SPECIALDEVICE=""  SPECIALDEVICE=""
59  FORMFACTOR="${DEFAULT_FORMFACTOR}"  FORMFACTOR="${DEFAULT_FORMFACTOR}"
60  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
61    FLASHDISK=0
62    
63  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
64  # -> now in images.conf  # -> now in images.conf
# Line 81  trap_exit() Line 84  trap_exit()
84   is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys   is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys
85   is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot   is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot
86   is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT}   is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT}
87     [[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD}
88    
89   echo $"Installation aborted."   echo $"Installation aborted."
90   exit 1   exit 1
# Line 99  install_meter() Line 103  install_meter()
103   return 0   return 0
104  }  }
105    
 install_mount_rootfs()  
 {  
  local opts  
   
  if [[ -n ${SWAPHDD} ]]  
  then  
  swapon ${SWAPHDD} || die  
  fi  
  if [[ -n ${ROOTHDD} ]]  
  then  
  mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die  
  fi  
  if [[ -n ${BOOTHDD} ]]  
  then  
  install -d ${INSTALL_ROOT}/boot || die  
  mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die  
  fi  
   
  cd ${INSTALL_ROOT} || die  
 }  
   
   
106  mount_rootfs()  mount_rootfs()
107  {  {
108   local retval   local retval
# Line 136  mount_rootfs() Line 118  mount_rootfs()
118   then   then
119   echo $"${INSTALLROOT} already mounted" >&2   echo $"${INSTALLROOT} already mounted" >&2
120   else   else
121   mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'"   mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'"
122   fi   fi
123   fi   fi
124    
# Line 148  mount_rootfs() Line 130  mount_rootfs()
130   then   then
131   echo $"${INSTALLROOT}/boot already mounted" >&2   echo $"${INSTALLROOT}/boot already mounted" >&2
132   else   else
133   mount "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'"   mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'"
134   fi   fi
135   fi   fi
136  }  }
# Line 180  run_hardware_detection() Line 162  run_hardware_detection()
162   local removable=0   local removable=0
163   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
164   then   then
165   #for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
166   #do   do
167   # if [[ $(< ${i}) = 1 ]]   if [[ $(< ${i}) = 1 ]]
168   # then   then
169   # removable=1   removable=1
170   # fi   # we assume that all removable disks are flash disks on a zotac
171   #done   export FLASHDISK=1
172     fi
173     done
174   # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'   # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'
175    
176   # only add this for grub legacy, grub2 detect these settings on its own   # only add this for grub legacy, grub2 detect these settings on its own
# Line 244  run_hardware_detection_disks() Line 228  run_hardware_detection_disks()
228    
229  setup_hdd_partitions()  setup_hdd_partitions()
230  {  {
  case "${INSTALL_METHOD}" in  
  auto)  
  BOOTHDD=""  
  SWAPHDD=""  
  ROOTHDD="${HDD}1"  
  ;;  
  normal)  
  BOOTHDD="${HDD}1"  
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
  ;;  
  esac  
   
231   # sanity check - should not happen   # sanity check - should not happen
232   if is_mounted --device "${ROOTHDD}"   if is_mounted --device "${ROOTHDD}"
233   then   then
# Line 288  setup_hdd_partitions() Line 259  setup_hdd_partitions()
259   ## delete disk   ## delete disk
260   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die
261    
262   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FLASHDISK} = 1 ]]
263   then   then
264   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
265   #1. n= new disk   then
266   #2. p= primary disk   ## setup one bootable partition
267   #3. 1= first partition   # 1. n= new disk
268   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   # 2. p= primary disk
269   #5. ''= defaul sector end   # 3. 1= first partition
270   #6. a= bootable flag   # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
271   #7. 1= boot flag for partition 1   # 5. ''= defaul sector end
272   #8. w= write/quit   # 6. a= bootable flag
273   fdisk ${HDD} &> /dev/null << EOF   # 7. 1= boot flag for partition 1
274     # 8. n= new disk
275     #10. p= primary disk
276     #11. 2= second partition
277     #12. ''= default sector start
278     #13. ''= defaul sector end
279     #14. w= write/quit
280     fdisk ${HDD} &> /dev/null << EOF
281  n  n
282  p  p
283  1  1
284  2  2
285    +50M
286    a
287    1
288    n
289    p
290    2
291    
292    
293    w
294    EOF
295     else
296     ## setup one bootable partition
297     # 1. n= new disk
298     # 2. p= primary disk
299     # 3. 1= first partition
300     # 4. ''= default sector start
301     # 5. ''= defaul sector end
302     # 6. a= bootable flag
303     # 7. 1= boot flag for partition 1
304     # 8. n= new disk
305     #10. p= primary disk
306     #11. 2= second partition
307     #12. ''= default sector start
308     #13. ''= defaul sector end
309     #14. w= write/quit
310     fdisk ${HDD} &> /dev/null << EOF
311    n
312    p
313    1
314    
315    +50M
316  a  a
317  1  1
318    n
319    p
320    2
321    
322    
323  w  w
324  EOF  EOF
325     fi
326   else   else
327   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
328   #1. n= new disk   then
329   #2. p= primary disk   ## setup one bootable partition
330   #3. 1= first partition   #1. n= new disk
331   #4. ''= default sector start   #2. p= primary disk
332   #5. ''= defaul sector end   #3. 1= first partition
333   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
334   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
335   #8. w= write/quit   #6. a= bootable flag
336   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
337     #8. w= write/quit
338     fdisk ${HDD} &> /dev/null << EOF
339    n
340    p
341    1
342    2
343    
344    a
345    1
346    w
347    EOF
348     else
349     ## setup one bootable partition
350     #1. n= new disk
351     #2. p= primary disk
352     #3. 1= first partition
353     #4. ''= default sector start
354     #5. ''= defaul sector end
355     #6. a= bootable flag
356     #7. 1= boot flag for partition 1
357     #8. w= write/quit
358     fdisk ${HDD} &> /dev/null << EOF
359  n  n
360  p  p
361  1  1
# Line 329  a Line 365  a
365  1  1
366  w  w
367  EOF  EOF
368     fi
369   fi   fi
370   else   else
371   cfdisk ${HDD} || dialog_die   cfdisk ${HDD} || dialog_die
# Line 337  EOF Line 374  EOF
374    
375  setup_hdd_format()  setup_hdd_format()
376  {  {
377     install -d /tmp
378     :> /tmp/format.log
379    
380   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
381   then   then
382   # sanity check - should not happen   # sanity check - should not happen
# Line 357  setup_hdd_format() Line 397  setup_hdd_format()
397   umount "${BOOTHDD}"   umount "${BOOTHDD}"
398   fi   fi
399    
400   mkfs."${FORMAT_FILESYSTEM}" -q "${BOOTHDD}" || dialog_die   mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die
401   fi   fi
402    
403   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
# Line 369  setup_hdd_format() Line 409  setup_hdd_format()
409   umount "${ROOTHDD}"   umount "${ROOTHDD}"
410   fi   fi
411    
412   mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die   mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die
413   fi   fi
414  }  }
415    
# Line 389  install_system_settings() Line 429  install_system_settings()
429   clearconfig   clearconfig
430   if [[ -n ${BOOTHDD} ]]   if [[ -n ${BOOTHDD} ]]
431   then   then
432   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t1 1"   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1"
433   fi   fi
434   if [[ -n ${ROOTHDD} ]]   if [[ -n ${ROOTHDD} ]]
435   then   then
436   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0"   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
437   fi   fi
438   if [[ -n ${SWAPHDD} ]]   if [[ -n ${SWAPHDD} ]]
439   then   then
# Line 506  task_hardware_detection() Line 546  task_hardware_detection()
546   then   then
547   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
548   fi   fi
549     if [[ ${FLASHDISK} = 1 ]]
550     then
551     message+=$"\n\ZnFlash memory detected.\Zn"
552     message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn"
553     fi
554    
555   messagebox -y 12 -h $"Detected hardware:" "${message}"   messagebox -y 12 -h $"Detected hardware:" "${message}"
556  }  }
# Line 561  run_install() Line 606  run_install()
606    
607   case "${method}" in   case "${method}" in
608   auto)   auto)
609     if [[ ${FLASHDISK} = 1 ]]
610     then
611     export BOOTHDD="${HDD}1"
612     export SWAPHDD=""
613     export ROOTHDD="${HDD}2"
614     export FORMAT_FILESYSTEM_BOOTHDD="f2fs"
615     export FORMAT_FILESYSTEM_ROOTHDD="ext2"
616     else
617     export BOOTHDD=""
618     export SWAPHDD=""
619     export ROOTHDD="${HDD}1"
620     export FORMAT_FILESYSTEM_BOOTHDD=""
621     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
622     fi
623   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
624   ;;   ;;
625   normal)   normal)
626     export BOOTHDD="${HDD}1"
627     export SWAPHDD="${HDD}2"
628     export ROOTHDD="${HDD}3"
629     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
630     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
631     export INSTALL_METHOD="${method}"
632     ;;
633     single)
634     export BOOTHDD=""
635     export SWAPHDD=""
636     export ROOTHDD="${HDD}1"
637     export FORMAT_FILESYSTEM_BOOTHDD=""
638     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
639     export INSTALL_METHOD="${method}"
640     ;;
641     flash)
642     export BOOTHDD="${HDD}1"
643     export SWAPHDD=""
644     export ROOTHDD="${HDD}2"
645     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
646     export FORMAT_FILESYSTEM_ROOTHDD="f2fs"
647   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
648   ;;   ;;
649   *)   *)

Legend:
Removed from v.2882  
changed lines
  Added in v.2891