Magellan Linux

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

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

revision 2335 by niro, Fri Jan 3 14:07:34 2014 UTC revision 2948 by niro, Mon Jun 13 15:03:52 2016 UTC
# Line 7  Line 7 
7  # Niels Rogalla <niro@magellan-linux.de>  # Niels Rogalla <niro@magellan-linux.de>
8  #  #
9    
10    # setup locales
11    TEXTDOMAIN=installer
12    
13    # include dir
14  INSTALLER_LIBDIR="%LIBDIR%"  INSTALLER_LIBDIR="%LIBDIR%"
15    
16  # configuration  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
17  if [ -e %SYSCONFDIR%/installer.conf ]  # -> now in images.conf
18  then  CURRENTLINE=0
  source %SYSCONFDIR%/installer.conf  
 else  
  die "/etc/installer.conf not found"  
 fi  
19    
20  #images: (get ${CDIMAGENAME})  die()
21  if [ -e /mnt/cdrom/system/images.conf ]  {
22  then   echo "Error: $@"
23   source /mnt/cdrom/system/images.conf   exit 1
24  else  }
  die "/mnt/cdrom/system/images.conf not found"  
 fi  
25    
26  # includes  # load common includes
27  source ${INSTALLER_LIBDIR}/functions/hwdetection.sh  for inc in %SYSCONFDIR%/installer.conf \
28     ${INSTALLER_LIBDIR}/functions/common.sh \
29     ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \
30     ${INSTALLER_LIBDIR}/functions/hwdetection.sh \
31     ${INSTALLER_LIBDIR}/functions/bootloader.sh \
32     ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \
33     ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh
34    do
35     if [ -e ${inc} ]
36     then
37     source "${inc}"
38     else
39     die "'${inc}' not found"
40     fi
41    done
42    
43    # fetch cmdline
44    for argv in $*
45    do
46     case $1 in
47     --liveroot) shift; cmdliveroot="$1" ;;
48     --imageroot) shift; cmdimageroot="$1" ;;
49     --installroot) shift; cmdinstallroot="$1" ;;
50     --filesystem) shift; cmdformatfilesystem="$1" ;;
51     --help)
52     echo "$0 options:"
53     echo " --liveroot [path]     - override default liveroot"
54     echo " --imageroot [path]    - override default imageroot"
55     echo " --installroot [path]  - override default installroot"
56     echo " --filesystem [fstype] - override default filesystem used to format the disk"
57     exit 0 ;;
58     esac
59     shift
60    done
61    
62  ### System/Config Version  ### System/Config Version
63  VERSION="%VERSIONTAG%"  VERSION="%VERSIONTAG%"
64  TITLE="${DEFAULT_TITLE} - ${VERSION}"  TITLE="${DEFAULT_TITLE} - ${VERSION}"
65    
66  CDPATH="${DEFAULT_CDPATH}"  # initialize global variables so they are exportable
67  INSTALLPATH="${DEFAULT_INSTALLPATH}"  # some sane defaults
68    INSTALL_METHOD=""
69  ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  if [[ -n ${cmdliveroot} ]]
70  CURRENTLINE=0  then
71  #TOTALLINES=11072 # -> now in images.conf   LIVEROOT="${cmdliveroot}"
72    else
73  # standard kernel opts   LIVEROOT="${DEFAULT_LIVEROOT}"
74  KERNELOPTS="quiet video=1024x768"  fi
75    if [[ -n ${cmdimageroot} ]]
76  # grub options  then
77     IMAGEROOT="${cmdimageroot}"
78    else
79     IMAGEROOT="${DEFAULT_IMAGEROOT}"
80    fi
81    if [[ -n ${cmdinstallroot} ]]
82    then
83     INSTALLROOT="${cmdinstallroot}"
84    else
85     INSTALLROOT="${DEFAULT_INSTALLROOT}"
86    fi
87    KERNELPKG="${DEFAULT_KERNELPKG}"
88    KERNELOPTS="${DEFAULT_KERNELOPTS}"
89  GRUBLEGACYOPTS=""  GRUBLEGACYOPTS=""
90  GRUB2OPTS=""  GRUB2OPTS=""
   
 # fdisk options  
91  FDISKPARTIONBELOW256MB=0  FDISKPARTIONBELOW256MB=0
   
 # default specialdevices  
92  SPECIALDEVICE=""  SPECIALDEVICE=""
93  FORMFACTOR="desktop"  FORMFACTOR="${DEFAULT_FORMFACTOR}"
94    if [[ -n ${cmdformatfilesystem} ]]
95    then
96     FORMAT_FILESYSTEM="${cmdformatfilesystem}"
97    else
98     FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"
99    fi
100    FLASHDISK=0
101    
102  # target filesystem  # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 !
103  FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}"  # -> now in images.conf
104    CDIMAGENAME=""
105    TOTALLINES=""
106    CURRENTLINE=0
107    if [ -e ${IMAGEROOT}/images.conf ]
108    then
109     source ${IMAGEROOT}/images.conf
110     # check if all required variables are set
111     [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf"
112     [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf"
113    else
114     die "${IMAGEROOT}/images.conf not found"
115    fi
116    
117  #################################################  ### helper scripts ###
 #  DIALOG BOXEN #  
 #################################################  
118    
119  die()  trap_exit()
120  {  {
121   ERROR=$1   is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev
122   RETVAL=$?   is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc
123   dialog_install_failure   is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys
124   exit 1   is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot
125  }   is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT}
126     [[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD}
127    
128  dialog_warning()   echo $"Installation aborted."
129  {   exit 1
  dialog \  
  --backtitle "${TITLE}" \  
  --colors \  
  --defaultno \  
  --yesno "\Z1 !!! Achtung !!! \Zn\n\n\  
  Diese Festplatte wird unwiederruflich geloescht werden.\n\n\  
  Soll ich wirklich fortfahren ?" 10 70  
  RES=$?  
  if [[ ${RES} -eq 1 ]]  
  then  
  clear  
  echo "Der Vorgang wurde abgebrochen."  
  exit 1  
  fi  
130  }  }
131    
132  dialog_setup_hdd_info()  install_meter()
133  {  {
134   local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
135     do
136   dialog \   CURRENTLINE=$(grep -c . /tmp/install.log)
137   --colors \   PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
138   --title "[ Festplatten Partitionierung ]" \   echo ${PERCENT}
139   --backtitle "${TITLE}" \   sleep 1
140   --ok-label "Weiter" \   done
141   --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\   rm -f /tmp/install.log
142   [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\   return 0
  [ \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()  
 {  
  local SHDD="$(echo $HDD | sed 's/\/dev\///')"  
   
  dialog \  
  --colors \  
  --title "[ Festplatten Partitionierung ]" \  
  --backtitle "${TITLE}" \  
  --ok-label "Weiter" \  
  --msgbox "\nBitte legen Sie 1 Partition an.\n\n\  
  [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\  
  Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81  
 }  
   
 dialog_setup_hdd_info_auto()  
 {  
  local SHDD="$(echo $HDD | sed 's/\/dev\///')"  
   
  dialog \  
  --colors \  
  --title "[ Festplatten Partitionierung ]" \  
  --backtitle "${TITLE}" \  
  --ok-label "Weiter" \  
  --msgbox "\nAchtung!\n\  
  Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81  
 }  
   
 dialog_setup_system_menu()  
 {  
  local i  
   
  i=$(dialog \  
  --backtitle "${TITLE}" \  
  --title "[ Festplatten Partitionierung ]" \  
  --cancel-label "Abbrechen" \  
  --ok-label "Weiter" \  
  --stdout \  
  --colors \  
  --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \  
  "1" "Automatisches Setup (Empfohlen)" \  
  "" "" \  
  "" "\Z1Experten Modi:\Zn" \  
  "2" "Normale IDE-Disk (Manuell)" \  
  "3" "Flash-Speicher (Manuell)")  
  RES=$?  
  [[ ${RES} -eq 1 ]] && return 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  case "${i}" in  
  "1") run_install_auto ;;  
          "2") run_install_normal ;;  
  "3") run_install_flash ;;  
  "") dialog_setup_system_menu;;  
  esac  
  fi  
143  }  }
144    
145  dialog_hardware_detection()  mount_rootfs()
146  {  {
147   local i   local retval
  local hwtmp  
   
  if [ -x $(which mktemp &> /dev/null) ]  
  then  
  hwtmp="$(mktemp)"  
  else  
  hwtmp="/tmp/hwtmp.sh"  
  fi  
   
  [[ ! -z ${installdevs} ]] && installdevs=""  
   
  echo "dialog \\"  > ${hwtmp}  
  echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}  
  echo "--ok-label \"Weiter\" \\" >> ${hwtmp}  
  echo "--stdout \\" >> ${hwtmp}  
  echo "--colors \\" >> ${hwtmp}  
  echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}  
  echo " Festplatten:\n \\" >> ${hwtmp}  
   
  if [[ ! -z ${scsidisks} ]]  
  then  
  for i in ${scsidisks}  
  do  
  if [[ ${i} != ${cdromdev} ]]  
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
  done  
  fi  
   
  if [[ ! -z ${idedisks} ]]  
  then  
  for i in ${idedisks}  
  do  
  if [[ ${i} != ${cdromdev} ]]  
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
  done  
  fi  
   
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
  # other devices  
  run_hardware_detection  
  case "${SPECIALDEVICE}" in  
  zotac*) echo " \n\n\n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;  
  rangee) echo " \n\n\n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;  
  maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;  
  *) echo " \n\n\n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;  
  esac  
  if [[ ${FORMFACTOR} = laptop ]]  
  then  
  echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}  
  fi  
   
  echo " \" 14 70" >> ${hwtmp}  
  chmod a+x ${hwtmp}  
  ${hwtmp}  
148    
149   # remove tmp file   if [[ -n ${SWAPHDD} ]]
  if [[ -f ${hwtmp} ]]  
150   then   then
151   rm ${hwtmp}   swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'"
152   fi   fi
 }  
   
 dialog_setup_hdd_partitions_manuell()  
 {  
  local i  
153    
154   if [[ -z ${installdevs} ]]   if [[ -n ${ROOTHDD} ]]
155   then   then
156   dialog \   if is_mounted --location "${INSTALLROOT}"
  --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 ]]  
157   then   then
158   dialog_setup_hdd_info   echo $"${INSTALLROOT} already mounted" >&2
159   setup_hdd_partitions_manuell   else
160     mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'"
161   fi   fi
162   fi   fi
 }  
163    
164  dialog_setup_hdd_partitions_manuell_flash()   [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot
 {  
  local i  
165    
166   if [[ -z ${installdevs} ]]   if [[ -n ${BOOTHDD} ]]
167   then   then
168   dialog \   if is_mounted --location "${INSTALLROOT}"/boot
  --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 ]]  
169   then   then
170   dialog_setup_hdd_info_flash   echo $"${INSTALLROOT}/boot already mounted" >&2
171   setup_hdd_partitions_manuell_flash   else
172     mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'"
173   fi   fi
174   fi   fi
175  }  }
176    
177  dialog_setup_hdd_partitions_auto()  umount_rootfs()
178  {  {
179   local i   is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot
180     is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT}
181    
182   if [[ -z ${installdevs} ]]   if [[ -n ${SWAPHDD} ]]
183   then   then
184   dialog \   swapoff ${SWAPHDD} || die
  --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_auto  
  dialog_setup_hdd_create_partitions  
  setup_hdd_partitions_auto  
  fi  
185   fi   fi
186  }  }
187    
188  dialog_setup_hdd_create_partitions()  install_do_reboot()
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Erstelle Disk Partitionen ..." 3 70  
 }  
   
 dialog_setup_hdd_format()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Erstelle Datei-Systeme ..." 3 70  
 }  
   
 dialog_install_settings()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Speichere System-Einstellungen ..." 3 70  
 }  
   
 dialog_install_system_image()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --gauge "Kopiere System-Image ..." 6 80  
 }  
   
 dialog_install_meter()  
 {  
  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  
 }  
   
   
 dialog_install_bootsector()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --infobox "Schreibe den Bootsektor ..." 3 70  
 }  
   
 dialog_install_successful()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --colors \  
  --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81  
 }  
   
 dialog_install_failure()  
 {  
  dialog \  
  --backtitle "${TITLE}" \  
  --colors \  
  --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\  
  Fehler bei ${ERROR}, RetVal: ${RETVAL} \  
  " 10 81  
 }  
   
 dialog_main()  
189  {  {
190   METHOD=0   reboot
   
  while [[ ${METHOD} -le 2 ]]  
  do  
  METHOD=$(dialog \  
  --backtitle "${TITLE}" \  
  --no-cancel \  
  --ok-label "Weiter" \  
  --stdout \  
  --menu "Konfiguration" 14 70 5 \  
  "1" "AutoSta_LX installieren" \  
  "2" "Uebersicht gefundener Laufwerke" \  
  "3" "Beenden und neustarten" \  
  "4" "Beenden und eine Shell starten")  
  RES=$?  
  [[ ${RES} -eq 1 ]] && exit 1  
  if [[ ${RES} -eq 0 ]]  
  then  
  case ${METHOD} in  
          "1") dialog_setup_system_menu ;;  
  "2") dialog_hardware_detection ;;  
  "3") install_do_reboot ;;  
  "4") /bin/bash --login -i ;;  
  esac  
  fi  
  done  
191  }  }
192    
 #################################################  
 # Install Komandos #  
 #################################################  
193  run_hardware_detection()  run_hardware_detection()
194  {  {
195   local hwinfo   local hwinfo
   
196   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
197    
198   # check for special devices/clients:   # check for special devices/clients:
# Line 467  run_hardware_detection() Line 205  run_hardware_detection()
205   if [[ $(< ${i}) = 1 ]]   if [[ $(< ${i}) = 1 ]]
206   then   then
207   removable=1   removable=1
208     # we assume that all removable disks are flash disks on a zotac
209     export FLASHDISK=1
210   fi   fi
211   done   done
212     # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card'
213    
214   # 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
215   export GRUBLEGACYOPTS="rootdelay=8"   export GRUBLEGACYOPTS="rootdelay=8"
# Line 499  run_hardware_detection() Line 240  run_hardware_detection()
240   export GRUBLEGACYOPTS=""   export GRUBLEGACYOPTS=""
241   fi   fi
242    
243     # check for i845 Chipsets and enable KMS and use 915 drm driver later in initrd
244     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
245     then
246     export SPECIALDEVICE="i845"
247     # unset default video=1024x768 opt or the drm driver breaks
248     export KERNELOPTS="quiet"
249     export GRUBLEGACYOPTS=""
250     # enable full kms support
251     export GRUB2GFXPAYLOAD="keep"
252     fi
253    
254     # check for radeon gfxcards
255     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
256     then
257     # enable full kms support
258     export GRUB2GFXPAYLOAD="keep"
259     fi
260    
261     # requires nomsi to prevent massive IRQ error spam
262     # see: http://ubuntuforums.org/showthread.php?t=1234983
263     if [[ ! -z $(echo "${hwinfo}" | grep -i 'P5VD2-X') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VT8237') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VX700') ]]
264     then
265     export SPECIALDEVICE="nomsi"
266     export KERNELOPTS="${KERNELOPTS} pci=nomsi,noaer"
267     fi
268    
269   # check for special devices/clients:   # check for special devices/clients:
270   # check for laptops and activate cpufreq scaling   # check for laptops and activate cpufreq scaling
271   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
# Line 508  run_hardware_detection() Line 275  run_hardware_detection()
275   fi   fi
276  }  }
277    
278  hdd_size_below_256mb()  run_hardware_detection_disks()
279  {  {
280   local hdd="$1"   local bootdev
  local size  
  local retval  
  [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"  
281    
282   size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')   # all disks but exclude ramdisks
283   if [[ ${size} -le 257000000 ]]   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
284     # remove the boot device from ALL_DISKS if it was an usbstick
285     if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
286   then   then
287   retval="0"   bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')
288   else   export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
  retval="1"  
289   fi   fi
290     export ALL_CDROMS="$(get_hwinfo cdrom)"
  return "${retval}"  
291  }  }
292    
293  setup_hdd_partitions_auto()  auto_partition_clear_disk()
294  {  {
295   ROOTHDD="${HDD}1"   if [ -e ${HDD} ]
   
  # run this only if FDISKPARTITIONBELOW256MB is not already 1  
  if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]  
296   then   then
297   if hdd_size_below_256mb ${HDD}   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die
298   then   else
299   FDISKPARTIONBELOW256MB=1   echo "clear disk: device ${HDD} does not exist" >&2
  else  
  FDISKPARTIONBELOW256MB=0  
  fi  
300   fi   fi
301    }
302    
303   ## delete disk  auto_partition_command()
304   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die  {
305     if [ -e ${HDD} ]
  if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]  
306   then   then
  ## setup one bootable partition  
  #1. n= new disk  
  #2. p= primary disk  
  #3. 1= first partition  
  #4. 2= default sector start // small disk needs more space for grub2 mbr sector  
  #5. ''= defaul sector end  
  #6. a= bootable flag  
  #7. 1= boot flag for partition 1  
  #8. w= write/quit  
307   fdisk ${HDD} &> /dev/null << EOF   fdisk ${HDD} &> /dev/null << EOF
308  n  $(echo "${PARTITION_OPTS}")
 p  
 1  
 2  
   
 a  
 1  
 w  
309  EOF  EOF
310   else   else
311   ## setup one bootable partition   echo "partition command: device ${HDD} does not exist" >&2
  #1. n= new disk  
  #2. p= primary disk  
  #3. 1= first partition  
  #4. ''= default sector start  
  #5. ''= defaul sector end  
  #6. a= bootable flag  
  #7. 1= boot flag for partition 1  
  #8. w= write/quit  
  fdisk ${HDD} &> /dev/null << EOF  
 n  
 p  
 1  
   
   
 a  
 1  
 w  
 EOF  
312   fi   fi
313  }  }
314    
315  setup_hdd_partitions_manuell()  setup_hdd_partitions()
 {  
  BOOTHDD="${HDD}1"  
  SWAPHDD="${HDD}2"  
  ROOTHDD="${HDD}3"  
   
  ## hdds partitionieren manuell  
  cfdisk ${HDD} || die  
 }  
   
 setup_hdd_partitions_manuell_flash()  
 {  
  ROOTHDD="${HDD}1"  
   
  ## hdds partitionieren manuell  
  cfdisk ${HDD} || die  
 }  
   
 setup_hdd_format()  
 {  
  mkswap ${SWAPHDD} || die  
  mke2fs -j -q ${BOOTHDD} || die  
  mke2fs -j -q ${ROOTHDD} || die  
 }  
   
 setup_hdd_format_flash()  
316  {  {
317   mke2fs -j -q ${ROOTHDD} || die   local partition_number
318  }   local partition_type
319     local partition_start_sector
320  install_mount_rootfs()   local partition_size
 {  
  swapon ${SWAPHDD} || die  
  mount ${ROOTHDD} ${INSTALLPATH} || die  
  install -d ${INSTALLPATH}/boot || die  
  mount ${BOOTHDD} ${INSTALLPATH}/boot || die  
  cd ${INSTALLPATH} || die  
 }  
321    
322  install_mount_rootfs_flash()   # sanity check - should not happen
323  {   if is_mounted --device "${ROOTHDD}"
324   mount ${ROOTHDD} ${INSTALLPATH} || die   then
325   install -d ${INSTALLPATH}/boot || die   echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2
326   cd ${INSTALLPATH} || die   umount "${ROOTHDD}"
327  }   fi
328     if [[ -n ${BOOTHDD} ]]
 install_system_image()  
 {  
  tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}  
 }  
   
 install_bootsector_chroot()  
 {  
  local my_roothdd  
  local grubconf=${INSTALLPATH}/boot/grub/grub.conf  
  local grub2conf=/boot/grub/grub.cfg  
   
  # check for grub2  
  if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]  
329   then   then
330   # needed by grub-mkconfig on the first run   if is_mounted --device "${BOOTHDD}"
  if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]  
331   then   then
332   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die   echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2
333     umount "${BOOTHDD}"
334   fi   fi
335     fi
336    
337   # set kernelopts   if [[ ${INSTALL_METHOD} = auto ]]
338   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   then
339     # run this only if FDISKPARTITIONBELOW256MB is not already 1
340     if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
341   then   then
342   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die   if device_minimum_size "${HDD}" 256
343   else   then
344   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die   FDISKPARTIONBELOW256MB=1
345     else
346     FDISKPARTIONBELOW256MB=0
347     fi
348   fi   fi
  echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die  
  echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die  
  echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die  
  echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die  
   
  # grub-legacy  
  else  
  ### grubconf schreiben  
  source ${INSTALLPATH}/boot/kernelversion  
349    
350   #for alx only   ## delete disk
351   if [ -e ${INSTALLPATH}/etc/alx_version ]   auto_partition_clear_disk
  then  
  OLD_ALXVER="${ALXVER}"  
  source ${INSTALLPATH}/etc/alx_version  
  KRNVER="ALX-${ALXVER}"  
  ALXVER="${OLD_ALXVER}"  
  fi  
352    
353   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"   # setup partition options
354   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"   export PARTITION_OPTS
  [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"  
355    
356   # uuid support   if [[ -n ${BOOTHDD} ]]
  if is_uuid_supported  
357   then   then
358   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"   # create a boot disk with 50meg size - bootable
359   else   partition_type="p"
360   my_roothdd="${ROOTHDD}"   partition_number="1"
361   fi   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
362     then
363     # 2= default sector start // small disk needs more space for grub2 mbr sector
364     partition_start_sector="2"
365     else
366     # '' use default sector start
367     partition_start_sector=""
368     fi
369     # 50meg size
370     partition_size="+50M"
371    
372   : > ${grubconf} || die   # create a boot disk with 50meg size - bootable
373   echo "default 0" >> ${grubconf} || die   # n= new disk
374   echo "timeout 3" >> ${grubconf} || die   # p= primary disk
375   # using current root password   # w= write/quit
376   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die   PARTITION_OPTS="n
377    ${partition_type}
378    ${partition_number}
379    ${partition_start_sector}
380    ${partition_size}
381    w"
382     # create the disk
383     auto_partition_command
384    
385     # mark the disk bootable
386     PARTITION_OPTS="a
387    ${partition_number}
388    w"
389     auto_partition_command
390    
  echo  >> ${grubconf} || die  
  echo "# normal boot" >> ${grubconf} || die  
  echo "title ${KRNVER}" >> ${grubconf} || die  
  echo "root (hd0,0)" >> ${grubconf} || die  
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die  
  if is_initrd_supported  
  then  
  echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die  
391   fi   fi
392    
393   echo >> ${grubconf} || die   if [[ -n ${SWAPHDD} ]]
394   echo "# admin boot" >> ${grubconf} || die   then
395   echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die   # p= primary disk
396   echo "lock"  >> ${grubconf} || die   partition_type="p"
397   echo "root (hd0,0)" >> ${grubconf} || die   if [[ -n ${BOOTHDD} ]]
398   echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die   then
399   if is_initrd_supported   # boot disk exist, partition 2
400   then   partition_number="2"
401   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   else
402     # boot disk does not exist, partition 1
403     partition_number="1"
404     fi
405     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
406     then
407     # fake sector 2 and fdisk finds the next free sector which must be selected with enter
408     partition_start_sector="2
409    "
410     else
411     # '' use default sector start
412     partition_start_sector=""
413     fi
414     partition_start_sector=""
415     # +2G disk size
416     partition_size="+2G"
417    
418     # create a swap disk with 2GB size
419     PARTITION_OPTS="n
420    ${partition_type}
421    ${partition_number}
422    ${partition_start_sector}
423    ${partition_size}
424    w"
425     # create the disk
426     auto_partition_command
427    
428     # mark disk as swap space
429     PARTITION_OPTS="
430    t"
431     if [[ ${partition_number} != 1 ]]
432     then
433     PARTITION_OPTS+="
434    ${partition_number}"
435     fi
436     PARTITION_OPTS+="
437    82
438    w"
439     auto_partition_command
440   fi   fi
441    
442   echo >> ${grubconf} || die   if [[ -n ${ROOTHDD} ]]
  echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die  
  echo "lock"  >> ${grubconf} || die  
  echo "root (hd0,0)" >> ${grubconf} || die  
  echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die  
  if is_initrd_supported  
443   then   then
444   echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die   # p= primary disk
445   fi   partition_type="p"
446     if [[ -z ${BOOTHDD} ]] && [[ -z ${SWAPHDD} ]]
447     then
448     # boot and swap disk does not exist, partition 1
449     partition_number="1"
450     fi
451     if [[ -n ${BOOTHDD} ]] || [[ -n ${SWAPHDD} ]]
452     then
453     # boot or swap disk exist, partition 2
454     partition_number="2"
455     fi
456     if [[ -n ${BOOTHDD} ]] && [[ -n ${SWAPHDD} ]]
457     then
458     # boot and swap disk does exist, partition 3
459     partition_number="3"
460     fi
461     if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
462     then
463     if [[ -z ${BOOTHDD} ]]
464     then
465     # 2= default sector start // small disk needs more space for grub2 mbr sector
466     partition_start_sector="2"
467     else
468     # fake sector 2 and fdisk finds the next free sector which must be selected with enter
469     partition_start_sector="2
470    "
471     fi
472     else
473     # '' use default sector start
474     partition_start_sector=""
475     fi
476     # '' default sector end
477     partition_size=""
478    
479   # bootsector schreiben chrooted schreiben (lfs/magellan)   # create system disk with remaining space
480   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   # w= write/quit
481  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   PARTITION_OPTS="n
482  root (hd0,0)  ${partition_type}
483  setup (hd0)  ${partition_number}
484  quit  ${partition_start_sector}
485  EOF  ${partition_size}
486  exit 0  w"
487  CHROOTEOF   # create the disk
488     auto_partition_command
489    
490     # no boot disk? then this is the boot disk
491     if [[ -z ${BOOTHDD} ]]
492     then
493     # mark the disk bootable
494     PARTITION_OPTS="a
495    ${partition_number}
496    w"
497     auto_partition_command
498     fi
499     fi
500     else
501     cfdisk ${HDD} || dialog_die
502   fi   fi
503    }
504    
505   ## enters chroot  setup_hdd_format()
506   mount -t proc proc ${INSTALLPATH}/proc  {
507   mount -t sysfs sysfs ${INSTALLPATH}/sys   install -d /tmp
508   mount -o bind /dev ${INSTALLPATH}/dev   :> /tmp/format.log
  chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i  
  umount ${INSTALLPATH}/proc  
  umount ${INSTALLPATH}/sys  
  umount ${INSTALLPATH}/dev  
  rm ${INSTALLPATH}/root/.installrc  
 }  
   
 is_initrd_supported()  
 {  
  # only generate initrds if the cmd exists  
  [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0  
  return 1  
 }  
   
 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  
509    
510   if [[ ${FORMFACTOR} = laptop ]]   if [[ -n ${SWAPHDD} ]]
511   then   then
512   OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"   # sanity check - should not happen
513     if is_mounted --device "${SWAPHDD}"
514     then
515     echo "format: device ${SWAPHDD} is already mounted, umount it" >&2
516     umount "${SWAPHDD}"
517     fi
518     mkswap ${SWAPHDD} || die
519   fi   fi
520    
521   # install an appropriate uvesafb.conf   if [[ -n ${BOOTHDD} ]]
522   install -d ${INSTALLPATH}/etc/modprobe.d || die   then
523   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die   # sanity check - should not happen
524     if is_mounted --device "${BOOTHDD}"
525   # install an appropriate viafb.conf   then
526   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die   echo "format: device ${BOOTHDD} is already mounted, umount it" >&2
527     umount "${BOOTHDD}"
528   # install an appropriate i810fb.conf   fi
  echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLPATH}/etc/modprobe.d/i810fb.conf || die  
   
  cat > ${INSTALLPATH}/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  
529    
530   ## enters chroot   mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die
531   mount -t proc proc ${INSTALLPATH}/proc   fi
  mount -t sysfs sysfs ${INSTALLPATH}/sys  
  mount -o bind /dev ${INSTALLPATH}/dev  
  chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i  
  umount ${INSTALLPATH}/proc  
  umount ${INSTALLPATH}/sys  
  umount ${INSTALLPATH}/dev  
  rm ${INSTALLPATH}/root/.installrc  
 }  
532    
533  is_uuid_supported()   if [[ -n ${ROOTHDD} ]]
 {  
  if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]  
534   then   then
535   # only detect uuids if supported   # sanity check - should not happen
536   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   if is_mounted --device "${ROOTHDD}"
537   then   then
538   return 0   echo "format: device ${ROOTHDD} is already mounted, umount it" >&2
539     umount "${ROOTHDD}"
540   fi   fi
  fi  
541    
542   return 1   mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die
543     fi
544  }  }
545    
546  get_uuid()  install_system_image()
547  {  {
548   local UUID   pushd ${INSTALLROOT} > /dev/null
549   local SEC_TYPE   tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT}
550   local TYPE   popd > /dev/null
   
  local dev="$1"  
  [[ -z ${dev} ]] && die "no dev given"  
   
  # check if given device is already an UUID  
  if [[ ${dev/UUID=/}x != ${dev}x ]]  
  then  
  eval "${dev}"  
  else  
  eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')  
  fi  
  echo "${UUID}"  
551  }  }
552    
553  install_system_settings()  install_system_settings()
554  {  {
555   # schreibe fstab   local CONFIG
556   if is_uuid_supported  
557     # write fstab
558     CONFIG="${INSTALLROOT}/etc/fstab"
559     clearconfig
560     if [[ -n ${BOOTHDD} ]]
561   then   then
562   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1"
563   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   fi
564   else   if [[ -n ${ROOTHDD} ]]
565   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die   then
566   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
567     fi
568     if [[ -n ${SWAPHDD} ]]
569     then
570     addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
571   fi   fi
572   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
573   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die   addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
  echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
574    
575   # install network config skeleton   # install network config skeleton
576   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die   CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0"
577     clearconfig
578   # intel framebufer quirk   addconfig 'ONBOOT="yes"'
579   if [[ -e /proc/fb ]]   addconfig 'NETWORKING="dhcp"'
580    
581     # intel framebuffer quirk
582     CONFIG="${INSTALLROOT}/etc/splash/splash.conf"
583     if [ -e ${CONFIG} ] && [ -e /proc/fb ]
584   then   then
585   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]   if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
586   then   then
587   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
588   if [[ ${fbdev} != 0 ]]   [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die
  then  
  sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die  
  fi  
589   fi   fi
590   fi   fi
591  }  }
592    
593  install_system_settings_flash()  
594    ### installer dialogs ###
595    
596    dialog_die()
597  {  {
598   # schreibe fstab   ERROR="$1"
599   if is_uuid_supported   RETVAL="$?"
600   then   dialog_install_failure
601   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die   exit 1
  else  
  echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die  
  fi  
  echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
  echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die  
602  }  }
603    
604  install_umount_rootfs()  dialog_warning()
605  {  {
606   cd /   local retval
607   umount ${INSTALLPATH}/boot || die  
608   umount ${INSTALLPATH} || die   yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?"
609   swapoff ${SWAPHDD} || die   retval=$?
610     if [[ ${retval} -eq 1 ]]
611     then
612     clear
613     echo $"The process was aborted."
614     exit 1
615     fi
616  }  }
617    
618  install_umount_rootfs_flash()  
619    ### installer tasks ###
620    
621    task_setup_system_menu()
622  {  {
623   cd /   local mode
624   umount ${INSTALLPATH} || die   local retval
625    
626     mode="$(dialog_setup_system_menu)"
627     retval=$?
628     [[ ${retval} -eq 1 ]] && return 1
629     if [[ ${retval} -eq 0 ]]
630     then
631     case "${mode}" in
632     "1") run_install auto ;;
633     "2") run_install normal ;;
634     "") task_setup_system_menu;;
635     esac
636     fi
637  }  }
638    
639  install_do_reboot()  task_hardware_detection()
640  {  {
641   reboot   local message
 }  
642    
643  #################################################   run_hardware_detection_disks
 #     Install Ablauf Scripte #  
 #################################################  
644    
645  run_install_normal()   message+=$"Harddrives:\n"
 {  
  dialog_hardware_detection  
646    
647   dialog_setup_hdd_partitions_manuell   if [[ ! -z ${ALL_DISKS} ]]
648   dialog_setup_hdd_format   then
649   setup_hdd_format > /dev/null   for i in ${ALL_DISKS}
650   install_mount_rootfs   do
651   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   message+="\Z3${i}\Zn "
652     done
653     message+="\n"
654     fi
655    
656   dialog_install_settings   if [[ ! -z ${ALL_CDROMS} ]]
657   sleep 1   then
658   install_system_settings   message+="\n"
659   install_initrd_chroot   message+=$"Optical disk drives:\n"
660     for i in ${ALL_CDROMS}
661     do
662     message+="\Z3${i}\Zn"
663     done
664     message+="\n"
665     fi
666    
667   dialog_install_bootsector   # other devices
668   install_bootsector_chroot   run_hardware_detection
669     case "${SPECIALDEVICE}" in
670     zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;;
671     rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;;
672     maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;;
673     i845) message+=$"\n\Z2Intel i845 VGA device detected.\Zn" ;;
674     nomsi) message+=$"\n\Z2Mainboard with P5VD2-X/VT8237/VX700 chipset detected.\Zn"
675     message+=$"\n\Z2Disabling Message Signaled Interrupts (MSI) capability of the kernel.\Zn" ;;
676     *) message+=$"\n\ZnCommon device detected.\Zn" ;;
677     esac
678     if [[ ${FORMFACTOR} = laptop ]]
679     then
680     message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn"
681     fi
682     if [[ ${FLASHDISK} = 1 ]]
683     then
684     message+=$"\n\ZnFlash memory detected.\Zn"
685     message+=$"\n\ZnF2FS will be used as default filesystem within the auto installation mode.\Zn"
686     fi
687    
688   install_umount_rootfs   messagebox -y 12 -h $"Detected hardware:" "${message}"
  dialog_install_successful  
689  }  }
690    
691  run_install_flash()  task_select_target_hdd()
692  {  {
693   dialog_hardware_detection   if [[ -z ${ALL_DISKS} ]]
694     then
695     dialog_no_harddrive_found
696     exit 1
697     else
698     export HDD=$(dialog_select_target_harddrive)
699     fi
700    }
701    
702   dialog_setup_hdd_partitions_manuell_flash  task_setup_hdd_partitions()
703   dialog_setup_hdd_format  {
704   setup_hdd_format_flash > /dev/null   local retval
  install_mount_rootfs_flash  
  (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image  
705    
706   dialog_install_settings   if [[ -z ${HDD} ]]
707   sleep 1   then
708   install_system_settings_flash   dialog_no_harddrive_found
709   install_initrd_chroot   exit 1
710     else
711     dialog_setup_hdd_info
712     setup_hdd_partitions
713     fi
714    }
715    
716   dialog_install_bootsector  task_main()
717   install_bootsector_chroot  {
718     local method=0
719     local retval
720    
721   install_umount_rootfs_flash   while [[ ${method} -le 2 ]]
722   dialog_install_successful   do
723     method=$(dialog_main)
724     retval=$?
725     [[ ${retval} -eq 1 ]] && exit 1
726     if [[ ${retval} -eq 0 ]]
727     then
728     case ${method} in
729     "1") task_setup_system_menu ;;
730     "2") task_hardware_detection ;;
731     "3") install_do_reboot ;;
732     "4") /bin/bash --login -i ;;
733     esac
734     fi
735     done
736  }  }
737    
738  run_install_auto()  run_install()
739  {  {
740   dialog_hardware_detection   local method="$1"
741    
742     task_hardware_detection
743     task_select_target_hdd
744    
745     case "${method}" in
746     auto)
747     if [[ ${FLASHDISK} = 1 ]]
748     then
749     export BOOTHDD="${HDD}1"
750     export SWAPHDD=""
751     export ROOTHDD="${HDD}2"
752     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
753     export FORMAT_FILESYSTEM_ROOTHDD="f2fs"
754     else
755     # ext4 seems not to be compatible again
756     if [[ ${FORMAT_FILESYSTEM} = ext4 ]]
757     then
758     export BOOTHDD="${HDD}1"
759     export SWAPHDD=""
760     export ROOTHDD="${HDD}2"
761     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
762     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
763     else
764     export BOOTHDD=""
765     export SWAPHDD=""
766     export ROOTHDD="${HDD}1"
767     export FORMAT_FILESYSTEM_BOOTHDD=""
768     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
769     fi
770     fi
771     export INSTALL_METHOD="${method}"
772     ;;
773     normal)
774     export BOOTHDD="${HDD}1"
775     export SWAPHDD="${HDD}2"
776     export ROOTHDD="${HDD}3"
777     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
778     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
779     export INSTALL_METHOD="${method}"
780     ;;
781     single)
782     export BOOTHDD=""
783     export SWAPHDD=""
784     export ROOTHDD="${HDD}1"
785     export FORMAT_FILESYSTEM_BOOTHDD=""
786     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
787     export INSTALL_METHOD="${method}"
788     ;;
789     flash)
790     export BOOTHDD="${HDD}1"
791     export SWAPHDD=""
792     export ROOTHDD="${HDD}2"
793     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
794     export FORMAT_FILESYSTEM_ROOTHDD="f2fs"
795     export INSTALL_METHOD="${method}"
796     ;;
797     *)
798     die "Unknown install method '${method}', aborting."
799     ;;
800     esac
801    
802   dialog_setup_hdd_partitions_auto   task_setup_hdd_partitions
803   dialog_setup_hdd_format   dialog_setup_hdd_format
804   setup_hdd_format_flash > /dev/null   setup_hdd_format > /dev/null
805   install_mount_rootfs_flash   mount_rootfs
806   (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 | install_meter | dialog_install_system_image
807    
808   dialog_install_settings   dialog_install_settings
809   sleep 1   sleep 1
810   install_system_settings_flash   install_system_settings
811   install_initrd_chroot   if is_initrd_supported
812     then
813     dialog_install_initrd
814     initrd_config
815     initrd_install
816     fi
817    
818   dialog_install_bootsector   dialog_install_bootsector
819   install_bootsector_chroot   bootloader_config
820     bootloader_install
821    
822   install_umount_rootfs_flash   umount_rootfs
823   dialog_install_successful   dialog_install_successful
824  }  }
825    
826  dialog_main  # set some proper traps
827    trap "trap_exit" SIGINT SIGQUIT
828    
829    task_main
830    
831  exit 0  exit 0

Legend:
Removed from v.2335  
changed lines
  Added in v.2948