Magellan Linux

Diff of /trunk/installer-simple/bin/installer.sh.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2341 by niro, Fri Jan 3 14:38:46 2014 UTC revision 2345 by niro, Fri Jan 3 15:02:43 2014 UTC
# Line 46  source ${INSTALLER_LIBDIR}/functions/hwd Line 46  source ${INSTALLER_LIBDIR}/functions/hwd
46  VERSION="%VERSIONTAG%"  VERSION="%VERSIONTAG%"
47  TITLE="${DEFAULT_TITLE} - ${VERSION}"  TITLE="${DEFAULT_TITLE} - ${VERSION}"
48    
49  CDPATH="${DEFAULT_CDPATH}"  CDROOT="${DEFAULT_CDROOT}"
50  INSTALLPATH="${DEFAULT_INSTALLPATH}"  INSTALLROOT="${DEFAULT_INSTALLROOT}"
51    
52  # standard kernel opts  # standard kernel opts
53  KERNELOPTS="quiet video=1024x768"  KERNELOPTS="quiet video=1024x768"
# Line 180  dialog_hardware_detection() Line 180  dialog_hardware_detection()
180   local i   local i
181   local hwtmp   local hwtmp
182    
183   if [ -x $(which mktemp &> /dev/null) ]   if [ -x $(type -P mktemp) ]
184   then   then
185   hwtmp="$(mktemp)"   hwtmp="$(mktemp)"
186   else   else
187   hwtmp="/tmp/hwtmp.sh"   hwtmp="/tmp/hwtmp.sh"
188   fi   fi
189    
190   [[ ! -z ${installdevs} ]] && installdevs=""   run_hardware_detection_disks
191    
192   echo "dialog \\"  > ${hwtmp}   echo "dialog \\"  > ${hwtmp}
193   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}   echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp}
# Line 197  dialog_hardware_detection() Line 197  dialog_hardware_detection()
197   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}   echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp}
198   echo " Festplatten:\n \\" >> ${hwtmp}   echo " Festplatten:\n \\" >> ${hwtmp}
199    
200   if [[ ! -z ${scsidisks} ]]   if [[ ! -z ${ALL_DISKS} ]]
201   then   then
202   for i in ${scsidisks}   for i in ${ALL_DISKS}
203   do   do
204   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7SCSI: \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
205   done   done
206   fi   fi
207    
208   if [[ ! -z ${idedisks} ]]   if [[ ! -z ${ALL_CDROMS} ]]
209   then   then
210   for i in ${idedisks}   echo " \n \\" >> ${hwtmp}
211     echo " CDROM Laufwerke:\n \\" >> ${hwtmp}
212     for i in ${ALL_CDROMS}
213   do   do
214   if [[ ${i} != ${cdromdev} ]]   echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp}
  then  
  echo " \\Z7IDE:  \\Z3${i}\\Zn\n \\" >> ${hwtmp}  
  installdevs="${installdevs} ${i}"  
  fi  
215   done   done
216   fi   fi
217    
  if [[ ! -z ${cdromdev} ]]  
  then  
  echo " \n \\" >> ${hwtmp}  
  echo " \\Z7andere Laufwerke:\n \\" >> ${hwtmp}  
  echo " CDROM: \\Z3${cdromdev}\\Zn\n \\" >> ${hwtmp}  
  fi  
   
218   # other devices   # other devices
219   run_hardware_detection   run_hardware_detection
220   case "${SPECIALDEVICE}" in   case "${SPECIALDEVICE}" in
# Line 367  dialog_setup_hdd_partitions_auto() Line 354  dialog_setup_hdd_partitions_auto()
354   fi   fi
355  }  }
356    
357    run_hardware_detection_disks()
358    {
359     local bootdev
360    
361     # all disks but exclude ramdisks
362     export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d')
363     # remove the boot device from ALL_DISKS if it was an usbstick
364     if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]]
365     then
366     bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')"
367     export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}")
368     fi
369     export ALL_CDROMS="$(get_hwinfo cdrom)"
370    }
371    
372  dialog_setup_hdd_create_partitions()  dialog_setup_hdd_create_partitions()
373  {  {
374   dialog \   dialog \
# Line 637  setup_hdd_format_flash() Line 639  setup_hdd_format_flash()
639  install_mount_rootfs()  install_mount_rootfs()
640  {  {
641   swapon ${SWAPHDD} || dialog_die   swapon ${SWAPHDD} || dialog_die
642   mount ${ROOTHDD} ${INSTALLPATH} || dialog_die   mount ${ROOTHDD} ${INSTALLROOT} || dialog_die
643   install -d ${INSTALLPATH}/boot || dialog_die   install -d ${INSTALLROOT}/boot || dialog_die
644   mount ${BOOTHDD} ${INSTALLPATH}/boot || dialog_die   mount ${BOOTHDD} ${INSTALLROOT}/boot || dialog_die
645   cd ${INSTALLPATH} || dialog_die   cd ${INSTALLROOT} || dialog_die
646  }  }
647    
648  install_mount_rootfs_flash()  install_mount_rootfs_flash()
649  {  {
650   mount ${ROOTHDD} ${INSTALLPATH} || dialog_die   mount ${ROOTHDD} ${INSTALLROOT} || dialog_die
651   install -d ${INSTALLPATH}/boot || dialog_die   install -d ${INSTALLROOT}/boot || dialog_die
652   cd ${INSTALLPATH} || dialog_die   cd ${INSTALLROOT} || dialog_die
653  }  }
654    
655  install_system_image()  install_system_image()
656  {  {
657   tar xvjpf ${CDPATH}/system/${CDIMAGENAME} -C ${INSTALLPATH}   tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT}
658  }  }
659    
660  install_bootsector_chroot()  install_bootsector_chroot()
661  {  {
662   local my_roothdd   local my_roothdd
663   local grubconf=${INSTALLPATH}/boot/grub/grub.conf   local grubconf=${INSTALLROOT}/boot/grub/grub.conf
664   local grub2conf=/boot/grub/grub.cfg   local grub2conf=/boot/grub/grub.cfg
665    
666   # check for grub2   # check for grub2
667   if [[ -f ${INSTALLPATH}/sbin/grub-mkconfig ]]   if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]]
668   then   then
669   # needed by grub-mkconfig on the first run   # needed by grub-mkconfig on the first run
670   if [[ ! -f ${INSTALLPATH}/boot/grub/video.lst ]]   if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]]
671   then   then
672   install -m0644 ${INSTALLPATH}/lib/grub/*/video.lst ${INSTALLPATH}/boot/grub/video.lst || dialog_die   install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die
673   fi   fi
674    
675   # set kernelopts   # set kernelopts
676   if [[ -f ${INSTALLPATH}/etc/conf.d/grub ]]   if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]]
677   then   then
678   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLPATH}/etc/conf.d/grub || dialog_die   sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die
679   else   else
680   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLPATH}/etc/conf.d/grub || dialog_die   echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" >  ${INSTALLROOT}/etc/conf.d/grub || dialog_die
681   fi   fi
682   echo 'grub-mkdevicemap' > ${INSTALLPATH}/root/.installrc || dialog_die   echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die
683   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLPATH}/root/.installrc || dialog_die   echo "LC_ALL=C grub-mkconfig -o ${grub2conf}  &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die
684   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLPATH}/root/.installrc || dialog_die   echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die
685   echo "exit 0" >> ${INSTALLPATH}/root/.installrc || dialog_die   echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die
686    
687   # grub-legacy   # grub-legacy
688   else   else
689   ### grubconf schreiben   ### grubconf schreiben
690   source ${INSTALLPATH}/boot/kernelversion   source ${INSTALLROOT}/boot/kernelversion
691    
692   #for alx only   #for alx only
693   if [ -e ${INSTALLPATH}/etc/alx_version ]   if [ -e ${INSTALLROOT}/etc/alx_version ]
694   then   then
695   OLD_ALXVER="${ALXVER}"   OLD_ALXVER="${ALXVER}"
696   source ${INSTALLPATH}/etc/alx_version   source ${INSTALLROOT}/etc/alx_version
697   KRNVER="ALX-${ALXVER}"   KRNVER="ALX-${ALXVER}"
698   ALXVER="${OLD_ALXVER}"   ALXVER="${OLD_ALXVER}"
699   fi   fi
# Line 712  install_bootsector_chroot() Line 714  install_bootsector_chroot()
714   echo "default 0" >> ${grubconf} || dialog_die   echo "default 0" >> ${grubconf} || dialog_die
715   echo "timeout 3" >> ${grubconf} || dialog_die   echo "timeout 3" >> ${grubconf} || dialog_die
716   # using current root password   # using current root password
717   echo "password --md5 $(cat ${INSTALLPATH}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || dialog_die   echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"  >> ${grubconf} || dialog_die
718    
719   echo  >> ${grubconf} || dialog_die   echo  >> ${grubconf} || dialog_die
720   echo "# normal boot" >> ${grubconf} || dialog_die   echo "# normal boot" >> ${grubconf} || dialog_die
# Line 746  install_bootsector_chroot() Line 748  install_bootsector_chroot()
748   fi   fi
749    
750   # bootsector schreiben chrooted schreiben (lfs/magellan)   # bootsector schreiben chrooted schreiben (lfs/magellan)
751   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF
752  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null  /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null
753  root (hd0,0)  root (hd0,0)
754  setup (hd0)  setup (hd0)
# Line 757  CHROOTEOF Line 759  CHROOTEOF
759   fi   fi
760    
761   ## enter chroot   ## enter chroot
762   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLROOT}/proc
763   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLROOT}/sys
764   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLROOT}/dev
765   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i   chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i
766   umount ${INSTALLPATH}/proc   umount ${INSTALLROOT}/proc
767   umount ${INSTALLPATH}/sys   umount ${INSTALLROOT}/sys
768   umount ${INSTALLPATH}/dev   umount ${INSTALLROOT}/dev
769   rm ${INSTALLPATH}/root/.installrc   rm ${INSTALLROOT}/root/.installrc
770  }  }
771    
772  is_initrd_supported()  is_initrd_supported()
773  {  {
774   # only generate initrds if the cmd exists   # only generate initrds if the cmd exists
775   [[ -x ${INSTALLPATH}/sbin/mkinitrd ]] && return 0   [[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0
776   return 1   return 1
777  }  }
778    
# Line 801  install_initrd_chroot() Line 803  install_initrd_chroot()
803   fi   fi
804    
805   # install an appropriate uvesafb.conf   # install an appropriate uvesafb.conf
806   install -d ${INSTALLPATH}/etc/modprobe.d || dialog_die   install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die
807   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLPATH}/etc/modprobe.d/uvesafb.conf || dialog_die   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die
808    
809   # install an appropriate viafb.conf   # install an appropriate viafb.conf
810   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLPATH}/etc/modprobe.d/viafb.conf || dialog_die   echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die
811    
812   # install an appropriate i810fb.conf   # install an appropriate i810fb.conf
813   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 || dialog_die   echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60"  > ${INSTALLROOT}/etc/modprobe.d/i810fb.conf || dialog_die
814    
815   cat > ${INSTALLPATH}/root/.installrc << CHROOTEOF   cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF
816  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd  echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd
817  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null  mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null
818  exit 0  exit 0
819  CHROOTEOF  CHROOTEOF
820    
821   ## enters chroot   ## enters chroot
822   mount -t proc proc ${INSTALLPATH}/proc   mount -t proc proc ${INSTALLROOT}/proc
823   mount -t sysfs sysfs ${INSTALLPATH}/sys   mount -t sysfs sysfs ${INSTALLROOT}/sys
824   mount -o bind /dev ${INSTALLPATH}/dev   mount -o bind /dev ${INSTALLROOT}/dev
825   chroot ${INSTALLPATH} /bin/bash --rcfile /root/.installrc -i   chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i
826   umount ${INSTALLPATH}/proc   umount ${INSTALLROOT}/proc
827   umount ${INSTALLPATH}/sys   umount ${INSTALLROOT}/sys
828   umount ${INSTALLPATH}/dev   umount ${INSTALLROOT}/dev
829   rm ${INSTALLPATH}/root/.installrc   rm ${INSTALLROOT}/root/.installrc
830  }  }
831    
832  is_uuid_supported()  is_uuid_supported()
833  {  {
834   if [[ -x $(which busybox.mkinitrd &> /dev/null) ]]   if [[ -x $(type -P busybox.mkinitrd) ]]
835   then   then
836   # only detect uuids if supported   # only detect uuids if supported
837   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]   if [[ ! -z $(busybox.mkinitrd | grep blkid) ]]
# Line 865  install_system_settings() Line 867  install_system_settings()
867   # schreibe fstab   # schreibe fstab
868   if is_uuid_supported   if is_uuid_supported
869   then   then
870   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "UUID=$(get_uuid ${BOOTHDD})\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die
871   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
872   else   else
873   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "${BOOTHDD}\t/boot\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" > ${INSTALLROOT}/etc/fstab || dialog_die
874   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
875   fi   fi
876   # not needed busybox loads all with swapon -a, even if not mentioned in fstab   # not needed busybox loads all with swapon -a, even if not mentioned in fstab
877   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
878   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
879   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
880    
881   # install network config skeleton   # install network config skeleton
882   install -m0644 ${INSTALLPATH}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLPATH}/etc/conf.d/ || dialog_die   install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die
883    
884   # intel framebufer quirk   # intel framebufer quirk
885   if [[ -e /proc/fb ]]   if [[ -e /proc/fb ]]
# Line 887  install_system_settings() Line 889  install_system_settings()
889   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')   fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:')
890   if [[ ${fbdev} != 0 ]]   if [[ ${fbdev} != 0 ]]
891   then   then
892   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLPATH}/etc/splash/splash.conf || dialog_die   sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die
893   fi   fi
894   fi   fi
895   fi   fi
# Line 898  install_system_settings_flash() Line 900  install_system_settings_flash()
900   # schreibe fstab   # schreibe fstab
901   if is_uuid_supported   if is_uuid_supported
902   then   then
903   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die
904   else   else
905   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" > ${INSTALLROOT}/etc/fstab || dialog_die
906   fi   fi
907   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
908   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLPATH}/etc/fstab || dialog_die   echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die
909  }  }
910    
911  install_umount_rootfs()  install_umount_rootfs()
912  {  {
913   cd /   cd /
914   umount ${INSTALLPATH}/boot || dialog_die   umount ${INSTALLROOT}/boot || dialog_die
915   umount ${INSTALLPATH} || dialog_die   umount ${INSTALLROOT} || dialog_die
916   swapoff ${SWAPHDD} || dialog_die   swapoff ${SWAPHDD} || dialog_die
917  }  }
918    
919  install_umount_rootfs_flash()  install_umount_rootfs_flash()
920  {  {
921   cd /   cd /
922   umount ${INSTALLPATH} || dialog_die   umount ${INSTALLROOT} || dialog_die
923  }  }
924    
925  install_do_reboot()  install_do_reboot()

Legend:
Removed from v.2341  
changed lines
  Added in v.2345