Magellan Linux

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

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

revision 2478 by niro, Wed Jan 8 10:22:46 2014 UTC revision 2892 by niro, Fri Jul 31 11:40:56 2015 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    # initialize global variables so they are exportable
48  # some sane defaults  # some sane defaults
49  CDROOT="${DEFAULT_CDROOT}"  INSTALL_METHOD=""
50    LIVEROOT="${DEFAULT_LIVEROOT}"
51    IMAGEROOT="${DEFAULT_IMAGEROOT}"
52  INSTALLROOT="${DEFAULT_INSTALLROOT}"  INSTALLROOT="${DEFAULT_INSTALLROOT}"
53  KERNELPKG="${DEFAULT_KERNELPKG}"  KERNELPKG="${DEFAULT_KERNELPKG}"
54  KERNELOPTS="${DEFAULT_KERNELOPTS}"  KERNELOPTS="${DEFAULT_KERNELOPTS}"
# Line 71  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 !
64  #  DIALOG BOXEN #  # -> now in images.conf
65  #################################################  CDIMAGENAME=""
66    TOTALLINES=""
67    CURRENTLINE=0
68    if [ -e ${IMAGEROOT}/images.conf ]
69    then
70     source ${IMAGEROOT}/images.conf
71     # check if all required variables are set
72     [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf"
73     [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf"
74    else
75     die "${IMAGEROOT}/images.conf not found"
76    fi
77    
78    ### helper scripts ###
79    
80  trap_exit()  trap_exit()
81  {  {
# Line 83  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
91  }  }
92    
93  dialog_die()  install_meter()
94  {  {
95   ERROR="$1"   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
96   RETVAL="$?"   do
97   dialog_install_failure   CURRENTLINE=$(grep -c . /tmp/install.log)
98   exit 1   PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
99     echo ${PERCENT}
100     sleep 1
101     done
102     rm -f /tmp/install.log
103     return 0
104  }  }
105    
106  dialog_warning()  mount_rootfs()
107  {  {
108   local retval   local retval
109    
110   yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"   if [[ -n ${SWAPHDD} ]]
  retval=$?  
  if [[ ${retval} -eq 1 ]]  
111   then   then
112   clear   swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'"
  echo $"The process was aborted."  
  exit 1  
113   fi   fi
 }  
   
 task_setup_system_menu()  
 {  
  local mode  
  local retval  
114    
115   mode="$(dialog_setup_system_menu)"   if [[ -n ${ROOTHDD} ]]
  retval=$?  
  [[ ${retval} -eq 1 ]] && return 1  
  if [[ ${retval} -eq 0 ]]  
116   then   then
117   case "${mode}" in   if is_mounted --location "${INSTALLROOT}"
118   "1") run_install_auto ;;   then
119   "2") run_install_normal ;;   echo $"${INSTALLROOT} already mounted" >&2
120   "") task_setup_system_menu;;   else
121   esac   mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'"
122   fi   fi
 }  
   
 dialog_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"  
123   fi   fi
124    
125   messagebox -y 12 -h $"Detected hardware:" "${message}"   [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot
 }  
126    
127  task_setup_hdd_partitions_manual()   if [[ -n ${BOOTHDD} ]]
 {  
  local i  
  local retval  
   
  if [[ -z ${ALL_DISKS} ]]  
128   then   then
129   dialog_no_harddrive_found   if is_mounted --location "${INSTALLROOT}"/boot
  exit 1  
  else  
  HDD=$(dialog_select_target_harddrive)  
  retval=$?  
  [[ ${retval} -eq 1 ]] && return 1  
  if [[ ${retval} -eq 0 ]]  
130   then   then
131   dialog_setup_hdd_info   echo $"${INSTALLROOT}/boot already mounted" >&2
132   setup_hdd_partitions_manual   else
133     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  }  }
137    
138  dialog_setup_hdd_partitions_auto()  umount_rootfs()
139  {  {
140   local i   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot
141   local retval   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}
142    
143   if [[ -z ${ALL_DISKS} ]]   if [[ -n ${SWAPHDD} ]]
144   then   then
145   dialog_no_harddrive_found   swapoff ${SWAPHDD} || die
  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  
146   fi   fi
147  }  }
148    
149  install_meter()  install_do_reboot()
 {  
  while [[ ${CURRENTLINE} != ${TOTALLINES} ]]  
  do  
  CURRENTLINE=$(grep -c . /tmp/install.log)  
  PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))  
  echo ${PERCENT}  
  sleep 1  
  done  
  rm -f /tmp/install.log  
  return 0  
 }  
   
 task_main()  
150  {  {
151   local method=0   reboot
  local retval  
   
  while [[ ${method} -le 2 ]]  
  do  
  method=$(dialog_main)  
  retval=$?  
  [[ ${retval} -eq 1 ]] && exit 1  
  if [[ ${retval} -eq 0 ]]  
  then  
  case ${method} in  
  "1") task_setup_system_menu ;;  
  "2") dialog_hardware_detection ;;  
  "3") install_do_reboot ;;  
  "4") /bin/bash --login -i ;;  
  esac  
  fi  
  done  
152  }  }
153    
 #################################################  
 # Install Komandos #  
 #################################################  
154  run_hardware_detection()  run_hardware_detection()
155  {  {
156   local hwinfo   local hwinfo
157    
158   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
159    
160   ## check for special devices/clients:   # check for special devices/clients:
161   ## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
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   ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'   fi
173     done
174   ## only add this for grub legacy, grub2 detect these settings on its own   # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'
175   #export GRUBLEGACYOPTS="rootdelay=8"  
176   ## there are to zotac types in the wild, nvidia based gfx and intel   # only add this for grub legacy, grub2 detect these settings on its own
177   #if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]   export GRUBLEGACYOPTS="rootdelay=8"
178   #then   # there are to zotac types in the wild, nvidia based gfx and intel
179   #export SPECIALDEVICE="zotac_nvidia"   if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
180   #else   then
181   #export SPECIALDEVICE="zotac_intel"   export SPECIALDEVICE="zotac_nvidia"
182   #fi   else
183   #fi   export SPECIALDEVICE="zotac_intel"
184     fi
185     fi
186    
187   # check for special devices/clients:   # check for special devices/clients:
188   # if a rangee and disk ist smaller then 256mb move partion one block further ahead   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
# Line 302  run_hardware_detection() Line 202  run_hardware_detection()
202   export GRUBLEGACYOPTS=""   export GRUBLEGACYOPTS=""
203   fi   fi
204    
205     # check for i845 Chipsets and enable KMS and use 915 drm driver later in initrd
206     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
207     then
208     export SPECIALDEVICE="i845"
209     # unset default video=1024x768 opt or the drm driver breaks
210     export KERNELOPTS="quiet"
211     export GRUBLEGACYOPTS=""
212     # enable full kms support
213     export GRUB2GFXPAYLOAD="keep"
214     fi
215    
216     # check for radeon gfxcards
217     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
218     then
219     # enable full kms support
220     export GRUB2GFXPAYLOAD="keep"
221     fi
222    
223     # requires nomsi to prevent massive IRQ error spam
224     # see: http://ubuntuforums.org/showthread.php?t=1234983
225     if [[ ! -z $(echo "${hwinfo}" | grep -i 'P5VD2-X') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VT8237') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VX700') ]]
226     then
227     export SPECIALDEVICE="nomsi"
228     export KERNELOPTS="${KERNELOPTS} pci=nomsi,noaer"
229     fi
230    
231   # check for special devices/clients:   # check for special devices/clients:
232   # check for laptops and activate cpufreq scaling   # check for laptops and activate cpufreq scaling
233   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
# Line 318  run_hardware_detection_disks() Line 244  run_hardware_detection_disks()
244   # all disks but exclude ramdisks   # all disks but exclude ramdisks
245   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
246   # remove the boot device from ALL_DISKS if it was an usbstick   # remove the boot device from ALL_DISKS if it was an usbstick
247   if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]   if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
248   then   then
249   bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"   bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')
250   export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")   export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
251   fi   fi
252   export ALL_CDROMS="$(get_hwinfo cdrom)"   export ALL_CDROMS="$(get_hwinfo cdrom)"
253  }  }
254    
255  setup_hdd_partitions_auto()  setup_hdd_partitions()
256  {  {
  ROOTHDD="${HDD}1"  
   
257   # sanity check - should not happen   # sanity check - should not happen
258   if is_mounted --device "${ROOTHDD}"   if is_mounted --device "${ROOTHDD}"
259   then   then
260   echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2   echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2
261   umount "${ROOTHDD}"   umount "${ROOTHDD}"
262   fi   fi
263     if [[ -n ${BOOTHDD} ]]
  # run this only if FDISKPARTITIONBELOW256MB is not already 1  
  if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]  
264   then   then
265   if hdd_size_below_256mb ${HDD}   if is_mounted --device "${BOOTHDD}"
266   then   then
267   FDISKPARTIONBELOW256MB=1   echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2
268   else   umount "${BOOTHDD}"
  FDISKPARTIONBELOW256MB=0  
269   fi   fi
270   fi   fi
271    
272   ## delete disk   if [[ ${INSTALL_METHOD} = auto ]]
  dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die  
   
  if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]  
273   then   then
274   ## setup one bootable partition   # run this only if FDISKPARTITIONBELOW256MB is not already 1
275   #1. n= new disk   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
276   #2. p= primary disk   then
277   #3. 1= first partition   if device_minimum_size "${HDD}" 256
278   #4. 2= default sector start // small disk needs more space for grub2 mbr sector   then
279   #5. ''= defaul sector end   FDISKPARTIONBELOW256MB=1
280   #6. a= bootable flag   else
281   #7. 1= boot flag for partition 1   FDISKPARTIONBELOW256MB=0
282   #8. w= write/quit   fi
283   fdisk ${HDD} &> /dev/null << EOF   fi
284    
285     ## delete disk
286     dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die
287    
288     if [[ ${FLASHDISK} = 1 ]]
289     then
290     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
291     then
292     ## setup one bootable partition
293     # 1. n= new disk
294     # 2. p= primary disk
295     # 3. 1= first partition
296     # 4. 2= default sector start // small disk needs more space for grub2 mbr sector
297     # 5. ''= defaul sector end
298     # 6. a= bootable flag
299     # 7. 1= boot flag for partition 1
300     # 8. n= new disk
301     #10. p= primary disk
302     #11. 2= second partition
303     #12. ''= default sector start
304     #13. ''= defaul sector end
305     #14. w= write/quit
306     fdisk ${HDD} &> /dev/null << EOF
307  n  n
308  p  p
309  1  1
310  2  2
311    +50M
312  a  a
313  1  1
314    n
315    p
316    2
317    
318    
319  w  w
320  EOF  EOF
321   else   else
322   ## setup one bootable partition   ## setup one bootable partition
323   #1. n= new disk   # 1. n= new disk
324   #2. p= primary disk   # 2. p= primary disk
325   #3. 1= first partition   # 3. 1= first partition
326   #4. ''= default sector start   # 4. ''= default sector start
327   #5. ''= defaul sector end   # 5. ''= defaul sector end
328   #6. a= bootable flag   # 6. a= bootable flag
329   #7. 1= boot flag for partition 1   # 7. 1= boot flag for partition 1
330   #8. w= write/quit   # 8. n= new disk
331   fdisk ${HDD} &> /dev/null << EOF   #10. p= primary disk
332     #11. 2= second partition
333     #12. ''= default sector start
334     #13. ''= defaul sector end
335     #14. w= write/quit
336     fdisk ${HDD} &> /dev/null << EOF
337  n  n
338  p  p
339  1  1
340    
341    +50M
342    a
343    1
344    n
345    p
346    2
347    
348    
349    w
350    EOF
351     fi
352     else
353     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
354     then
355     ## setup one bootable partition
356     #1. n= new disk
357     #2. p= primary disk
358     #3. 1= first partition
359     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
360     #5. ''= defaul sector end
361     #6. a= bootable flag
362     #7. 1= boot flag for partition 1
363     #8. w= write/quit
364     fdisk ${HDD} &> /dev/null << EOF
365    n
366    p
367    1
368    2
369    
370  a  a
371  1  1
372  w  w
373  EOF  EOF
374   fi   else
375  }   ## setup one bootable partition
376     #1. n= new disk
377     #2. p= primary disk
378     #3. 1= first partition
379     #4. ''= default sector start
380     #5. ''= defaul sector end
381     #6. a= bootable flag
382     #7. 1= boot flag for partition 1
383     #8. w= write/quit
384     fdisk ${HDD} &> /dev/null << EOF
385    n
386    p
387    1
388    
 setup_hdd_partitions_manual()  
 {  
  ROOTHDD="${HDD}1"  
  SWAPHDD=""  
  BOOTHDD=""  
  cfdisk ${HDD} || dialog_die  
 }  
389    
390  setup_hdd_format()  a
391  {  1
392   # sanity check - should not happen  w
393   if is_mounted --device "${ROOTHDD}"  EOF
394   then   fi
395   echo "format: device ${ROOTHDD} is already mounted, umount it" >&2   fi
396   umount "${ROOTHDD}"   else
397     cfdisk ${HDD} || dialog_die
398   fi   fi
   
  mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die  
 }  
   
 install_mount_rootfs()  
 {  
  is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}"  
  install -d ${INSTALLROOT}/boot || dialog_die  
 }  
   
 install_system_image()  
 {  
  pushd ${INSTALLROOT} > /dev/null  
  tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT}  
  popd > /dev/null  
399  }  }
400    
401  disabled_install_bootsector_chroot()  setup_hdd_format()
402  {  {
403   local my_roothdd   install -d /tmp
404   local grubconf="${INSTALLROOT}/boot/grub/grub.conf"   :> /tmp/format.log
  local grub2conf="/boot/grub/grub.cfg"  
405    
406   # check for grub2   if [[ -n ${SWAPHDD} ]]
  if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]  
407   then   then
408   # needed by grub-mkconfig on the first run   # sanity check - should not happen
409   if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]]   if is_mounted --device "${SWAPHDD}"
410   then   then
411   install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die   echo "format: device ${SWAPHDD} is already mounted, umount it" >&2
412     umount "${SWAPHDD}"
413   fi   fi
414     mkswap ${SWAPHDD} || die
415     fi
416    
417   # set kernelopts   if [[ -n ${BOOTHDD} ]]
418   if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]]   then
419   then   # sanity check - should not happen
420   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die   if is_mounted --device "${BOOTHDD}"
  else  
  CONFIG="${INSTALLROOT}/etc/conf.d/grub"  
  clearconfig  
  addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""  
  fi  
  CONFIG="${INSTALLROOT}/root/.installrc"  
  clearconfig  
  # only grub 1.99  
  addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap'  
  addconfig "grub-install --no-floppy ${HDD} &> /dev/null"  
  addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"  
  addconfig "exit 0"  
   
  # grub-legacy  
  else  
  source ${INSTALLROOT}/boot/kernelversion  
   
  if [ -e ${INSTALLROOT}/etc/alx_version ]  
  then  
  OLD_ALXVER="${ALXVER}"  
  source ${INSTALLROOT}/etc/alx_version  
  KRNVER="ALX-${ALXVER}"  
  ALXVER="${OLD_ALXVER}"  
  fi  
   
  [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"  
  [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"  
  [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"  
   
  # uuid support  
  my_roothdd="UUID=$(get_uuid ${ROOTHDD})"  
   
  CONFIG="${grubconf}"  
  clearconfig  
  addconfig "default 0"  
  addconfig "timeout 3"  
  # using current root password  
  addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"  
   
  addconfig  
  addconfig "# normal boot"  
  addconfig "title ${KRNVER}"  
  addconfig "root (hd0,0)"  
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"  
  if is_initrd_supported  
421   then   then
422   addconfig "initrd /boot/${KRNINITRD}"   echo "format: device ${BOOTHDD} is already mounted, umount it" >&2
423     umount "${BOOTHDD}"
424   fi   fi
425    
426   addconfig   mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die
427   addconfig "# admin boot"   fi
  addconfig "title ${KRNVER} - Re-run hardware-detection"  
  addconfig "lock"  
  addconfig "root (hd0,0)"  
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"  
  if is_initrd_supported  
  then  
  addconfig "initrd /boot/${KRNINITRD}"  
  fi  
428    
429   addconfig   if [[ -n ${ROOTHDD} ]]
430   addconfig "title ${KRNVER} - Reset *all* local settings"   then
431   addconfig "lock"   # sanity check - should not happen
432   addconfig "root (hd0,0)"   if is_mounted --device "${ROOTHDD}"
  addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"  
  if is_initrd_supported  
433   then   then
434   addconfig "initrd /boot/${KRNINITRD}"   echo "format: device ${ROOTHDD} is already mounted, umount it" >&2
435     umount "${ROOTHDD}"
436   fi   fi
437    
438   # bootsector schreiben chrooted schreiben (lfs/magellan)   mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die
  cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF  
 /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  
 root (hd0,0)  
 setup (hd0)  
 quit  
 EOF  
 exit 0  
 CHROOTEOF  
439   fi   fi
440    }
441    
442   # run installrc  install_system_image()
443   chrooted /bin/bash --rcfile /root/.installrc -i  {
444   rm ${INSTALLROOT}/root/.installrc   pushd ${INSTALLROOT} > /dev/null
445  }   tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT}
446     popd > /dev/null
 disabled_install_initrd_chroot()  
 {  
  # only generate initrds if the cmd exists  
  is_initrd_supported || return 0  
   
  DISKMODS="sd_mod"  
  OLDPATAMODS="amd74xx piix sis5513 via82cxxx"  
  PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"  
  SATAMODS="sata_via sata_sis sata_nv"  
  DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"  
  OTHERMODS=""  
  case ${SPECIALDEVICE} in  
  zotac_intel) FBMODS=""; DRMMODS="i915" ;;  
  zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;  
  rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards  
  # not working with kms enabled drivers -> segfaults  
  #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer  
  maxdata) FBMODS="" ;;  
  *) FBMODS="uvesafb" ;;  
  esac  
   
  if [[ ${FORMFACTOR} = laptop ]]  
  then  
  OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"  
  fi  
   
  # install an appropriate uvesafb.conf  
  install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf"  
  clearconfig  
  addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"  
   
  # install an appropriate viafb.conf  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf"  
  clearconfig  
  addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"  
   
  # install an appropriate i810fb.conf  
  CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf"  
  clearconfig  
  addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  
   
  cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF  
 echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  
 mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null  
 exit 0  
 CHROOTEOF  
   
  # run installrc  
  chrooted /bin/bash --rcfile /root/.installrc -i  
  rm ${INSTALLROOT}/root/.installrc  
447  }  }
448    
449  install_system_settings()  install_system_settings()
# Line 593  install_system_settings() Line 453  install_system_settings()
453   # write fstab   # write fstab
454   CONFIG="${INSTALLROOT}/etc/fstab"   CONFIG="${INSTALLROOT}/etc/fstab"
455   clearconfig   clearconfig
456   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1"   if [[ -n ${BOOTHDD} ]]
457     then
458     addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1"
459     fi
460     if [[ -n ${ROOTHDD} ]]
461     then
462     addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
463     fi
464     if [[ -n ${SWAPHDD} ]]
465     then
466     addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
467     fi
468   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
469   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
470    
# Line 604  install_system_settings() Line 475  install_system_settings()
475   addconfig 'NETWORKING="dhcp"'   addconfig 'NETWORKING="dhcp"'
476    
477   # intel framebuffer quirk   # intel framebuffer quirk
478   if [ -e ${INSTALLROOT}/etc/splash/splash.conf ]   CONFIG="${INSTALLROOT}/etc/splash/splash.conf"
479     if [ -e ${CONFIG} ] && [ -e /proc/fb ]
480   then   then
481   if [ -e /proc/fb ]   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
482   then   then
483   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
484   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  
485   fi   fi
486   fi   fi
487  }  }
488    
489  install_umount_rootfs()  
490    ### installer dialogs ###
491    
492    dialog_die()
493  {  {
494   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot   ERROR="$1"
495   is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}   RETVAL="$?"
496     dialog_install_failure
497     exit 1
498  }  }
499    
500  install_do_reboot()  dialog_warning()
501  {  {
502   reboot   local retval
503    
504     yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"
505     retval=$?
506     if [[ ${retval} -eq 1 ]]
507     then
508     clear
509     echo $"The process was aborted."
510     exit 1
511     fi
512  }  }
513    
 #################################################  
 #     Install Ablauf Scripte #  
 #################################################  
514    
515  run_install_normal()  ### installer tasks ###
516    
517    task_setup_system_menu()
518  {  {
519   dialog_hardware_detection   local mode
520     local retval
521    
522   task_setup_hdd_partitions_manual   mode="$(dialog_setup_system_menu)"
523   dialog_setup_hdd_format   retval=$?
524   setup_hdd_format > /dev/null   [[ ${retval} -eq 1 ]] && return 1
525   install_mount_rootfs   if [[ ${retval} -eq 0 ]]
526   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image   then
527     case "${mode}" in
528     "1") run_install auto ;;
529     "2") run_install normal ;;
530     "") task_setup_system_menu;;
531     esac
532     fi
533    }
534    
535   dialog_install_settings  task_hardware_detection()
536   sleep 1  {
537   install_system_settings   local message
538   if is_initrd_supported  
539     run_hardware_detection_disks
540    
541     message+=$"Harddrives:\n"
542    
543     if [[ ! -z ${ALL_DISKS} ]]
544   then   then
545   dialog_install_initrd   for i in ${ALL_DISKS}
546   initrd_config   do
547   initrd_install   message+="\Z3${i}\Zn "
548     done
549     message+="\n"
550   fi   fi
551    
552   dialog_install_bootsector   if [[ ! -z ${ALL_CDROMS} ]]
553   bootloader_config   then
554   bootloader_install   message+="\n"
555     message+=$"Optical disk drives:\n"
556     for i in ${ALL_CDROMS}
557     do
558     message+="\Z3${i}\Zn"
559     done
560     message+="\n"
561     fi
562    
563   install_umount_rootfs   # other devices
564   dialog_install_successful   run_hardware_detection
565     case "${SPECIALDEVICE}" in
566     zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
567     rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
568     maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
569     i845) message+=$"\n\Z2Intel i845 VGA device detected.\Zn" ;;
570     nomsi) message+=$"\n\Z2Mainboard with P5VD2-X/VT8237/VX700 chipset detected.\Zn"
571     message+=$"\n\Z2Disabling Message Signaled Interrupts (MSI) capability of the kernel.\Zn" ;;
572     *) message+=$"\n\ZnCommon device detected.\Zn" ;;
573     esac
574     if [[ ${FORMFACTOR} = laptop ]]
575     then
576     message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
577     fi
578     if [[ ${FLASHDISK} = 1 ]]
579     then
580     message+=$"\n\ZnFlash memory detected.\Zn"
581     message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn"
582     fi
583    
584     messagebox -y 12 -h $"Detected hardware:" "${message}"
585  }  }
586    
587  run_install_auto()  task_setup_hdd_partitions()
588  {  {
589   dialog_hardware_detection   local i
590     local retval
591    
592     if [[ -z ${ALL_DISKS} ]]
593     then
594     dialog_no_harddrive_found
595     exit 1
596     else
597     HDD=$(dialog_select_target_harddrive)
598     retval=$?
599     [[ ${retval} -eq 1 ]] && return 1
600     if [[ ${retval} -eq 0 ]]
601     then
602     dialog_setup_hdd_info
603     setup_hdd_partitions
604     fi
605     fi
606    }
607    
608    task_main()
609    {
610     local method=0
611     local retval
612    
613     while [[ ${method} -le 2 ]]
614     do
615     method=$(dialog_main)
616     retval=$?
617     [[ ${retval} -eq 1 ]] && exit 1
618     if [[ ${retval} -eq 0 ]]
619     then
620     case ${method} in
621     "1") task_setup_system_menu ;;
622     "2") task_hardware_detection ;;
623     "3") install_do_reboot ;;
624     "4") /bin/bash --login -i ;;
625     esac
626     fi
627     done
628    }
629    
630    run_install()
631    {
632     local method="$1"
633    
634     task_hardware_detection
635    
636     case "${method}" in
637     auto)
638     if [[ ${FLASHDISK} = 1 ]]
639     then
640     export BOOTHDD="${HDD}1"
641     export SWAPHDD=""
642     export ROOTHDD="${HDD}2"
643     export FORMAT_FILESYSTEM_BOOTHDD="f2fs"
644     export FORMAT_FILESYSTEM_ROOTHDD="ext2"
645     else
646     export BOOTHDD=""
647     export SWAPHDD=""
648     export ROOTHDD="${HDD}1"
649     export FORMAT_FILESYSTEM_BOOTHDD=""
650     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
651     fi
652     export INSTALL_METHOD="${method}"
653     ;;
654     normal)
655     export BOOTHDD="${HDD}1"
656     export SWAPHDD="${HDD}2"
657     export ROOTHDD="${HDD}3"
658     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
659     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
660     export INSTALL_METHOD="${method}"
661     ;;
662     single)
663     export BOOTHDD=""
664     export SWAPHDD=""
665     export ROOTHDD="${HDD}1"
666     export FORMAT_FILESYSTEM_BOOTHDD=""
667     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
668     export INSTALL_METHOD="${method}"
669     ;;
670     flash)
671     export BOOTHDD="${HDD}1"
672     export SWAPHDD=""
673     export ROOTHDD="${HDD}2"
674     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
675     export FORMAT_FILESYSTEM_ROOTHDD="f2fs"
676     export INSTALL_METHOD="${method}"
677     ;;
678     *)
679     die "Unknown install method '${method}', aborting."
680     ;;
681     esac
682    
683   dialog_setup_hdd_partitions_auto   task_setup_hdd_partitions
684   dialog_setup_hdd_format   dialog_setup_hdd_format
685   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
686   install_mount_rootfs   mount_rootfs
687   (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
688    
689   dialog_install_settings   dialog_install_settings
# Line 687  run_install_auto() Line 700  run_install_auto()
700   bootloader_config   bootloader_config
701   bootloader_install   bootloader_install
702    
703   install_umount_rootfs   umount_rootfs
704   dialog_install_successful   dialog_install_successful
705  }  }
706    

Legend:
Removed from v.2478  
changed lines
  Added in v.2892