--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:13:11 2429 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:48:42 2442 @@ -281,29 +281,30 @@ hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" - # check for special devices/clients: - # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd - local removable=0 - if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] - then - for i in /sys/block/[hs]d*/removable - do - if [[ $(< ${i}) = 1 ]] - then - removable=1 - fi - done - - # only add this for grub legacy, grub2 detect these settings on its own - export GRUBLEGACYOPTS="rootdelay=8" - # there are to zotac types in the wild, nvidia based gfx and intel - if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] - then - export SPECIALDEVICE="zotac_nvidia" - else - export SPECIALDEVICE="zotac_intel" - fi - fi + ## check for special devices/clients: + ## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd + #local removable=0 + #if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] + #then + #for i in /sys/block/[hs]d*/removable + #do + #if [[ $(< ${i}) = 1 ]] + #then + #removable=1 + #fi + #done + ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' + + ## only add this for grub legacy, grub2 detect these settings on its own + #export GRUBLEGACYOPTS="rootdelay=8" + ## there are to zotac types in the wild, nvidia based gfx and intel + #if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] + #then + #export SPECIALDEVICE="zotac_nvidia" + #else + #export SPECIALDEVICE="zotac_intel" + #fi + #fi # check for special devices/clients: # if a rangee and disk ist smaller then 256mb move partion one block further ahead @@ -369,6 +370,13 @@ { ROOTHDD="${HDD}1" + # sanity check - should not happen + if is_mounted --device "${ROOTHDD}" + then + echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 + umount "${ROOTHDD}" + fi + # run this only if FDISKPARTITIONBELOW256MB is not already 1 if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] then @@ -430,26 +438,34 @@ setup_hdd_partitions_manual() { ROOTHDD="${HDD}1" - - ## hdds partitionieren manual + SWAPHDD="" + BOOTHDD="" cfdisk ${HDD} || dialog_die } setup_hdd_format() { - mke2fs -j -q ${ROOTHDD} || dialog_die + # sanity check - should not happen + if is_mounted --device "${ROOTHDD}" + then + echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 + umount "${ROOTHDD}" + fi + + mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die } install_mount_rootfs() { - mount ${ROOTHDD} ${INSTALLROOT} || dialog_die + is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" install -d ${INSTALLROOT}/boot || dialog_die - cd ${INSTALLROOT} || dialog_die } install_system_image() { + pushd ${INSTALLROOT} > /dev/null tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} + popd > /dev/null } install_bootsector_chroot() @@ -498,12 +514,7 @@ [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" # uuid support - if is_uuid_supported - then - my_roothdd="UUID=$(get_uuid ${ROOTHDD})" - else - my_roothdd="${ROOTHDD}" - fi + my_roothdd="UUID=$(get_uuid ${ROOTHDD})" : > ${grubconf} || dialog_die echo "default 0" >> ${grubconf} || dialog_die @@ -553,24 +564,11 @@ CHROOTEOF fi - ## enter chroot - mount -t proc proc ${INSTALLROOT}/proc - mount -t sysfs sysfs ${INSTALLROOT}/sys - mount -o bind /dev ${INSTALLROOT}/dev - chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i - umount ${INSTALLROOT}/proc - umount ${INSTALLROOT}/sys - umount ${INSTALLROOT}/dev + # run installrc + chrooted /bin/bash --rcfile /root/.installrc -i rm ${INSTALLROOT}/root/.installrc } -is_initrd_supported() -{ - # only generate initrds if the cmd exists - [[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 - return 1 -} - install_initrd_chroot() { # only generate initrds if the cmd exists @@ -613,59 +611,15 @@ exit 0 CHROOTEOF - ## enters chroot - mount -t proc proc ${INSTALLROOT}/proc - mount -t sysfs sysfs ${INSTALLROOT}/sys - mount -o bind /dev ${INSTALLROOT}/dev - chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i - umount ${INSTALLROOT}/proc - umount ${INSTALLROOT}/sys - umount ${INSTALLROOT}/dev + # run installrc + chrooted /bin/bash --rcfile /root/.installrc -i rm ${INSTALLROOT}/root/.installrc } -is_uuid_supported() -{ - if [[ -x $(type -P busybox.mkinitrd) ]] - then - # only detect uuids if supported - if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] - then - return 0 - fi - fi - - return 1 -} - -get_uuid() -{ - local UUID - local SEC_TYPE - local TYPE - - local dev="$1" - [[ -z ${dev} ]] && dialog_die "no dev given" - - # check if given device is already an UUID - if [[ ${dev/UUID=/}x != ${dev}x ]] - then - eval "${dev}" - else - eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') - fi - echo "${UUID}" -} - install_system_settings() { # schreibe fstab - if is_uuid_supported - then - echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die - else - echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die - fi + echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die # not needed busybox loads all with swapon -a, even if not mentioned in fstab #echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die @@ -674,15 +628,18 @@ # install network config skeleton install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die - # intel framebufer quirk - if [[ -e /proc/fb ]] + # intel framebuffer quirk + if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] then - if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] + if [ -e /proc/fb ] then - fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') - if [[ ${fbdev} != 0 ]] + if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] then - sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die + fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') + if [[ ${fbdev} != 0 ]] + then + sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die + fi fi fi fi @@ -690,9 +647,8 @@ install_umount_rootfs() { - cd / - umount ${INSTALLROOT}/boot || dialog_die - umount ${INSTALLROOT} || dialog_die + is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot + is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} } install_do_reboot() @@ -717,11 +673,16 @@ dialog_install_settings sleep 1 install_system_settings - dialog_install_initrd - install_initrd_chroot + if is_initrd_supported + then + dialog_install_initrd + initrd_config + initrd_install + fi dialog_install_bootsector - install_bootsector_chroot + bootloader_config + bootloader_install install_umount_rootfs dialog_install_successful @@ -740,11 +701,16 @@ dialog_install_settings sleep 1 install_system_settings - dialog_install_initrd - install_initrd_chroot + if is_initrd_supported + then + dialog_install_initrd + initrd_config + initrd_install + fi dialog_install_bootsector - install_bootsector_chroot + bootloader_config + bootloader_install install_umount_rootfs dialog_install_successful