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

Legend:
Removed from v.261  
changed lines
  Added in v.6815