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 6821 by niro, Thu Jul 23 08:57:15 2015 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  # $Id$
 # $Header: /home/cvsd/alx-cvs/alx-src/alxinstall-ng/bin/alxinstall-ng.sh,v 1.4 2005-04-19 17:24:57 niro Exp $  
 #  
 # AutoSta_LX Installation Script  
 # version: 0.8b  
 #  
 # Niels Rogalla <niro@magellan-linux.de>  
 # <rogalla@augusta-bochum.de>  
 #  
 #  
 # Install Navigation Gui  
 #  
3    
4  #source /etc/alx_version  # ignore environment!
5  #source /opt/alx-config/version  LC_ALL=C
6    
7  #source /etc/alx-config/config.rc  MLIBDIR="/usr/lib/alxinstall-ng"
8    
9  #images: (get ${CDIMAGENAME})  # images: (get ${CDIMAGENAME})
10  source /mnt/cdrom/system/images.conf  source /mnt/cdrom/system/images.conf
11    
12  #Includes  # includes
13  source /usr/lib/alxinstall-ng/functions/findhdd.sh > /dev/null  source ${MLIBDIR}/functions/hwdetection.sh
 ### bugfix ###############################  
 cdromdev="`echo $cdromdev|sed -e 's/ //'`"  
 ########################################  
14    
15  ### System/Config Version  ### System/Config Version
16  VERSION="0.1"  VERSION="@@VERSION@@"
17  TITLE="alxinstall-ng - ${VERSION}"  TITLE="alxinstall-ng - ${VERSION}"
18    
 #CONFIGS_TEMPLATE="/opt/alx-config/configs"  
   
19  CDPATH="/mnt/cdrom"  CDPATH="/mnt/cdrom"
20  INSTALLPATH="/mnt/magellan"  INSTALLPATH="/mnt/magellan"
21    
22  ### WICHTIG: anzahl lines in der autosta_lx.tar.gz -1  ### linecount of system.tar.gz -1 !
23  CURRENTLINE=0  CURRENTLINE=0
24  #TOTALLINES=11072 # -> now in images.conf  #TOTALLINES=11072 # -> now in images.conf
25    
26    # standard kernel opts
27    KERNELOPTS="quiet video=1024x768"
28    
29    # grub options
30    GRUBLEGACYOPTS=""
31    GRUB2OPTS=""
32    GRUB2GFXPAYLOAD="1024x768x16,1024x768"
33    
34    # fdisk options
35    FDISKPARTIONBELOW256MB=0
36    
37    # default specialdevices
38    SPECIALDEVICE=""
39    FORMFACTOR="desktop"
40    
41    # target filesystem
42    FORMAT_FILESYSTEM="ext4"
43    
44  #################################################  #################################################
45  #  DIALOG BOXEN #  #  DIALOG BOXES #
46  #################################################  #################################################
47    
48  die() {  die()
49   #clear  {
  #echo -e "\nhuch, da ist ein script gestorben -> $?\n"  
  #read  
  #exit 0  
50   ERROR=$1   ERROR=$1
51   RETVAL=$?   RETVAL=$?
52   dialog_install_failure   dialog_install_failure
53   exit 1   exit 1
54  }  }
55    
56  dialog_warning() {  dialog_warning()
57    {
58   dialog \   dialog \
59   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
60   --colors \   --colors \
61   --defaultno \   --defaultno \
62   --yesno "\Z1 !!! Achtung !!! \Zn\n\n\   --yesno "\Z1 !!! Achtung !!! \Zn\n\n\
63   Diese Festplatte wird unwiederruflich geloescht werden.\n\n\   Diese Festplatte wird unwiederruflich geloescht werden.\n\n\
64   Soll ich wirklich fortfahren ?" 10 70   Soll ich wirklich fortfahren ?" 10 70
65   RES=$?   RES=$?
66   if [ "$RES" == "1" ]   if [[ ${RES} -eq 1 ]]
67   then   then
68   clear   clear
69   echo "Der Vorgang wurde abgebrochen."   echo "Der Vorgang wurde abgebrochen."
# Line 72  dialog_warning() { Line 71  dialog_warning() {
71   fi   fi
72  }  }
73    
74  dialog_setup_hdd_info(){  dialog_setup_hdd_info()
75   local SHDD="`echo $HDD|sed -e 's/\/dev\///'`"  {
76     local SHDD="$(echo ${HDD} | sed 's/\/dev\///')"
77    
78   dialog \   dialog \
79   --colors \   --colors \
80   --title "[ Festplatten Partitionierung ]" \   --title "[ Festplatten Partitionierung ]" \
81   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
82   --ok-label "Weiter" \   --ok-label "Weiter" \
83   --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\   --msgbox "\nBitte legen Sie 3 Partitionen an.\n\n\
84   [ \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 87  dialog_setup_hdd_info(){
87   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81   Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
88  }  }
89    
90  dialog_setup_hdd_menu() {  dialog_setup_hdd_info_simple()
91    {
92     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
93    
94     dialog \
95     --colors \
96     --title "[ Festplatten Partitionierung ]" \
97     --backtitle "${TITLE}" \
98     --ok-label "Weiter" \
99     --msgbox "\nBitte legen Sie 1 Partition an.\n\n\
100     [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\
101     Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81
102    }
103    
104    dialog_setup_hdd_info_auto()
105    {
106     local SHDD="$(echo $HDD | sed 's/\/dev\///')"
107    
108     dialog \
109     --colors \
110     --title "[ Festplatten Partitionierung ]" \
111     --backtitle "${TITLE}" \
112     --ok-label "Weiter" \
113     --msgbox "\nAchtung!\n\
114     Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81
115    }
116    
117    dialog_setup_system_menu()
118    {
119     local i
120    
121   I=`dialog \   i=$(dialog \
122   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
123   --title "[ Festplatten Partitionierung ]" \   --title "[ Festplatten Partitionierung ]" \
124   --cancel-label "Abbrechen" \   --cancel-label "Abbrechen" \
125   --ok-label "Weiter" \   --ok-label "Weiter" \
126   --stdout \   --stdout \
127   --menu "\nWaehlen Sie zwischen Manuell und Automatisch" 14 70 5 \   --colors \
128   "1" "Manuell" \   --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \
129   "2" "Automatisch"`   "1" "Automatisches Setup (Empfohlen)" \
130     "" "" \
131     "" "\Z1Experten Modi:\Zn" \
132     "2" "Normale IDE-Disk (Manuell)" \
133     "3" "Flash-Speicher (Manuell)")
134   RES=$?   RES=$?
135   if [ "$RES" == "1" ];then   [[ ${RES} -eq 1 ]] && return 1
136   return 1   if [[ ${RES} -eq 0 ]]
137   fi   then
138   if [ "$RES" == "0" ];then   case "${i}" in
139   case "$I" in   "1") run_install_auto ;;
140           "1")   "2") run_install_normal ;;
141   dialog_setup_hdd_found_manuell   "3") run_install_simple ;;
142   ;;   "") dialog_setup_system_menu;;
  "2")  
  dialog_warning  
  setup_hdd_partitions_silent  
      ;;  
143   esac   esac
144   fi   fi
145  }  }
146    
147  dialog_setup_hdd_found_manuell() {  dialog_hardware_detection()
148   if [ ! -z "$installdevs" ]  {
149     local i
150     local hwtmp
151    
152     if [ -x $(which mktemp &> /dev/null) ]
153   then   then
154   installdevs=""   hwtmp="$(mktemp)"
155     else
156     hwtmp="/tmp/hwtmp.sh"
157   fi   fi
158    
159   echo "dialog \\"  > /tmp/hddtmp.sh   run_hardware_detection_disks
  echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh  
  echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh  
  echo "--stdout \\" >> /tmp/hddtmp.sh  
  echo "--colors \\" >> /tmp/hddtmp.sh  
  echo "--msgbox \"Gefundene Hardware:\n\n \\" >> /tmp/hddtmp.sh  
  echo " Festplatten:\n \\" >> /tmp/hddtmp.sh  
160    
161   if [ ! -z "$scsidisks" ]   echo "dialog \\"  > ${hwtmp}
162     echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
163     echo "--ok-label \"Weiter\" \\" >> ${hwtmp}
164     echo "--stdout \\" >> ${hwtmp}
165     echo "--colors \\" >> ${hwtmp}
166     echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
167     echo " Festplatten:\n \\" >> ${hwtmp}
168    
169     if [[ ! -z ${ALL_DISKS} ]]
170   then   then
171   for I in $scsidisks   for i in ${ALL_DISKS}
172   do   do
173   if [ "$I" != "$cdromdev" ]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3$I\\Zn\n \\" >> /tmp/hddtmp.sh  
  installdevs="$installdevs $I"  
  fi  
174   done   done
175   fi   fi
176    
177   if [ ! -z "$idedisks" ]   if [[ ! -z ${ALL_CDROMS} ]]
178   then   then
179   for I in $idedisks   echo " \n \\" >> ${hwtmp}
180     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
181     for i in ${ALL_CDROMS}
182   do   do
183   if [ "$I" != "$cdromdev" ]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3$I\\Zn\n \\" >> /tmp/hddtmp.sh  
  installdevs="$installdevs $I"  
  fi  
184   done   done
185   fi   fi
186    
187   if [ ! -z "$cdromdev" ]   # other devices
188     run_hardware_detection
189     case "${SPECIALDEVICE}" in
190     zotac*) echo " \n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;;
191     rangee) echo " \n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;;
192     maxdata) echo " \n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;;
193     i845) echo " \n \\Z2Intel i845 Device erkannt.\\Zn \\" >> ${hwtmp} ;;
194     *) echo " \n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;;
195     esac
196     if [[ ${FORMFACTOR} = laptop ]]
197     then
198     echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp}
199     fi
200    
201     echo " \" 14 70" >> ${hwtmp}
202     chmod a+x ${hwtmp}
203     ${hwtmp}
204    
205     # remove tmp file
206     if [[ -f ${hwtmp} ]]
207   then   then
208   echo " \n \\" >> /tmp/hddtmp.sh   rm ${hwtmp}
  echo " \\Z7andere Laufwerke:\n \\" >> /tmp/hddtmp.sh  
  echo " CDROM: \\Z3$cdromdev\\Zn\n \\" >> /tmp/hddtmp.sh  
209   fi   fi
  echo " \" 13 70" >> /tmp/hddtmp.sh  
  chmod a+x /tmp/hddtmp.sh  
  /tmp/hddtmp.sh  
210  }  }
211    
212  dialog_setup_hdd_partitions_manuell() {  dialog_setup_hdd_partitions_manuell()
213   if [ -z "$installdevs" ]  {
214     local i
215    
216     if [[ -z ${ALL_DISKS} ]]
217   then   then
218   dialog \   dialog \
219   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
220   --ok-label "Beenden" \   --ok-label "Beenden" \
221   --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70   --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
222   exit 1   exit 1
223   else   else
224    
225   echo "dialog \\" > /tmp/hddtmp.sh   echo "dialog \\" > /tmp/hddtmp.sh
226   echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
227   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
228   echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh   echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
229   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> /tmp/hddtmp.sh
230   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh   echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
231    
232   for I in $installdevs   for i in ${ALL_DISKS}
233   do   do
234   echo "\"$I\" \"\" \\" >> /tmp/hddtmp.sh   echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
235   done   done
236   echo -e "\n" >> /tmp/hddtmp.sh   echo -e "\n" >> /tmp/hddtmp.sh
237    
238   chmod a+x /tmp/hddtmp.sh   chmod a+x /tmp/hddtmp.sh
239   HDD="`/tmp/hddtmp.sh`"   HDD="$(/tmp/hddtmp.sh)"
240   RES=$?   RES=$?
241   if [ "$RES" == "1" ]   [[ ${RES} -eq 1 ]] && return 1
242   then   if [[ ${RES} -eq 0 ]]
  return 1  
  fi  
  if [ "$RES" == "0" ]  
243   then   then
244   dialog_setup_hdd_info   dialog_setup_hdd_info
245   setup_hdd_partitions_manuell   setup_hdd_partitions_manuell
# Line 202  dialog_setup_hdd_partitions_manuell() { Line 247  dialog_setup_hdd_partitions_manuell() {
247   fi   fi
248  }  }
249    
250  dialog_setup_hdd_partitions_silent() {  dialog_setup_hdd_partitions_manuell_simple()
251    {
252     local i
253    
254     if [[ -z ${ALL_DISKS} ]]
255     then
256     dialog \
257     --backtitle "${TITLE}" \
258     --ok-label "Beenden" \
259     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
260     exit 1
261     else
262    
263     echo "dialog \\" > /tmp/hddtmp.sh
264     echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
265     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
266     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
267     echo "--stdout \\" >> /tmp/hddtmp.sh
268     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
269    
270     for i in ${ALL_DISKS}
271     do
272     echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
273     done
274     echo -e "\n" >> /tmp/hddtmp.sh
275    
276     chmod a+x /tmp/hddtmp.sh
277     HDD="$(/tmp/hddtmp.sh)"
278     RES=$?
279     [[ ${RES} -eq 1 ]] && return 1
280     if [[ ${RES} -eq 0 ]]
281     then
282     dialog_setup_hdd_info_simple
283     setup_hdd_partitions_manuell_simple
284     fi
285     fi
286    }
287    
288    dialog_setup_hdd_partitions_auto()
289    {
290     local i
291    
292     if [[ -z ${ALL_DISKS} ]]
293     then
294     dialog \
295     --backtitle "${TITLE}" \
296     --ok-label "Beenden" \
297     --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70
298     exit 1
299     else
300    
301     echo "dialog \\" > /tmp/hddtmp.sh
302     echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh
303     echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh
304     echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh
305     echo "--stdout \\" >> /tmp/hddtmp.sh
306     echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh
307    
308     for i in ${ALL_DISKS}
309     do
310     echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh
311     done
312     echo -e "\n" >> /tmp/hddtmp.sh
313    
314     chmod a+x /tmp/hddtmp.sh
315     HDD="$(/tmp/hddtmp.sh)"
316     RES=$?
317     [[ ${RES} -eq 1 ]] && return 1
318     if [[ ${RES} -eq 0 ]]
319     then
320     dialog_setup_hdd_info_auto
321     dialog_setup_hdd_create_partitions
322     setup_hdd_partitions_auto
323     fi
324     fi
325    }
326    
327    dialog_setup_hdd_create_partitions()
328    {
329   dialog \   dialog \
330   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
331   --infobox "Erstelle Partitionen ..." 3 70   --infobox "Erstelle Disk Partitionen ..." 3 70
332  }  }
333    
334  dialog_setup_hdd_format() {  dialog_setup_hdd_format()
335    {
336   dialog \   dialog \
337   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
338   --infobox "Erstelle Datei-Systeme ..." 3 70   --infobox "Erstelle Datei-Systeme ..." 3 70
339  }  }
340    
341  dialog_install_settings() {  dialog_install_settings()
342    {
343   dialog \   dialog \
344   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
345   --infobox "Speichere System-Einstellungen ..." 3 70   --infobox "Speichere System-Einstellungen ..." 3 70
346  }  }
347    
348  dialog_install_system_image() {  dialog_install_system_image()
349    {
350   dialog \   dialog \
351   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
352   --gauge "Kopiere System-Image ..." 6 80   --gauge "Kopiere System-Image ..." 6 80
353  }  }
354    
355  dialog_install_meter() {  dialog_install_meter()
356   while [ "${CURRENTLINE}" != "${TOTALLINES}" ] ; do  {
357   CURRENTLINE=`grep --count . /tmp/install.log`   while [[ ${CURRENTLINE} != ${TOTALLINES} ]]
358   PERCENT=`expr ${CURRENTLINE} \* 100 / ${TOTALLINES}`   do
359     CURRENTLINE=$(grep -c . /tmp/install.log)
360     PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES}))
361   echo ${PERCENT}   echo ${PERCENT}
362   sleep 1   sleep 1
363   done   done
# Line 237  dialog_install_meter() { Line 365  dialog_install_meter() {
365   return 0   return 0
366  }  }
367    
368    dialog_install_bootsector()
369  dialog_install_bootsector() {  {
370   dialog \   dialog \
371   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
372   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
373  }  }
374    
375  dialog_install_alxconfig() {  dialog_install_successful()
376    {
377   dialog \   dialog \
378   --backtitle "$TITLE" \   --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() {  
  dialog \  
  --backtitle "$TITLE" \  
  --infobox "Installiere Hotfixes ..." 3 70  
   
 }  
   
 dialog_install_successful() {  
  dialog \  
  --backtitle "$TITLE" \  
379   --colors \   --colors \
380   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81
381  }  }
382    
383  dialog_install_failure() {  dialog_install_failure()
384    {
385   dialog \   dialog \
386   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
387   --colors \   --colors \
388   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\
389   Fehler bei $ERROR, RetVal: $RETVAL \   Fehler bei ${ERROR}, RetVal: ${RETVAL} \
390   " 10 81   " 10 81
391  }  }
392    
393  dialog_install_method() {  dialog_main()
394    {
  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() {  
395   METHOD=0   METHOD=0
396    
397   while [ $METHOD -le 2 ]   while [[ ${METHOD} -le 2 ]]
398   do   do
399   METHOD=`dialog \   METHOD=$(dialog \
400   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
401   --no-cancel \   --no-cancel \
402   --ok-label "Weiter" \   --ok-label "Weiter" \
403   --stdout \   --stdout \
# Line 321  dialog_main() { Line 405  dialog_main() {
405   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
406   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
407   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
408   "4" "Beenden und eine Shell starten" `   "4" "Beenden und eine Shell starten")
409   RES=$?   RES=$?
410   if [ "$RES" == "1" ];then   [[ ${RES} -eq 1 ]] && exit 1
411   exit 1   if [[ ${RES} -eq 0 ]]
412   fi   then
413   if [ "$RES" == "0" ];then   case ${METHOD} in
414   case "$METHOD" in   "1") dialog_setup_system_menu ;;
415           "1")   "2") dialog_hardware_detection ;;
416   #only for now later it will be used again   "3") install_do_reboot ;;
417   #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  
  ;;  
418   esac   esac
419   fi   fi
420   done   done
421  }  }
422    
423  #################################################  #################################################
424  # Install Komandos #  # Install Commands #
425  #################################################  #################################################
426  setup_hdd_partitions_manuell() {  run_hardware_detection()
427   BOOTHDD="${HDD}1"  {
428   SWAPHDD="${HDD}2"   local hwinfo
429   ROOTHDD="${HDD}3"  
430     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
431    
432     # check for special devices/clients:
433     # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
434     local removable=0
435     if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
436     then
437     for i in /sys/block/[hs]d*/removable
438     do
439     if [[ $(< ${i}) = 1 ]]
440     then
441     removable=1
442     fi
443     done
444    
445   ## hdds partitionieren manuell   # only add this for grub legacy, grub2 detect these settings on its own
446   cfdisk $HDD || die   export GRUBLEGACYOPTS="rootdelay=8"
447  }   # there are two zotac types in the wild, nvidia based gfx and intel
448     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
449     then
450     export SPECIALDEVICE="zotac_nvidia"
451     else
452     export SPECIALDEVICE="zotac_intel"
453     fi
454     fi
455    
456  setup_hdd_partitions_silent() {   # check for special devices/clients:
457   ## hdds löschen   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
458   dd if=/dev/zero of=$HDD bs=1024k count=1 || die   if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
459   ## hdds partitionieren silent   then
460   fdisk $HDD < $CONFIGS_TEMPLATE/fdisksettings #1> /dev/null 3> /dev/null || die   # for a rangee always define partion startblock +1
461     export FDISKPARTIONBELOW256MB="1"
462   read   export SPECIALDEVICE="rangee"
463  }   export GRUBLEGACYOPTS=""
464     fi
465    
466     # check for special devices/clients:
467     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
468     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
469     then
470     export SPECIALDEVICE="maxdata"
471     export GRUBLEGACYOPTS=""
472     fi
473    
474  setup_hdd_format() {   # check for i845 Chipsets and disable KMS and use 915 drm driver
475   mkswap $SWAPHDD || die   if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
476   mke2fs -j -q $BOOTHDD || die   then
477   mke2fs -j -q $ROOTHDD || die   export SPECIALDEVICE="i845"
478     # unset default video=1024x768 opt or the drm driver breaks
479     export KERNELOPTS="quiet"
480     export GRUBLEGACYOPTS=""
481     # enable full kms support
482     export GRUB2GFXPAYLOAD="keep"
483     fi
484    
485     # check for radeon gfxcards
486     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
487     then
488     # enable full kms support
489     export GRUB2GFXPAYLOAD="keep"
490     fi
491    
492     # check for special devices/clients:
493     # check for laptops and activate cpufreq scaling
494     if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
495     then
496     export FORMFACTOR="laptop"
497     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
498     fi
499  }  }
500    
501  install_mount_rootfs() {  run_hardware_detection_disks()
502   swapon $SWAPHDD || die  {
503   mount $ROOTHDD $INSTALLPATH || die   local bootdev
504   install -d $INSTALLPATH/boot || die  
505   mount $BOOTHDD $INSTALLPATH/boot || die   # all disks but exclude ramdisks
506   cd $INSTALLPATH || die   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
507     # remove the boot device from ALL_DISKS if it was an usbstick
508     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
509     then
510     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
511     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
512     fi
513     export ALL_CDROMS="$(get_hwinfo cdrom)"
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_simple()
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_simple()
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_simple()
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)   # write bootsector chrooted (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   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die  install_system_settings()
855   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die  {
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     # install network config skeleton
871     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_simple()
888   if [ -f $CDPATH/hotfixes/hotfixes.sh ]  {
889     # write 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_simple()
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    
919  #################################################  #################################################
920  #     Install Ablauf Scripte #  #     Install Main Scripts #
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_simple()
946   echo "starting silent install ..."  {
947     dialog_hardware_detection
948    
949     dialog_setup_hdd_partitions_manuell_simple
950     dialog_setup_hdd_format
951     setup_hdd_format_simple > /dev/null
952     install_mount_rootfs_simple
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_simple
958     install_initrd_chroot
959    
960     dialog_install_bootsector
961     install_bootsector_chroot
962    
963     install_umount_rootfs_simple
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_simple > /dev/null
974     install_mount_rootfs_simple
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_simple
980     install_initrd_chroot
981    
982     dialog_install_bootsector
983     install_bootsector_chroot
984    
985     install_umount_rootfs_simple
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.6821