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

Legend:
Removed from v.280  
changed lines
  Added in v.6838