Magellan Linux

Diff of /alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in

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

alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh revision 268 by niro, Tue Apr 19 17:24:57 2005 UTC alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in revision 6843 by niro, Thu Jul 23 13:26:00 2015 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  # $Id$
 # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.4 2005-04-19 17:24:57 niro Exp $  
 #  
 # AutoSta_LX Installation Script  
 # version: 0.8b  
 #  
 # Niels Rogalla <niro@magellan-linux.de>  
 # <rogalla@augusta-bochum.de>  
 #  
 #  
 # Install Navigation Gui  
 #  
3    
4  #source /etc/alx_version  # ignore environment!
5  #source /opt/alx-config/version  LC_ALL=C
6    
7  #source /etc/alx-config/config.rc  MLIBDIR="/usr/lib/alxinstall-ng"
8    
9  #images: (get ${CDIMAGENAME})  # images: (get ${CDIMAGENAME})
10  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
11    
12  #Includes  # includes
13  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null  source ${MLIBDIR}/functions/generic.sh
14  ### bugfix ###############################  source ${MLIBDIR}/functions/hwdetection.sh
 cdromdev="`echo $cdromdev|sed -e 's/ //'`"  
 ########################################  
15    
16  ### System/Config Version  ### System/Config Version
17  VERSION="0.1"  VERSION="@@VERSION@@"
18  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
19    
20  #CONFIGS_TEMPLATE="/opt/alx-config/configs"  # locations
   
21  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
22  INSTALLPATH="/mnt/magellan"  INSTALL_ROOT="/mnt/magellan"
23    
24  ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  # default system settings
25    # standard kernel opts
26    DEFAULT_KERNELOPTS="quiet video=1024x768"
27    
28    # grub options
29    DEFAULT_GRUBLEGACYOPTS=""
30    DEFAULT_GRUB2OPTS=""
31    DEFAULT_GRUB2GFXPAYLOAD="1024x768x16,1024x768"
32    
33    # default specialdevices
34    DEFAULT_FORMFACTOR="desktop"
35    
36    # target filesystem
37    DEFAULT_FORMAT_FILESYSTEM="ext4"
38    
39    # initialize global variables so they are exportable
40    INSTALL_METHOD=""
41    KERNELOPTS=""
42    GRUBLEGACYOPTS=""
43    GRUB2OPTS=""
44    GRUB2GFXPAYLOAD=""
45    FORMFACTOR=""
46    FORMAT_FILESYSTEM=""
47    FORMAT_FILESYSTEM_BOOTHDD=""
48    FORMAT_FILESYSTEM_ROOTHDD=""
49    FDISKPARTIONBELOW256MB=0
50    SPECIALDEVICE=""
51    FLASHDISK=0
52    ### linecount of system.tar.gz -1 !
53  CURRENTLINE=0  CURRENTLINE=0
54  #TOTALLINES=11072 # -> now in images.conf  #TOTALLINES=11072 # -> now in images.conf
55    
   
56  #################################################  #################################################
57  #  DIALOG BOXEN #  #  DIALOG BOXES #
58  #################################################  #################################################
59    
60  die() {  die()
61   #clear  {
  #echo -e "\nhuch, da ist ein script gestorben -> $?\n"  
  #read  
  #exit 0  
62   ERROR=$1   ERROR=$1
63   RETVAL=$?   RETVAL=$?
64   dialog_install_failure   dialog_install_failure
65     trap_exit
66   exit 1   exit 1
67  }  }
68    
69  dialog_warning() {  dialog_warning()
70    {
71   dialog \   dialog \
72   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
73   --colors \   --colors \
74   --defaultno \   --defaultno \
75   --yesno "\Z1 !!! Achtung !!! \Zn\n\n\   --yesno "\Z1 !!! Achtung !!! \Zn\n\n\
76   Diese Festplatte wird unwiederruflich geloescht werden.\n\n\   Diese Festplatte wird unwiederruflich geloescht werden.\n\n\
77   Soll ich wirklich fortfahren ?" 10 70   Soll ich wirklich fortfahren ?" 10 70
78   RES=$?   RES=$?
79   if [ "$RES" == "1" ]   if [[ ${RES} -eq 1 ]]
80   then   then
81   clear   clear
82   echo "Der Vorgang wurde abgebrochen."   echo "Der Vorgang wurde abgebrochen."
# Line 72  dialog_warning() { Line 84  dialog_warning() {
84   fi   fi
85  }  }
86    
87  dialog_setup_hdd_info(){  dialog_setup_hdd_info()
88   local SHDD="`echo $HDD|sed -e 's/\/dev\///'`"  {
89     case "${INSTALL_METHOD}" in
90     auto)
91     dialog_setup_hdd_info_auto
92     dialog_setup_hdd_create_partitions
93     ;;
94     normal) dialog_setup_hdd_info_normal ;;
95     single) dialog_setup_hdd_info_single ;;
96     flash) dialog_setup_hdd_info_flash ;;
97     esac
98    }
99    
100    dialog_setup_hdd_info_normal()
101    {
102     local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
103    
104   dialog \   dialog \
105   --colors \   --colors \
106   --title "[ Festplatten Partitionierung ]" \   --title "[ Festplatten Partitionierung ]" \
107   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
108   --ok-label "Weiter" \   --ok-label "Weiter" \
109   --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\   --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\
110   [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\   [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\
# Line 87  dialog_setup_hdd_info(){ Line 113  dialog_setup_hdd_info(){
113   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
114  }  }
115    
116  dialog_setup_hdd_menu() {  dialog_setup_hdd_info_single()
117    {
118     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
119    
120     dialog \
121     --colors \
122     --title "[ Festplatten Partitionierung ]" \
123     --backtitle "${TITLE}" \
124     --ok-label "Weiter" \
125     --msgbox "\nBitte legen Sie 1 Partition an.\n\n\
126     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\
127     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
128    }
129    
130    dialog_setup_hdd_info_flash()
131    {
132     local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
133    
134     dialog \
135     --colors \
136     --title "[ Festplatten Partitionierung ]" \
137     --backtitle "${TITLE}" \
138     --ok-label "Weiter" \
139     --msgbox "\nBitte legen Sie 2 Partitionen an.\n\n\
140     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit ca. 50MB\n\
141     [ \Z3${SHDD}2\Zn ] Typ: \Z3Linux \Zn mit dem Rest (min. 256MB)\n\n\
142     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
143    }
144    
145    dialog_setup_hdd_info_auto()
146    {
147     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
148    
149     dialog \
150     --colors \
151     --title "[ Festplatten Partitionierung ]" \
152     --backtitle "${TITLE}" \
153     --ok-label "Weiter" \
154     --msgbox "\nAchtung!\n\
155     Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81
156    }
157    
158    dialog_setup_system_menu()
159    {
160     local i
161    
162   I=`dialog \   i=$(dialog \
163   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
164   --title "[ Festplatten Partitionierung ]" \   --title "[ Festplatten Partitionierung ]" \
165   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
166   --ok-label "Weiter" \   --ok-label "Weiter" \
167   --stdout \   --stdout \
168   --menu "\nWaehlen Sie zwischen Manuell und Automatisch" 14 70 5 \   --colors \
169   "1" "Manuell" \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 6 \
170   "2" "Automatisch"`   "1" "Automatisches Setup (Empfohlen)" \
171     "" "" \
172     "" "\Z1Experten Modi:\Zn" \
173     "2" "Normale IDE-Disk (Manuell)" \
174     "3" "Normale IDE Disk (Single)" \
175     "4" "Flash SDHC/NAND oder USBStick (Manuell)")
176   RES=$?   RES=$?
177   if [ "$RES" == "1" ];then   [[ ${RES} -eq 1 ]] && return 1
178   return 1   if [[ ${RES} -eq 0 ]]
179   fi   then
180   if [ "$RES" == "0" ];then   case "${i}" in
181   case "$I" in   "1") run_install auto ;;
182           "1")   "2") run_install normal ;;
183   dialog_setup_hdd_found_manuell   "3") run_install single ;;
184   ;;   "4") run_install flash ;;
185   "2")   "") dialog_setup_system_menu;;
  dialog_warning  
  setup_hdd_partitions_silent  
      ;;  
186   esac   esac
187   fi   fi
188  }  }
189    
190  dialog_setup_hdd_found_manuell() {  dialog_hardware_detection()
191   if [ ! -z "$installdevs" ]  {
192     local i
193     local hwtmp
194    
195     if [ -x $(type -P mktemp) ]
196   then   then
197   installdevs=""   hwtmp="$(mktemp)"
198     else
199     hwtmp="/tmp/hwtmp.sh"
200   fi   fi
201    
202   echo "dialog \\"  > /tmp/hddtmp.sh   run_hardware_detection_disks
203   echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh  
204   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "dialog \\"  > ${hwtmp}
205   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
206   echo "--colors \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> ${hwtmp}
207   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> ${hwtmp}
208   echo " Festplatten:\n \\" >> /tmp/hddtmp.sh   echo "--colors \\" >> ${hwtmp}
209     echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
210     echo " Festplatten:\n \\" >> ${hwtmp}
211    
212   if [ ! -z "$scsidisks" ]   if [[ ! -z ${ALL_DISKS} ]]
213   then   then
214   for I in $scsidisks   for i in ${ALL_DISKS}
215   do   do
216   if [ "$I" != "$cdromdev" ]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3$I\\Zn\n \\" >> /tmp/hddtmp.sh  
  installdevs="$installdevs $I"  
  fi  
217   done   done
218   fi   fi
219    
220   if [ ! -z "$idedisks" ]   if [[ ! -z ${ALL_CDROMS} ]]
221   then   then
222   for I in $idedisks   echo " \n \\" >> ${hwtmp}
223     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
224     for i in ${ALL_CDROMS}
225   do   do
226   if [ "$I" != "$cdromdev" ]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3$I\\Zn\n \\" >> /tmp/hddtmp.sh  
  installdevs="$installdevs $I"  
  fi  
227   done   done
228   fi   fi
229    
230   if [ ! -z "$cdromdev" ]   # other devices
231     run_hardware_detection
232     case "${SPECIALDEVICE}" in
233     zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
234     rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
235     maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
236     i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
237     *) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
238     esac
239     if [[ ${FORMFACTOR} = laptop ]]
240     then
241     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
242     fi
243     if [[ ${FLASHDISK} = 1 ]]
244   then   then
245   echo " \n \\" >> /tmp/hddtmp.sh   echo " \n \\ZnFlash Speicher erkannt, F2FS wird als Dateisystem benutzt.\\Zn \\" >> ${hwtmp}
246   echo " \\Z7andere Laufwerke:\n \\" >> /tmp/hddtmp.sh   fi
247   echo " CDROM: \\Z3$cdromdev\\Zn\n \\" >> /tmp/hddtmp.sh  
248     echo " \" 14 70" >> ${hwtmp}
249     chmod a+x ${hwtmp}
250     ${hwtmp}
251    
252     # remove tmp file
253     if [[ -f ${hwtmp} ]]
254     then
255     rm ${hwtmp}
256   fi   fi
  echo " \" 13 70" >> /tmp/hddtmp.sh  
  chmod a+x /tmp/hddtmp.sh  
  /tmp/hddtmp.sh  
257  }  }
258    
259  dialog_setup_hdd_partitions_manuell() {  dialog_setup_hdd_partitions()
260   if [ -z "$installdevs" ]  {
261     local i
262    
263     if [[ -z ${ALL_DISKS} ]]
264   then   then
265   dialog \   dialog \
266   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
267   --ok-label "Beenden" \   --ok-label "Beenden" \
268   --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70   --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
269   exit 1   exit 1
270   else   else
271    
272   echo "dialog \\" > /tmp/hddtmp.sh   echo "dialog \\" > /tmp/hddtmp.sh
273   echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
274   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
275   echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh   echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
276   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
277   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
278    
279   for I in $installdevs   for i in ${ALL_DISKS}
280   do   do
281   echo "\"$I\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
282   done   done
283   echo -e "\n" >> /tmp/hddtmp.sh   echo -e "\n" >> /tmp/hddtmp.sh
284    
285   chmod a+x /tmp/hddtmp.sh   chmod a+x /tmp/hddtmp.sh
286   HDD="`/tmp/hddtmp.sh`"   HDD="$(/tmp/hddtmp.sh)"
287   RES=$?   RES=$?
288   if [ "$RES" == "1" ]   [[ ${RES} -eq 1 ]] && return 1
289   then   if [[ ${RES} -eq 0 ]]
  return 1  
  fi  
  if [ "$RES" == "0" ]  
290   then   then
291   dialog_setup_hdd_info   dialog_setup_hdd_info
292   setup_hdd_partitions_manuell   setup_hdd_partitions
293   fi   fi
294   fi   fi
295  }  }
296    
297  dialog_setup_hdd_partitions_silent() {  dialog_setup_hdd_create_partitions()
298    {
299   dialog \   dialog \
300   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
301   --infobox "Erstelle Partitionen ..." 3 70   --infobox "Erstelle Disk Partitionen ..." 3 70
302  }  }
303    
304  dialog_setup_hdd_format() {  dialog_setup_hdd_format()
305    {
306   dialog \   dialog \
307   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
308   --infobox "Erstelle Datei-Systeme ..." 3 70   --infobox "Erstelle Datei-Systeme ..." 3 70
309  }  }
310    
311  dialog_install_settings() {  dialog_install_settings()
312    {
313   dialog \   dialog \
314   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
315   --infobox "Speichere System-Einstellungen ..." 3 70   --infobox "Speichere System-Einstellungen ..." 3 70
316  }  }
317    
318  dialog_install_system_image() {  dialog_install_system_image()
319    {
320   dialog \   dialog \
321   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
322   --gauge "Kopiere System-Image ..." 6 80   --gauge "Kopiere System-Image ..." 6 80
323  }  }
324    
325  dialog_install_meter() {  dialog_install_meter()
326   while [ "${CURRENTLINE}" != "${TOTALLINES}" ] ; do  {
327   CURRENTLINE=`grep --count . /tmp/install.log`   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
328   PERCENT=`expr ${CURRENTLINE} \* 100 / ${TOTALLINES}`   do
329     CURRENTLINE=$(grep -c . /tmp/install.log)
330     PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
331   echo ${PERCENT}   echo ${PERCENT}
332   sleep 1   sleep 1
333   done   done
# Line 237  dialog_install_meter() { Line 335  dialog_install_meter() {
335   return 0   return 0
336  }  }
337    
338    dialog_install_bootsector()
339  dialog_install_bootsector() {  {
340   dialog \   dialog \
341   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
342   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
343  }  }
344    
345  dialog_install_alxconfig() {  dialog_install_successful()
346   dialog \  {
  --backtitle "$TITLE" \  
  --infobox "Installiere die ALX Setup-Tools ..." 3 70  
 }  
   
 dialog_install_kernel_image() {  
347   dialog \   dialog \
348   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
  --infobox "Installiere den System-Kernel ..." 3 70  
   
 }  
   
 dialog_install_hotfixes() {  
  dialog \  
  --backtitle "$TITLE" \  
  --infobox "Installiere Hotfixes ..." 3 70  
   
 }  
   
 dialog_install_successful() {  
  dialog \  
  --backtitle "$TITLE" \  
349   --colors \   --colors \
350   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81
351  }  }
352    
353  dialog_install_failure() {  dialog_install_failure()
354    {
355   dialog \   dialog \
356   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
357   --colors \   --colors \
358   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\
359   Fehler bei $ERROR, RetVal: $RETVAL \   Fehler bei ${ERROR}, RetVal: ${RETVAL} \
360   " 10 81   " 10 81
361  }  }
362    
363  dialog_install_method() {  dialog_main()
364    {
  METHOD=`dialog \  
  --backtitle "$TITLE" \  
  --cancel-label "Abbrechen" \  
  --ok-label "Weiter" \  
  --stdout \  
  --menu "Konfiguration" 14 70 5 \  
  "1" "Normale Installation" \  
  "2" "Silent Installation"`  
  RES=$?  
  if [ "$RES" == "1" ];then  
  return 1  
  fi  
  if [ "$RES" == "0" ];then  
  case "$METHOD" in  
          "1")  
  run_install_normal  
  ;;  
  "2")  
  dialog_warning  
  run_install_silent  
      ;;  
  esac  
  fi  
 }  
   
 dialog_main() {  
365   METHOD=0   METHOD=0
366    
367   while [ $METHOD -le 2 ]   while [[ ${METHOD} -le 2 ]]
368   do   do
369   METHOD=`dialog \   METHOD=$(dialog \
370   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
371   --no-cancel \   --no-cancel \
372   --ok-label "Weiter" \   --ok-label "Weiter" \
373   --stdout \   --stdout \
374   --menu "Konfiguration" 14 70 5 \   --menu "Konfiguration" 14 70 6 \
375   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
376   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
377   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
378   "4" "Beenden und eine Shell starten" `   "4" "Beenden und eine Shell starten")
379   RES=$?   RES=$?
380   if [ "$RES" == "1" ];then   [[ ${RES} -eq 1 ]] && exit 1
381   exit 1   if [[ ${RES} -eq 0 ]]
382   fi   then
383   if [ "$RES" == "0" ];then   case ${METHOD} in
384   case "$METHOD" in   "1") dialog_setup_system_menu ;;
385           "1")   "2") dialog_hardware_detection ;;
386   #only for now later it will be used again   "3") install_do_reboot ;;
387   #with 6.1-r2 only one install method available   "4") /bin/bash --login -i ;;
  #dialog_install_method  
  run_install_normal  
  ;;  
  "2") dialog_setup_hdd_found_manuell  
  ;;  
  "3") install_do_reboot  
  ;;  
  "4") /bin/bash --login -i  
  ;;  
388   esac   esac
389   fi   fi
390   done   done
391  }  }
392    
393  #################################################  #################################################
394  # Install Komandos #  # Install Commands #
395  #################################################  #################################################
396  setup_hdd_partitions_manuell() {  run_hardware_detection()
397   BOOTHDD="${HDD}1"  {
398   SWAPHDD="${HDD}2"   local hwinfo
399   ROOTHDD="${HDD}3"   hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
400    
401   ## hdds partitionieren manuell   # check for special devices/clients:
402   cfdisk $HDD || die   # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
403  }   local removable=0
404     if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
405  setup_hdd_partitions_silent() {   then
406   ## hdds löschen   for i in /sys/block/[hs]d*/removable
407   dd if=/dev/zero of=$HDD bs=1024k count=1 || die   do
408   ## hdds partitionieren silent   if [[ $(< ${i}) = 1 ]]
409   fdisk $HDD < $CONFIGS_TEMPLATE/fdisksettings #1> /dev/null 3> /dev/null || die   then
410     removable=1
411   read   # we assume that all removable disks are flash disks
412  }   export FLASHDISK=1
413     fi
414     done
415    
416  setup_hdd_format() {   # only add this for grub legacy, grub2 detect these settings on its own
417   mkswap $SWAPHDD || die   export GRUBLEGACYOPTS="rootdelay=8"
418   mke2fs -j -q $BOOTHDD || die   # there are two zotac types in the wild, nvidia based gfx and intel
419   mke2fs -j -q $ROOTHDD || die   if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
420  }   then
421     export SPECIALDEVICE="zotac_nvidia"
422     else
423     export SPECIALDEVICE="zotac_intel"
424     fi
425     fi
426    
427  install_mount_rootfs() {   # check for special devices/clients:
428   swapon $SWAPHDD || die   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
429   mount $ROOTHDD $INSTALLPATH || die   if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
430   install -d $INSTALLPATH/boot || die   then
431   mount $BOOTHDD $INSTALLPATH/boot || die   # for a rangee always define partion startblock +1
432   cd $INSTALLPATH || die   export FDISKPARTIONBELOW256MB="1"
433  }   export SPECIALDEVICE="rangee"
434     export GRUBLEGACYOPTS=""
435     fi
436    
437  install_system_image() {   # check for special devices/clients:
438   #tar xvzpf $CDPATH/system/autosta_lx.tar.gz   # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
439   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
440  }   then
441     export SPECIALDEVICE="maxdata"
442     export GRUBLEGACYOPTS=""
443     fi
444    
445     # check for i845 Chipsets and disable KMS and use 915 drm driver
446     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
447     then
448     export SPECIALDEVICE="i845"
449     # unset default video=1024x768 opt or the drm driver breaks
450     export KERNELOPTS="quiet"
451     export GRUBLEGACYOPTS=""
452     # enable full kms support
453     export GRUB2GFXPAYLOAD="keep"
454     fi
455    
456  install_kernel_image() {   # check for radeon gfxcards
457   declare -i CPUTYPE=`cat /proc/cpuinfo |grep "cpu family"|cut -d ' ' -f3`   if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
458     then
459     # enable full kms support
460     export GRUB2GFXPAYLOAD="keep"
461     fi
462    
463   if [ $CPUTYPE -le 5 ];then   # check for special devices/clients:
464                  #echo -e "\033[1;6m\033[36m""i386 Architektur gefunden.""\033[0m"   # check for laptops and activate cpufreq scaling
465                  #echo -e "Installiere i386 Kernel..."   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
466     then
467     export FORMFACTOR="laptop"
468     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
469     fi
470    }
471    
472   lastdir="`pwd`"  run_hardware_detection_disks()
473    {
474     local bootdev
475    
476   mkdir -p $INSTALLPATH/INSTALL/kernel || die   # all disks but exclude ramdisks
477   cd $INSTALLPATH/INSTALL/kernel || die   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
478   tar xzpf $CDPATH/kernels/kernel-i386.tar.gz || die   # remove the boot device from ALL_DISKS if it was an usbstick
479   source $INSTALLPATH/INSTALL/kernel/kernelversion || die   if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
480     then
481     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
482     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
483     fi
484     export ALL_CDROMS="$(get_hwinfo cdrom)"
485    }
486    
487   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNLIB $INSTALLPATH/lib/modules || die  hdd_size_below_256mb()
488   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNIMG $INSTALLPATH/boot || die  {
489   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNINITRD $INSTALLPATH/boot || die   local hdd="$1"
490   cp -aRf $INSTALLPATH/INSTALL/kernel/kernelversion $INSTALLPATH/boot || die   local size
491     local retval
492     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
493    
494   cd $lastdir || die   size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
495     if [[ ${size} -le 257000000 ]]
496     then
497     retval="0"
498     else
499     retval="1"
500     fi
501    
502          elif [ $CPUTYPE -ge 6 ];then   return "${retval}"
503                  #echo -e "\033[1;6m\033[36m""i686 Architektur gefunden.""\033[0m"  }
                 #echo -e "Installiere i686 Kernel..."  
504    
505   lastdir="`pwd`"  setup_hdd_partitions()
506    {
507     case "${INSTALL_METHOD}" in
508     normal)
509     BOOTHDD="${HDD}1"
510     SWAPHDD="${HDD}2"
511     ROOTHDD="${HDD}3"
512     ;;
513    
514     single|auto)
515     BOOTHDD=""
516     SWAPHDD=""
517     ROOTHDD="${HDD}1"
518     ;;
519    
520     flash)
521     BOOTHDD="${HDD}1"
522     SWAPHDD=""
523     ROOTHDD="${HDD}2"
524     ;;
525     esac
526    
527   mkdir -p $INSTALLPATH/INSTALL/kernel || die   if [[ ${INSTALL_METHOD} = auto ]]
528   cd $INSTALLPATH/INSTALL/kernel || die   then
529   tar xzpf $CDPATH/kernels/kernel-i686.tar.gz || die   # run this only if FDISKPARTITIONBELOW256MB is not already 1
530   source $INSTALLPATH/INSTALL/kernel/kernelversion || die   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
531     then
532     if hdd_size_below_256mb ${HDD}
533     then
534     FDISKPARTIONBELOW256MB=1
535     else
536     FDISKPARTIONBELOW256MB=0
537     fi
538     fi
539    
540   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNLIB $INSTALLPATH/lib/modules || die   ## delete disk
541   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNIMG $INSTALLPATH/boot || die   dd if=/dev/zero of=${HDD} count=1 &> /dev/null || die
  cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNINITRD $INSTALLPATH/boot || die  
  cp -aRf $INSTALLPATH/INSTALL/kernel/kernelversion $INSTALLPATH/boot || die  
542    
543   cd $lastdir || die   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
544          fi   then
545     ## setup one bootable partition
546     #1. n= new disk
547     #2. p= primary disk
548     #3. 1= first partition
549     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
550     #5. ''= defaul sector end
551     #6. a= bootable flag
552     #7. 1= boot flag for partition 1
553     #8. w= write/quit
554     fdisk ${HDD} &> /dev/null << EOF
555    n
556    p
557    1
558    2
559    
560    a
561    1
562    w
563    EOF
564     else
565     ## setup one bootable partition
566     #1. n= new disk
567     #2. p= primary disk
568     #3. 1= first partition
569     #4. ''= default sector start
570     #5. ''= defaul sector end
571     #6. a= bootable flag
572     #7. 1= boot flag for partition 1
573     #8. w= write/quit
574     fdisk ${HDD} &> /dev/null << EOF
575    n
576    p
577    1
578    
579    
580    a
581    1
582    w
583    EOF
584     fi
585     else
586     ## hdds partitionieren manuell
587     cfdisk ${HDD} || die
588     fi
589  }  }
590    
591  install_bootsector() {  setup_hdd_format()
592   ### grubconf schreiben  {
593   source $INSTALLPATH/INSTALL/kernel/kernelversion   if [[ -n ${SWAPHDD} ]]
   
  if [ -z $KRNVER ]  
594   then   then
595   KRNVER="AutoSta_LX"   mkswap ${SWAPHDD} || die
596   fi   fi
597     if [[ -n ${BOOTHDD} ]]
  if [ -z $KRNIMG ]  
598   then   then
599   KRNIMG="bzImage"   mkfs.${FORMAT_FILESYSTEM_BOOTHDD} -q ${BOOTHDD} || die
600   fi   fi
601     if [[ -n ${ROOTHDD} ]]
  if [ -z $KRNINITRD ]  
602   then   then
603   KRNINITRD="initrd"   mkfs.${FORMAT_FILESYSTEM_ROOTHDD} -q ${ROOTHDD} || die
604   fi   fi
   
  echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die  
  echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die  
  #no support for splash image in 6.1-r2  
  #echo -e "splashimage=(hd0,0)/boot/grub/splash.xpm.gz" >> $INSTALLPATH/boot/grub/grub.conf || die  
  echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die  
  echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  #s3 cards don't support this  
  #echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD vga=0x317 video:vesa:ywrap,mtrr splash=silent quiet" >> $INSTALLPATH/boot/grub/grub.conf || die  
  #that's more safer:  
  echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  #not needed without bootsplash support  
  #echo -e "initrd=/boot/${KRNINITRD}" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  ### bootsector schreiben  
  #grub --no-floppy < $CONFIGS_TEMPLATE/grubsettings || die  
  /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die  
 root (hd0,0)  
 setup (hd0)  
 quit  
 EOF  
605  }  }
606    
607  install_bootsector_chroot() {  install_mount_rootfs()
608   ### grubconf schreiben  {
609   #source $INSTALLPATH/INSTALL/kernel/kernelversion   local opts
  source $INSTALLPATH/boot/kernelversion  
610    
611   #for alx only   if [[ -n ${SWAPHDD} ]]
  if [ -e ${INSTALLPATH}/etc/alx_version ]  
612   then   then
613   OLD_ALXVER="${ALXVER}"   swapon ${SWAPHDD} || die
  source ${INSTALLPATH}/etc/alx_version  
  KRNVER="ALX-${ALXVER}"  
  ALXVER="${OLD_ALXVER}"  
614   fi   fi
615     if [[ -n ${ROOTHDD} ]]
  if [ -z "$KRNVER" ]  
616   then   then
617   KRNVER="AutoSta_LX"   mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die
618   fi   fi
619     if [[ -n ${BOOTHDD} ]]
  if [ -z "$KRNIMG" ]  
620   then   then
621   KRNIMG="bzImage"   install -d ${INSTALL_ROOT}/boot || die
622     mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die
623   fi   fi
624    
625   if [ -z "$KRNINITRD" ]   cd ${INSTALL_ROOT} || die
626   then  }
  KRNINITRD="initrd"  
  fi  
627    
628   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die  install_system_image()
629   echo -e "timeout 0" >> $INSTALLPATH/boot/grub/grub.conf ||die  {
630     tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALL_ROOT}
631   #no support for splash image in 6.1-r2  }
  #echo -e "splashimage=(hd0,0)/boot/grub/splash.xpm.gz" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die  
  echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  #s3 cards don't support this  
  #echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD vga=0x317 video:vesa:ywrap,mtrr splash=silent quiet" >> $INSTALLPATH/boot/grub/grub.conf || die  
  #that's more safer:  
  echo -e "kernel (hd0,0)/boot/${KRNIMG} root=$ROOTHDD quiet" >> $INSTALLPATH/boot/grub/grub.conf || die  
   
  #not needed without bootsplash support  
  #echo -e "initrd=/boot/${KRNINITRD}" >> $INSTALLPATH/boot/grub/grub.conf || die  
632    
633    install_bootsector_chroot()
634    {
635     local my_roothdd
636     local grubconf=${INSTALL_ROOT}/boot/grub/grub.conf
637     local grub2conf=/boot/grub/grub.cfg
638     local CONFIG
639    
640   ### bootsector schreiben chrooted schreiben (gentoo)   # check for grub2
641   if [ -f $INSTALLPATH/sbin/grub ]   if [[ -f ${INSTALL_ROOT}/sbin/grub-mkconfig ]]
642   then   then
643   cat > $INSTALLPATH/root/.bashrc << CHROOTEOF   # needed by grub-mkconfig on the first run
644  /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   if [[ ! -f ${INSTALL_ROOT}/boot/grub/video.lst ]]
645  root (hd0,0)   then
646  setup (hd0)   install -m0644 ${INSTALL_ROOT}/lib/grub/*/video.lst ${INSTALL_ROOT}/boot/grub/video.lst || die
647  quit   fi
648  EOF  
649  exit 0   # set kernelopts
650  CHROOTEOF   if [[ -f ${INSTALL_ROOT}/etc/conf.d/grub ]]
651   fi   then
652     sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
653     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALL_ROOT}/etc/conf.d/grub || die
654     else
655     CONFIG=${INSTALL_ROOT}/etc/conf.d/grub
656     clearconfig
657     addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\""
658     addconfig "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\""
659     fi
660     CONFIG=${INSTALL_ROOT}/.installrc
661     clearconfig
662     addconfig 'grub-mkdevicemap'
663     addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null"
664     addconfig "grub-install --no-floppy ${HDD} &> /dev/null"
665     addconfig "exit 0"
666    
667     # grub-legacy
668     else
669     ### grubconf schreiben
670     source ${INSTALL_ROOT}/boot/kernelversion
671    
672     #for alx only
673     if [ -e ${INSTALL_ROOT}/etc/alx_version ]
674     then
675     OLD_ALXVER="${ALXVER}"
676     source ${INSTALL_ROOT}/etc/alx_version
677     KRNVER="ALX-${ALXVER}"
678     ALXVER="${OLD_ALXVER}"
679     fi
680    
681   ### bootsector schreiben chrooted schreiben (lfs/magellan)   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
682   if [ -f $INSTALLPATH/usr/sbin/grub ]   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
683     [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
684    
685     # uuid support
686     if is_uuid_supported
687     then
688     my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
689     else
690     my_roothdd="${ROOTHDD}"
691     fi
692    
693     CONFIG="${grubconf}"
694     clearconfig
695     addconfig "default 0"
696     addconfig "timeout 3"
697     # using current root password
698     addconfig "password --md5 $(cat ${INSTALL_ROOT}/etc/shadow | grep root | cut -d: -f2)"
699     addconfig
700     addconfig "# normal boot"
701     addconfig "title ${KRNVER}"
702     addconfig "root (hd0,0)"
703     addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"
704     if is_initrd_supported
705     then
706     addconfig "initrd /boot/${KRNINITRD}"
707     fi
708     addconfig
709     addconfig "# admin boot"
710     addconfig "title ${KRNVER} - Re-run hardware-detection"
711     addconfig "lock"
712     addconfig "root (hd0,0)"
713     addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"
714     if is_initrd_supported
715     then
716     addconfig "initrd /boot/${KRNINITRD}"
717     fi
718     addconfig
719     addconfig "title ${KRNVER} - Reset *all* local settings"
720     addconfig "lock"
721     addconfig "root (hd0,0)"
722     addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"
723     if is_initrd_supported
724     then
725     addconfig "initrd /boot/${KRNINITRD}"
726     fi
727    
728     # write bootsector chrooted (lfs/magellan)
729     CONFIG=${INSTALL_ROOT}/.installrc
730     clearconfig
731     addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null'
732     addconfig 'root (hd0,0)'
733     addconfig 'setup (hd0)'
734     addconfig 'quit'
735     addconfig 'EOF'
736     addconfig 'exit 0'
737     fi
738    
739     ## enter chroot
740     enter_chroot_installrc
741    }
742    
743    is_initrd_supported()
744    {
745     # only generate initrds if the cmd exists
746     [[ -x ${INSTALL_ROOT}/sbin/mkinitrd ]] && return 0
747     return 1
748    }
749    
750    install_initrd_chroot()
751    {
752     local CONFIG
753    
754     # only generate initrds if the cmd exists
755     is_initrd_supported || return 0
756    
757     FSMODS="${FORMAT_FILESYSTEM_BOOTHDD} ${FORMAT_FILESYSTEM_ROOTHDD}"
758     DISKMODS="sd_mod"
759     OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
760     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
761     SATAMODS="sata_via sata_sis sata_nv"
762     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
763     OTHERMODS=""
764     case ${SPECIALDEVICE} in
765     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
766     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
767     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
768     # not working with kms enabled drivers -> segfaults
769     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
770     maxdata) FBMODS="" ;;
771     *) FBMODS="uvesafb" ;;
772     esac
773    
774     if [[ ${FORMFACTOR} = laptop ]]
775     then
776     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
777     fi
778    
779     # install an appropriate uvesafb.conf
780     CONFIG=${INSTALL_ROOT}/etc/modprobe.d/uvesafb.conf
781     clearconfig
782     addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap"
783    
784     # install an appropriate viafb.conf
785     CONFIG=${INSTALL_ROOT}/etc/modprobe.d/viafb.conf
786     clearconfig
787     addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60"
788    
789     # install an appropriate i810fb.conf
790     CONFIG=${INSTALL_ROOT}/etc/modprobe.d/i810fb.conf
791     clearconfig
792     addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"
793    
794     CONFIG=${INSTALL_ROOT}/.installrc
795     clearconfig
796     addconfig 'echo "MODULES=\"${FSMODS} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd'
797     addconfig 'mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null'
798     addconfig 'exit 0'
799     ## enter chroot
800     enter_chroot_installrc
801    }
802    
803    is_uuid_supported()
804    {
805     # f2fs needs special treatments as the old busybox does not support this fs
806     # use the blkid from util-linux instead of busybox
807     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
808   then   then
809   cat > $INSTALLPATH/root/.bashrc << CHROOTEOF   if [[ -x $(type -P blkid) ]]
810  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   then
811  root (hd0,0)   return 0
812  setup (hd0)   fi
813  quit   else
814  EOF   if [[ -x $(type -P busybox.mkinitrd) ]]
815  exit 0   then
816  CHROOTEOF   # only detect uuids if supported
817     if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
818     then
819     return 0
820     fi
821     fi
822   fi   fi
823    
824   ##enters chroot   return 1
  mount -t proc none $INSTALLPATH/proc  
  # bind /dev to get the devices right,  
  # if bootet from a 2.6 kernel with udev  
  mount -o bind /dev $INSTALLPATH/dev  
  chroot $INSTALLPATH /bin/bash --rcfile /root/.bashrc -i  
  umount $INSTALLPATH/proc  
  umount $INSTALLPATH/dev  
  rm $INSTALLPATH/root/.bashrc  
825  }  }
826    
827  install_alxconfig(){  get_uuid()
828   lastdir="`pwd`"  {
829     local UUID
830     local SEC_TYPE
831     local TYPE
832     local blkidcmd
833    
834   mkdir -p $INSTALLPATH/opt/alx-config || die   local dev="$1"
835   cd $INSTALLPATH/opt/alx-config || die   [[ -z ${dev} ]] && die "no dev given"
  tar xzpf $CDPATH/alx-config/alx-config.tar.gz || die  
  chmod a+x $INSTALLPATH/opt/alx-config/Configurator/config_functions.sh || die  
  chmod a+x $INSTALLPATH/opt/alx-config/Configurator/config_menu.sh || die  
  ln -sf /opt/alx-config/Configurator/config_menu.sh $INSTALLPATH/bin/ALXConfig || die  
836    
837   cd $lastdir || die   # check if given device is already an UUID
838     if [[ ${dev/UUID=/}x != ${dev}x ]]
839     then
840     eval "${dev}"
841     else
842     # f2fs needs special treatments as the old busybox does not support this fs
843     # use the blkid from util-linux instead of busybox
844     if [[ ${FORMAT_FILESYSTEM} = f2fs ]]
845     then
846     blkidcmd="blkid"
847     else
848     blkidcmd="busybox.mkinitrd blkid"
849     fi
850     eval $(${blkidcmd} ${dev} | grep "${dev}:" | sed 's/.*:\ //')
851     fi
852     echo "${UUID}"
853  }  }
854    
855    install_system_settings()
856    {
857     local CONFIG
858     local fstype
859    
860  install_system_settings(){   # write fstab
861   ### schreibe fstab   CONFIG=${INSTALL_ROOT}/etc/fstab
862   echo -e "$BOOTHDD\t/boot\text3\tnoatime,noauto\t1 1" > $INSTALLPATH/etc/fstab || die   clearconfig
  echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" >> $INSTALLPATH/etc/fstab || die  
  echo -e "$SWAPHDD\tswap\tswap\tpri=1\t0 0" >> $INSTALLPATH/etc/fstab || die  
  echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die  
   
  #deprecated  
  #echo -e "devpts\t/dev/pts\tdevpts\tgid=4,mode=620\t0 0" >> $INSTALLPATH/etc/fstab || die  
863    
864   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   if [[ -n ${BOOTHDD} ]]
865   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   then
866  }   if is_uuid_supported
867     then
868     addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
869     else
870     addconfig -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime,noauto\t1 1"
871     fi
872     fi
873    
874  install_hotfixes(){   if [[ -n ${ROOTHDD} ]]
  if [ -f $CDPATH/hotfixes/hotfixes.sh ]  
875   then   then
876   dialog_hotfixes   if is_uuid_supported
877   sleep1   then
878   $CDPATH/hotfixes/hotfixes.sh   addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
879     else
880     addconfig -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0"
881     fi
882     fi
883    
884     # not needed busybox loads all with swapon -a, even if not mentioned in fstab
885     #addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0"
886     addconfig -e "proc\t/proc\tproc\tdefaults\t0 0"
887     addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0"
888    
889     # install network config skeleton
890     install -m0644 ${INSTALL_ROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALL_ROOT}/etc/conf.d/ || die
891    
892     # intel framebufer quirk
893     if [[ -e /proc/fb ]]
894     then
895     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
896     then
897     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
898     if [[ ${fbdev} != 0 ]]
899     then
900     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALL_ROOT}/etc/splash/splash.conf || die
901     fi
902     fi
903   fi   fi
904  }  }
905    
906  install_umount_rootfs() {  install_umount_rootfs()
907    {
908   cd /   cd /
909   umount $INSTALLPATH/boot || die   if [[ -n ${BOOTHDD} ]]
910   umount $INSTALLPATH || die   then
911   swapoff $SWAPHDD || die   umount ${INSTALL_ROOT}/boot || die
912     fi
913     if [[ -n ${ROOTHDD} ]]
914     then
915     umount ${INSTALL_ROOT} || die
916     fi
917     if [[ -n ${SWAPHDD} ]]
918     then
919     swapoff ${SWAPHDD} || die
920     fi
921  }  }
922    
923  install_do_reboot() {  install_do_reboot()
924    {
  #only for now later it will be used again  
  #with 6.1-r2 these options are not available  
  #cd /  
  #umount $CDPATH  
  #eject  
  #clear  
   
925   reboot   reboot
926  }  }
927    
928  #################################################  #################################################
929  #     Install Ablauf Scripte #  #     Install Main Scripts #
930  #################################################  #################################################
931    
932  run_install_normal() {  run_install()
933   #only for now later it will be used again  {
934   #with 6.1-r2 only one install method available   local method="$1"
935   #dialog_setup_hdd_menu  
936   dialog_setup_hdd_found_manuell   # setup install environment
937     export KERNELOPTS="${DEFAULT_KERNELOPTS}"
938   dialog_setup_hdd_partitions_manuell   export GRUBLEGACYOPTS="${GRUBLEGACYOPTS}"
939     export GRUB2OPTS="${GRUB2OPTS}"
940     export GRUB2GFXPAYLOAD="${DEFAULT_GRUB2GFXPAYLOAD}"
941     export FORMFACTOR="${DEFAULT_FORMFACTOR}"
942     export FORMAT_FILESYSTEM="${DEFAULT_FORMAT_FILESYSTEM}"
943    
944     case "${method}" in
945     auto)
946     export FORMAT_FILESYSTEM_BOOTHDD=""
947     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
948     export INSTALL_METHOD="${method}"
949     ;;
950     normal)
951     export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}"
952     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
953     export INSTALL_METHOD="${method}"
954     ;;
955     single)
956     export FORMAT_FILESYSTEM_BOOTHDD=""
957     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
958     export INSTALL_METHOD="${method}"
959     ;;
960     flash)
961     export FORMAT_FILESYSTEM="f2fs"
962     export FORMAT_FILESYSTEM_BOOTHDD="ext2"
963     export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}"
964     export INSTALL_METHOD="${method}"
965     ;;
966     *)
967     die "Unknown install method '${method}', aborting."
968     ;;
969     esac
970    
971     dialog_hardware_detection
972    
973     dialog_setup_hdd_partitions
974   dialog_setup_hdd_format   dialog_setup_hdd_format
975   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
976   install_mount_rootfs   install_mount_rootfs
977   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image   (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
978    
  #only for now later it will be used again  
  #with 6.1-r2 variable kernels are not available  
  #dialog_install_kernel_image  
  #install_kernel_image  
   
  dialog_install_bootsector  
  install_bootsector_chroot  
   
  #only for now later it will be used again  
  #with 6.1-r2 highest version of alx-config is already included  
  #dialog_install_alxconfig  
  #sleep 1  
  #install_alxconfig  
   
979   dialog_install_settings   dialog_install_settings
980   sleep 1   sleep 1
981   install_system_settings   install_system_settings
982   install_hotfixes   install_initrd_chroot
983    
984     dialog_install_bootsector
985     install_bootsector_chroot
986    
987   install_umount_rootfs   install_umount_rootfs
988   dialog_install_successful   dialog_install_successful
989  }  }
990    
991  run_install_silent() {  # set some proper traps
992   echo "starting silent install ..."  trap "trap_exit" SIGINT SIGQUIT
  sleep 1  
 }  
   
 run_install_unattended() {  
  echo "starting unattended install ..."  
  sleep 1  
 }  
993    
994  if [ "$1" == "unattended" ]  dialog_main
 then  
  run_install_unattended  
 else  
  dialog_main  
 fi  
995    
996  exit 0  exit 0

Legend:
Removed from v.268  
changed lines
  Added in v.6843