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

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