Magellan Linux

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

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

revision 2885 by niro, Fri Jul 31 10:09:08 2015 UTC revision 2890 by niro, Fri Jul 31 11:11:58 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  LIVEROOT="${DEFAULT_LIVEROOT}"  LIVEROOT="${DEFAULT_LIVEROOT}"
50  IMAGEROOT="${DEFAULT_IMAGEROOT}"  IMAGEROOT="${DEFAULT_IMAGEROOT}"
# Line 56  FDISKPARTIONBELOW256MB=0 Line 57  FDISKPARTIONBELOW256MB=0
57  SPECIALDEVICE=""  SPECIALDEVICE=""
58  FORMFACTOR="${DEFAULT_FORMFACTOR}"  FORMFACTOR="${DEFAULT_FORMFACTOR}"
59  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
60    FLASHDISK=0
61    
62  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
63  # -> now in images.conf  # -> now in images.conf
# Line 81  trap_exit() Line 83  trap_exit()
83   is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys   is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys
84   is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot   is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot
85   is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT}   is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT}
86     [[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD}
87    
88   echo $"Installation aborted."   echo $"Installation aborted."
89   exit 1   exit 1
# Line 114  mount_rootfs() Line 117  mount_rootfs()
117   then   then
118   echo $"${INSTALLROOT} already mounted" >&2   echo $"${INSTALLROOT} already mounted" >&2
119   else   else
120   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}'"
121   fi   fi
122   fi   fi
123    
# Line 126  mount_rootfs() Line 129  mount_rootfs()
129   then   then
130   echo $"${INSTALLROOT}/boot already mounted" >&2   echo $"${INSTALLROOT}/boot already mounted" >&2
131   else   else
132   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'"
133   fi   fi
134   fi   fi
135  }  }
# Line 158  run_hardware_detection() Line 161  run_hardware_detection()
161   local removable=0   local removable=0
162   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]   if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
163   then   then
164   #for i in /sys/block/[hs]d*/removable   for i in /sys/block/[hs]d*/removable
165   #do   do
166   # if [[ $(< ${i}) = 1 ]]   if [[ $(< ${i}) = 1 ]]
167   # then   then
168   # removable=1   removable=1
169   # fi   # we assume that all removable disks are flash disks on a zotac
170   #done   export FLASHDISK=1
171     fi
172     done
173   # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'   # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'
174    
175   # 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 222  run_hardware_detection_disks() Line 227  run_hardware_detection_disks()
227    
228  setup_hdd_partitions()  setup_hdd_partitions()
229  {  {
  case "${INSTALL_METHOD}" in  
  auto)  
  BOOTHDD=""  
  SWAPHDD=""  
  ROOTHDD="${HDD}1"  
  ;;  
  normal)  
  BOOTHDD="${HDD}1"  
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
  ;;  
  esac  
   
230   # sanity check - should not happen   # sanity check - should not happen
231   if is_mounted --device "${ROOTHDD}"   if is_mounted --device "${ROOTHDD}"
232   then   then
# Line 266  setup_hdd_partitions() Line 258  setup_hdd_partitions()
258   ## delete disk   ## delete disk
259   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die
260    
261   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]   if [[ ${FLASHDISK} = 1 ]]
262   then   then
263   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
264   #1. n= new disk   then
265   #2. p= primary disk   ## setup one bootable partition
266   #3. 1= first partition   # 1. n= new disk
267   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   # 2. p= primary disk
268   #5. ''= defaul sector end   # 3. 1= first partition
269   #6. a= bootable flag   # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
270   #7. 1= boot flag for partition 1   # 5. ''= defaul sector end
271   #8. w= write/quit   # 6. a= bootable flag
272   fdisk ${HDD} &> /dev/null << EOF   # 7. 1= boot flag for partition 1
273     # 8. n= new disk
274     #10. p= primary disk
275     #11. 2= second partition
276     #12. ''= default sector start
277     #13. ''= defaul sector end
278     #14. w= write/quit
279     fdisk ${HDD} &> /dev/null << EOF
280  n  n
281  p  p
282  1  1
283  2  2
284    +50M
285    a
286    1
287    n
288    p
289    2
290    
291    
292    w
293    EOF
294     else
295     ## setup one bootable partition
296     # 1. n= new disk
297     # 2. p= primary disk
298     # 3. 1= first partition
299     # 4. ''= default sector start
300     # 5. ''= defaul sector end
301     # 6. a= bootable flag
302     # 7. 1= boot flag for partition 1
303     # 8. n= new disk
304     #10. p= primary disk
305     #11. 2= second partition
306     #12. ''= default sector start
307     #13. ''= defaul sector end
308     #14. w= write/quit
309     fdisk ${HDD} &> /dev/null << EOF
310    n
311    p
312    1
313    
314    +50M
315  a  a
316  1  1
317    n
318    p
319    2
320    
321    
322  w  w
323  EOF  EOF
324     fi
325   else   else
326   ## setup one bootable partition   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
327   #1. n= new disk   then
328   #2. p= primary disk   ## setup one bootable partition
329   #3. 1= first partition   #1. n= new disk
330   #4. ''= default sector start   #2. p= primary disk
331   #5. ''= defaul sector end   #3. 1= first partition
332   #6. a= bootable flag   #4. 2= default sector start // small disk needs more space for grub2 mbr sector
333   #7. 1= boot flag for partition 1   #5. ''= defaul sector end
334   #8. w= write/quit   #6. a= bootable flag
335   fdisk ${HDD} &> /dev/null << EOF   #7. 1= boot flag for partition 1
336     #8. w= write/quit
337     fdisk ${HDD} &> /dev/null << EOF
338    n
339    p
340    1
341    2
342    
343    a
344    1
345    w
346    EOF
347     else
348     ## setup one bootable partition
349     #1. n= new disk
350     #2. p= primary disk
351     #3. 1= first partition
352     #4. ''= default sector start
353     #5. ''= defaul sector end
354     #6. a= bootable flag
355     #7. 1= boot flag for partition 1
356     #8. w= write/quit
357     fdisk ${HDD} &> /dev/null << EOF
358  n  n
359  p  p
360  1  1
# Line 307  a Line 364  a
364  1  1
365  w  w
366  EOF  EOF
367     fi
368   fi   fi
369   else   else
370   cfdisk ${HDD} || dialog_die   cfdisk ${HDD} || dialog_die
# Line 487  task_hardware_detection() Line 545  task_hardware_detection()
545   then   then
546   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"   message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
547   fi   fi
548     if [[ ${FLASHDISK} = 1 ]]
549     then
550     message+=$"\n\ZnFlash memory detected.\Zn"
551     message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn"
552     fi
553    
554   messagebox -y 12 -h $"Detected hardware:" "${message}"   messagebox -y 12 -h $"Detected hardware:" "${message}"
555  }  }
# Line 542  run_install() Line 605  run_install()
605    
606   case "${method}" in   case "${method}" in
607   auto)   auto)
608   export FORMAT_FILESYSTEM_BOOTHDD=""   if [[ ${FLASHDISK} = 1 ]]
609   export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"   then
610     export BOOTHDD="${HDD}1"
611     export SWAPHDD=""
612     export ROOTHDD="${HDD}2"
613     export FORMAT_FILESYSTEM_BOOTHDD="f2fs"
614     export FORMAT_FILESYSTEM_ROOTHDD="ext2"
615     else
616     export BOOTHDD=""
617     export SWAPHDD=""
618     export ROOTHDD="${HDD}1"
619     export FORMAT_FILESYSTEM_BOOTHDD=""
620     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
621     fi
622   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
623   ;;   ;;
624   normal)   normal)
625     export BOOTHDD="${HDD}1"
626     export SWAPHDD="${HDD}2"
627     export ROOTHDD="${HDD}3"
628   export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"   export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
629   export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"   export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
630   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
631   ;;   ;;
632   single)   single)
633     export BOOTHDD=""
634     export SWAPHDD=""
635     export ROOTHDD="${HDD}1"
636   export FORMAT_FILESYSTEM_BOOTHDD=""   export FORMAT_FILESYSTEM_BOOTHDD=""
637   export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"   export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
638   export INSTALL_METHOD="${method}"   export INSTALL_METHOD="${method}"
639   ;;   ;;
640     flash)
641     export BOOTHDD="${HDD}1"
642     export SWAPHDD=""
643     export ROOTHDD="${HDD}2"
644     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
645     export FORMAT_FILESYSTEM_ROOTHDD="f2fs"
646     export INSTALL_METHOD="${method}"
647     ;;
648   *)   *)
649   die "Unknown install method '${method}', aborting."   die "Unknown install method '${method}', aborting."
650   ;;   ;;

Legend:
Removed from v.2885  
changed lines
  Added in v.2890