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 260 by niro, Mon Apr 18 20:27:57 2005 UTC alx-src/trunk/alxinstall-ng/bin/alxinstall-ng.sh.in revision 6820 by niro, Thu Jul 23 08:54:42 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.2 2005-04-18 20:27: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
160   echo "--backtitle \"$TITLE\" \\" >> /tmp/hddtmp.sh  
161   echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh   echo "dialog \\"  > ${hwtmp}
162   echo "--stdout \\" >> /tmp/hddtmp.sh   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
163   echo "--colors \\" >> /tmp/hddtmp.sh   echo "--ok-label \"Weiter\" \\" >> ${hwtmp}
164   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> /tmp/hddtmp.sh   echo "--stdout \\" >> ${hwtmp}
165   echo " Festplatten:\n \\" >> /tmp/hddtmp.sh   echo "--colors \\" >> ${hwtmp}
166     echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
167     echo " Festplatten:\n \\" >> ${hwtmp}
168    
169   if [ ! -z "$scsidisks" ]   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 238  dialog_install_meter() { Line 366  dialog_install_meter() {
366  }  }
367    
368    
369  dialog_install_bootsector() {  dialog_install_bootsector()
370    {
371   dialog \   dialog \
372   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
373   --infobox "Schreibe den Bootsektor ..." 3 70   --infobox "Schreibe den Bootsektor ..." 3 70
374  }  }
375    
376  dialog_install_alxconfig() {  dialog_install_successful()
377    {
378   dialog \   dialog \
379   --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" \  
380   --colors \   --colors \
381   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81   --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81
382  }  }
383    
384  dialog_install_failure() {  dialog_install_failure()
385    {
386   dialog \   dialog \
387   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
388   --colors \   --colors \
389   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\   --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\
390   Fehler bei $ERROR, RetVal: $RETVAL \   Fehler bei ${ERROR}, RetVal: ${RETVAL} \
391   " 10 81   " 10 81
392  }  }
393    
394  dialog_install_method() {  dialog_main()
395    {
  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() {  
396   METHOD=0   METHOD=0
397    
398   while [ $METHOD -le 2 ]   while [[ ${METHOD} -le 2 ]]
399   do   do
400   METHOD=`dialog \   METHOD=$(dialog \
401   --backtitle "$TITLE" \   --backtitle "${TITLE}" \
402   --no-cancel \   --no-cancel \
403   --ok-label "Weiter" \   --ok-label "Weiter" \
404   --stdout \   --stdout \
# Line 321  dialog_main() { Line 406  dialog_main() {
406   "1" "AutoSta_LX installieren" \   "1" "AutoSta_LX installieren" \
407   "2" "Uebersicht gefundener Laufwerke" \   "2" "Uebersicht gefundener Laufwerke" \
408   "3" "Beenden und neustarten" \   "3" "Beenden und neustarten" \
409   "4" "Beenden und eine Shell starten" `   "4" "Beenden und eine Shell starten")
410   RES=$?   RES=$?
411   if [ "$RES" == "1" ];then   [[ ${RES} -eq 1 ]] && exit 1
412   exit 1   if [[ ${RES} -eq 0 ]]
413   fi   then
414   if [ "$RES" == "0" ];then   case ${METHOD} in
415   case "$METHOD" in   "1") dialog_setup_system_menu ;;
416           "1")   "2") dialog_hardware_detection ;;
417   #only for now later it will be used again   "3") install_do_reboot ;;
418   #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  
  ;;  
419   esac   esac
420   fi   fi
421   done   done
422  }  }
423    
424  #################################################  #################################################
425  # Install Komandos #  # Install Commands #
426  #################################################  #################################################
427  setup_hdd_partitions_manuell() {  run_hardware_detection()
428   BOOTHDD="${HDD}1"  {
429   SWAPHDD="${HDD}2"   local hwinfo
430   ROOTHDD="${HDD}3"  
431     hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)"
432    
433     # check for special devices/clients:
434     # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd
435     local removable=0
436     if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]]
437     then
438     for i in /sys/block/[hs]d*/removable
439     do
440     if [[ $(< ${i}) = 1 ]]
441     then
442     removable=1
443     fi
444     done
445    
446   ## hdds partitionieren manuell   # only add this for grub legacy, grub2 detect these settings on its own
447   cfdisk $HDD || die   export GRUBLEGACYOPTS="rootdelay=8"
448  }   # there are two zotac types in the wild, nvidia based gfx and intel
449     if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]]
450     then
451     export SPECIALDEVICE="zotac_nvidia"
452     else
453     export SPECIALDEVICE="zotac_intel"
454     fi
455     fi
456    
457  setup_hdd_partitions_silent() {   # check for special devices/clients:
458   ## hdds löschen   # if a rangee and disk ist smaller then 256mb move partion one block further ahead
459   dd if=/dev/zero of=$HDD bs=1024k count=1 || die   if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]]
460   ## hdds partitionieren silent   then
461   fdisk $HDD < $CONFIGS_TEMPLATE/fdisksettings #1> /dev/null 3> /dev/null || die   # for a rangee always define partion startblock +1
462     export FDISKPARTIONBELOW256MB="1"
463   read   export SPECIALDEVICE="rangee"
464  }   export GRUBLEGACYOPTS=""
465     fi
466    
467     # check for special devices/clients:
468     # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
469     if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]]
470     then
471     export SPECIALDEVICE="maxdata"
472     export GRUBLEGACYOPTS=""
473     fi
474    
475     # check for i845 Chipsets and disable KMS and use 915 drm driver
476     if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]]
477     then
478     export SPECIALDEVICE="i845"
479     # unset default video=1024x768 opt or the drm driver breaks
480     export KERNELOPTS="quiet"
481     export GRUBLEGACYOPTS=""
482     # enable full kms support
483     export GRUB2GFXPAYLOAD="keep"
484     fi
485    
486     # check for radeon gfxcards
487     if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]]
488     then
489     # enable full kms support
490     export GRUB2GFXPAYLOAD="keep"
491     fi
492    
493  setup_hdd_format() {   # check for special devices/clients:
494   mkswap $SWAPHDD || die   # check for laptops and activate cpufreq scaling
495   mke2fs -j -q $BOOTHDD || die   if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]]
496   mke2fs -j -q $ROOTHDD || die   then
497     export FORMFACTOR="laptop"
498     export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand"
499     fi
500  }  }
501    
502  install_mount_rootfs() {  run_hardware_detection_disks()
503   swapon $SWAPHDD || die  {
504   mount $ROOTHDD $INSTALLPATH || die   local bootdev
505   install -d $INSTALLPATH/boot || die  
506   mount $BOOTHDD $INSTALLPATH/boot || die   # all disks but exclude ramdisks
507   cd $INSTALLPATH || die   export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
508     # remove the boot device from ALL_DISKS if it was an usbstick
509     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
510     then
511     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
512     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
513     fi
514     export ALL_CDROMS="$(get_hwinfo cdrom)"
515  }  }
516    
517  install_system_image() {  hdd_size_below_256mb()
518   #tar xvzpf $CDPATH/system/autosta_lx.tar.gz  {
519   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   local hdd="$1"
520     local size
521     local retval
522     [[ -z ${hdd} ]] && die "Error: get_hdd_size() no \$hdd given!"
523    
524     size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:')
525     if [[ ${size} -le 257000000 ]]
526     then
527     retval="0"
528     else
529     retval="1"
530     fi
531    
532     return "${retval}"
533  }  }
534    
535    setup_hdd_partitions_auto()
536    {
537     ROOTHDD="${HDD}1"
538    
539  install_kernel_image() {   # run this only if FDISKPARTITIONBELOW256MB is not already 1
540   declare -i CPUTYPE=`cat /proc/cpuinfo |grep "cpu family"|cut -d ' ' -f3`   if [[ ${FDISKPARTIONBELOW256MB} != 1 ]]
541     then
542     if hdd_size_below_256mb ${HDD}
543     then
544     FDISKPARTIONBELOW256MB=1
545     else
546     FDISKPARTIONBELOW256MB=0
547     fi
548     fi
549    
550   if [ $CPUTYPE -le 5 ];then   ## delete disk
551                  #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..."  
552    
553   lastdir="`pwd`"   if [[ ${FDISKPARTIONBELOW256MB} = 1 ]]
554     then
555     ## setup one bootable partition
556     #1. n= new disk
557     #2. p= primary disk
558     #3. 1= first partition
559     #4. 2= default sector start // small disk needs more space for grub2 mbr sector
560     #5. ''= defaul sector end
561     #6. a= bootable flag
562     #7. 1= boot flag for partition 1
563     #8. w= write/quit
564     fdisk ${HDD} &> /dev/null << EOF
565    n
566    p
567    1
568    2
569    
570    a
571    1
572    w
573    EOF
574     else
575     ## setup one bootable partition
576     #1. n= new disk
577     #2. p= primary disk
578     #3. 1= first partition
579     #4. ''= default sector start
580     #5. ''= defaul sector end
581     #6. a= bootable flag
582     #7. 1= boot flag for partition 1
583     #8. w= write/quit
584     fdisk ${HDD} &> /dev/null << EOF
585    n
586    p
587    1
588    
589    
590    a
591    1
592    w
593    EOF
594     fi
595    }
596    
597   mkdir -p $INSTALLPATH/INSTALL/kernel || die  setup_hdd_partitions_manuell()
598   cd $INSTALLPATH/INSTALL/kernel || die  {
599   tar xzpf $CDPATH/kernels/kernel-i386.tar.gz || die   BOOTHDD="${HDD}1"
600   source $INSTALLPATH/INSTALL/kernel/kernelversion || die   SWAPHDD="${HDD}2"
601     ROOTHDD="${HDD}3"
602    
603   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNLIB $INSTALLPATH/lib/modules || die   ## hdds partitionieren manuell
604   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNIMG $INSTALLPATH/boot || die   cfdisk ${HDD} || die
605   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNINITRD $INSTALLPATH/boot || die  }
  cp -aRf $INSTALLPATH/INSTALL/kernel/kernelversion $INSTALLPATH/boot || die  
606    
607   cd $lastdir || die  setup_hdd_partitions_manuell_simple()
608    {
609     ROOTHDD="${HDD}1"
610    
611          elif [ $CPUTYPE -ge 6 ];then   ## hdds partitionieren manuell
612                  #echo -e "\033[1;6m\033[36m""i686 Architektur gefunden.""\033[0m"   cfdisk ${HDD} || die
613                  #echo -e "Installiere i686 Kernel..."  }
614    
615   lastdir="`pwd`"  setup_hdd_format()
616    {
617     mkswap ${SWAPHDD} || die
618     mke2fs -j -q ${BOOTHDD} || die
619     mke2fs -j -q ${ROOTHDD} || die
620    }
621    
622   mkdir -p $INSTALLPATH/INSTALL/kernel || die  setup_hdd_format_simple()
623   cd $INSTALLPATH/INSTALL/kernel || die  {
624   tar xzpf $CDPATH/kernels/kernel-i686.tar.gz || die   mke2fs -j -q ${ROOTHDD} || die
625   source $INSTALLPATH/INSTALL/kernel/kernelversion || die  }
626    
627   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNLIB $INSTALLPATH/lib/modules || die  install_mount_rootfs()
628   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNIMG $INSTALLPATH/boot || die  {
629   cp -aRf $INSTALLPATH/INSTALL/kernel/$KRNINITRD $INSTALLPATH/boot || die   swapon ${SWAPHDD} || die
630   cp -aRf $INSTALLPATH/INSTALL/kernel/kernelversion $INSTALLPATH/boot || die   mount ${ROOTHDD} ${INSTALLPATH} || die
631     install -d ${INSTALLPATH}/boot || die
632     mount ${BOOTHDD} ${INSTALLPATH}/boot || die
633     cd ${INSTALLPATH} || die
634    }
635    
636   cd $lastdir || die  install_mount_rootfs_simple()
637          fi  {
638     mount ${ROOTHDD} ${INSTALLPATH} || die
639     install -d ${INSTALLPATH}/boot || die
640     cd ${INSTALLPATH} || die
641  }  }
642    
643  install_bootsector() {  install_system_image()
644   ### grubconf schreiben  {
645   source $INSTALLPATH/INSTALL/kernel/kernelversion   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}
646    }
647    
648   if [ -z $KRNVER ]  install_bootsector_chroot()
649   then  {
650   KRNVER="AutoSta_LX"   local my_roothdd
651   fi   local grubconf=${INSTALLPATH}/boot/grub/grub.conf
652     local grub2conf=/boot/grub/grub.cfg
653    
654   if [ -z $KRNIMG ]   # check for grub2
655     if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]
656   then   then
657   KRNIMG="bzImage"   # needed by grub-mkconfig on the first run
658   fi   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]
659     then
660     install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || die
661     fi
662    
663   if [ -z $KRNINITRD ]   # set kernelopts
664   then   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]
665   KRNINITRD="initrd"   then
666   fi   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || die
667     sed -i "s:^\(export GRUB_GFXPAYLOAD_LINUX=\).*:\1\"${GRUB2GFXPAYLOAD}\":" ${INSTALLPATH}/etc/conf.d/grub || die
668     else
669     echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || die
670     echo "export GRUB_GFXPAYLOAD_LINUX=\"${GRUB2GFXPAYLOAD}\"" >>  ${INSTALLPATH}/etc/conf.d/grub || die
671     fi
672     echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || die
673     echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
674     echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || die
675     echo "exit 0" >> ${INSTALLPATH}/root/.installrc || die
676    
677   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die   # grub-legacy
678   echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die   else
679   #no support for splash image in 6.1-r2   ### grubconf schreiben
680   #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  
681    
682   ### bootsector schreiben   #for alx only
683   #grub --no-floppy < $CONFIGS_TEMPLATE/grubsettings || die   if [ -e ${INSTALLPATH}/etc/alx_version ]
684   /sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null || die   then
685  root (hd0,0)   OLD_ALXVER="${ALXVER}"
686  setup (hd0)   source ${INSTALLPATH}/etc/alx_version
687  quit   KRNVER="ALX-${ALXVER}"
688  EOF   ALXVER="${OLD_ALXVER}"
689  }   fi
690    
691  install_bootsector_chroot() {   [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
692   ### grubconf schreiben   [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
693   #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  
694    
695   if [ -z "$KRNIMG" ]   # uuid support
696   then   if is_uuid_supported
697   KRNIMG="bzImage"   then
698   fi   my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
699     else
700     my_roothdd="${ROOTHDD}"
701     fi
702    
703   if [ -z "$KRNINITRD" ]   : > ${grubconf} || die
704   then   echo "default 0" >> ${grubconf} || die
705   KRNINITRD="initrd"   echo "timeout 3" >> ${grubconf} || die
706   fi   # using current root password
707     echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || die
708    
709     echo  >> ${grubconf} || die
710     echo "# normal boot" >> ${grubconf} || die
711     echo "title ${KRNVER}" >> ${grubconf} || die
712     echo "root (hd0,0)" >> ${grubconf} || die
713     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || die
714     if is_initrd_supported
715     then
716     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
717     fi
718    
719   echo -e "default 0" > $INSTALLPATH/boot/grub/grub.conf || die   echo >> ${grubconf} || die
720   echo -e "timeout 03" >> $INSTALLPATH/boot/grub/grub.conf ||die   echo "# admin boot" >> ${grubconf} || die
721     echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || die
722   #no support for splash image in 6.1-r2   echo "lock"  >> ${grubconf} || die
723   #echo -e "splashimage=(hd0,0)/boot/grub/splash.xpm.gz" >> $INSTALLPATH/boot/grub/grub.conf || die   echo "root (hd0,0)" >> ${grubconf} || die
724     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || die
725   echo -e "\ntitle=${KRNVER}" >> $INSTALLPATH/boot/grub/grub.conf || die   if is_initrd_supported
726   echo -e "root (hd0,0)" >> $INSTALLPATH/boot/grub/grub.conf || die   then
727     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
728   #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  
729    
730     echo >> ${grubconf} || die
731     echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || die
732     echo "lock"  >> ${grubconf} || die
733     echo "root (hd0,0)" >> ${grubconf} || die
734     echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || die
735     if is_initrd_supported
736     then
737     echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || die
738     fi
739    
740   ### bootsector schreiben chrooted schreiben (gentoo)   # write bootsector chrooted (lfs/magellan)
741   if [ -f $INSTALLPATH/sbin/grub ]   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
742   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  
743  root (hd0,0)  root (hd0,0)
744  setup (hd0)  setup (hd0)
745  quit  quit
# Line 530  exit 0 Line 748  exit 0
748  CHROOTEOF  CHROOTEOF
749   fi   fi
750    
751   ### bootsector schreiben chrooted schreiben (lfs/magellan)   ## enters chroot
752   if [ -f $INSTALLPATH/usr/sbin/grub ]   mount -t proc proc ${INSTALLPATH}/proc
753   then   mount -t sysfs sysfs ${INSTALLPATH}/sys
754   cat > $INSTALLPATH/root/.bashrc << CHROOTEOF   mount -o bind /dev ${INSTALLPATH}/dev
755  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
756  root (hd0,0)   umount ${INSTALLPATH}/proc
757  setup (hd0)   umount ${INSTALLPATH}/sys
758  quit   umount ${INSTALLPATH}/dev
759  EOF   rm ${INSTALLPATH}/root/.installrc
760    }
761    
762    is_initrd_supported()
763    {
764     # only generate initrds if the cmd exists
765     [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0
766     return 1
767    }
768    
769    install_initrd_chroot()
770    {
771     # only generate initrds if the cmd exists
772     is_initrd_supported || return 0
773    
774     DISKMODS="sd_mod"
775     OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
776     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
777     SATAMODS="sata_via sata_sis sata_nv"
778     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
779     OTHERMODS=""
780     case ${SPECIALDEVICE} in
781     zotac_intel|i845) FBMODS=""; DRMMODS="i915" ;;
782     zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;;
783     rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards
784     # not working with kms enabled drivers -> segfaults
785     #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer
786     maxdata) FBMODS="" ;;
787     *) FBMODS="uvesafb" ;;
788     esac
789    
790     if [[ ${FORMFACTOR} = laptop ]]
791     then
792     OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave"
793     fi
794    
795     # install an appropriate uvesafb.conf
796     install -d ${INSTALLPATH}/etc/modprobe.d || die
797     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || die
798    
799     # install an appropriate viafb.conf
800     echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || die
801    
802     # install an appropriate i810fb.conf
803     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
804    
805     cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF
806    echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
807    mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
808  exit 0  exit 0
809  CHROOTEOF  CHROOTEOF
810    
811     ## enters chroot
812     mount -t proc proc ${INSTALLPATH}/proc
813     mount -t sysfs sysfs ${INSTALLPATH}/sys
814     mount -o bind /dev ${INSTALLPATH}/dev
815     chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i
816     umount ${INSTALLPATH}/proc
817     umount ${INSTALLPATH}/sys
818     umount ${INSTALLPATH}/dev
819     rm ${INSTALLPATH}/root/.installrc
820    }
821    
822    is_uuid_supported()
823    {
824     if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]
825     then
826     # only detect uuids if supported
827     if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
828     then
829     return 0
830     fi
831   fi   fi
832    
833   ##enters chroot   return 1
  mount -t proc proc $INSTALLPATH/proc  
  chroot $INSTALLPATH /bin/bash --rcfile /root/.bashrc -i  
  umount $INSTALLPATH/proc  
  rm $INSTALLPATH/root/.bashrc  
834  }  }
835    
836  install_alxconfig(){  get_uuid()
837   lastdir="`pwd`"  {
838     local UUID
839     local SEC_TYPE
840     local TYPE
841    
842   mkdir -p $INSTALLPATH/opt/alx-config || die   local dev="$1"
843   cd $INSTALLPATH/opt/alx-config || die   [[ -z ${dev} ]] && die "no dev given"
  tar xzpf $CDPATH/alx-config/alx-config.tar.gz || die  
  chmod a+x $INSTALLPATH/opt/alx-config/Configurator/config_functions.sh || die  
  chmod a+x $INSTALLPATH/opt/alx-config/Configurator/config_menu.sh || die  
  ln -sf /opt/alx-config/Configurator/config_menu.sh $INSTALLPATH/bin/ALXConfig || die  
844    
845   cd $lastdir || die   # check if given device is already an UUID
846     if [[ ${dev/UUID=/}x != ${dev}x ]]
847     then
848     eval "${dev}"
849     else
850     eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //')
851     fi
852     echo "${UUID}"
853  }  }
854    
855    install_system_settings()
856    {
857     # schreibe fstab
858     if is_uuid_supported
859     then
860     echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
861     echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
862     else
863     echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || die
864     echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || die
865     fi
866     # not needed busybox loads all with swapon -a, even if not mentioned in fstab
867     #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || die
868     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
869     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
870    
871  install_system_settings(){   # install network config skeleton
872   ### schreibe fstab   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || die
  echo -e "$BOOTHDD\t/\text3\tnoatime,noauto\t1 1" > $INSTALLPATH/etc/fstab || die  
  echo -e "$ROOTHDD\t/\text3\tnoatime\t0 0" >> $INSTALLPATH/etc/fstab || die  
  echo -e "$SWAPHDD\tswap\tswap\tpri=1\t0 0" >> $INSTALLPATH/etc/fstab || die  
  echo -e "none\t/proc\tproc\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die  
   
  #deprecated  
  #echo -e "devpts\t/dev/pts\tdevpts\tgid=4,mode=620\t0 0" >> $INSTALLPATH/etc/fstab || die  
873    
874   echo -e "none\t/dev/shm\ttmpfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   # intel framebufer quirk
875   echo -e "none\t/proc/bus/usb\tusbfs\tdefaults\t0 0" >> $INSTALLPATH/etc/fstab || die   if [[ -e /proc/fb ]]
876     then
877     if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]]
878     then
879     fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
880     if [[ ${fbdev} != 0 ]]
881     then
882     sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || die
883     fi
884     fi
885     fi
886  }  }
887    
888  install_hotfixes(){  install_system_settings_simple()
889   if [ -f $CDPATH/hotfixes/hotfixes.sh ]  {
890     # write fstab
891     if is_uuid_supported
892   then   then
893   dialog_hotfixes   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
894   sleep1   else
895   $CDPATH/hotfixes/hotfixes.sh   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || die
896   fi   fi
897     echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
898     echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || die
899  }  }
900    
901  install_umount_rootfs() {  install_umount_rootfs()
902    {
903   cd /   cd /
904   umount $INSTALLPATH/boot || die   umount ${INSTALLPATH}/boot || die
905   umount $INSTALLPATH || die   umount ${INSTALLPATH} || die
906   swapoff $SWAPHDD || die   swapoff ${SWAPHDD} || die
907  }  }
908    
909  install_do_reboot() {  install_umount_rootfs_simple()
910    {
911   #only for now later it will be used again   cd /
912   #with 6.1-r2 these options are not available   umount ${INSTALLPATH} || die
913   #cd /  }
914   #umount $CDPATH  
915   #eject  install_do_reboot()
916   #clear  {
   
917   reboot   reboot
918  }  }
919    
920  #################################################  #################################################
921  #     Install Ablauf Scripte #  #     Install Main Scripts #
922  #################################################  #################################################
923    
924  run_install_normal() {  run_install_normal()
925   #only for now later it will be used again  {
926   #with 6.1-r2 only one install method available   dialog_hardware_detection
927   #dialog_setup_hdd_menu  
  dialog_setup_hdd_found_manuell  
   
928   dialog_setup_hdd_partitions_manuell   dialog_setup_hdd_partitions_manuell
929   dialog_setup_hdd_format   dialog_setup_hdd_format
930   setup_hdd_format > /dev/null   setup_hdd_format > /dev/null
931   install_mount_rootfs   install_mount_rootfs
932   (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
933    
  #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  
   
934   dialog_install_settings   dialog_install_settings
935   sleep 1   sleep 1
936   install_system_settings   install_system_settings
937   install_hotfixes   install_initrd_chroot
938    
939     dialog_install_bootsector
940     install_bootsector_chroot
941    
942   install_umount_rootfs   install_umount_rootfs
943   dialog_install_successful   dialog_install_successful
944  }  }
945    
946  run_install_silent() {  run_install_simple()
947   echo "starting silent install ..."  {
948     dialog_hardware_detection
949    
950     dialog_setup_hdd_partitions_manuell_simple
951     dialog_setup_hdd_format
952     setup_hdd_format_simple > /dev/null
953     install_mount_rootfs_simple
954     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
955    
956     dialog_install_settings
957   sleep 1   sleep 1
958     install_system_settings_simple
959     install_initrd_chroot
960    
961     dialog_install_bootsector
962     install_bootsector_chroot
963    
964     install_umount_rootfs_simple
965     dialog_install_successful
966  }  }
967    
968  run_install_unattended() {  run_install_auto()
969   echo "starting unattended install ..."  {
970     dialog_hardware_detection
971    
972     dialog_setup_hdd_partitions_auto
973     dialog_setup_hdd_format
974     setup_hdd_format_simple > /dev/null
975     install_mount_rootfs_simple
976     (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image
977    
978     dialog_install_settings
979   sleep 1   sleep 1
980     install_system_settings_simple
981     install_initrd_chroot
982    
983     dialog_install_bootsector
984     install_bootsector_chroot
985    
986     install_umount_rootfs_simple
987     dialog_install_successful
988  }  }
989    
990  if [ "$1" == "unattended" ]  dialog_main
 then  
  run_install_unattended  
 else  
  dialog_main  
 fi  
991    
992  exit 0  exit 0

Legend:
Removed from v.260  
changed lines
  Added in v.6820