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

Legend:
Removed from v.280  
changed lines
  Added in v.3256