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

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