--- trunk/installer-simple/bin/installer.sh.in 2014/01/08 10:32:55 2482 +++ trunk/installer-simple/bin/installer.sh.in 2014/07/03 08:01:05 2653 @@ -9,7 +9,6 @@ # setup locales TEXTDOMAIN=installer -LC_MESSAGES=C # include dir INSTALLER_LIBDIR="%LIBDIR%" @@ -41,27 +40,13 @@ fi done -# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! -# -> now in images.conf -CDIMAGENAME="" -TOTALLINES="" -CURRENTLINE=0 -if [ -e /mnt/cdrom/system/images.conf ] -then - source /mnt/cdrom/system/images.conf - # check if all required variables are set - [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" - [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" -else - die "/mnt/cdrom/system/images.conf not found" -fi - ### System/Config Version VERSION="%VERSIONTAG%" TITLE="${DEFAULT_TITLE} - ${VERSION}" # some sane defaults -CDROOT="${DEFAULT_CDROOT}" +LIVEROOT="${DEFAULT_LIVEROOT}" +IMAGEROOT="${DEFAULT_IMAGEROOT}" INSTALLROOT="${DEFAULT_INSTALLROOT}" KERNELPKG="${DEFAULT_KERNELPKG}" KERNELOPTS="${DEFAULT_KERNELOPTS}" @@ -72,6 +57,20 @@ FORMFACTOR="${DEFAULT_FORMFACTOR}" FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" +# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! +# -> now in images.conf +CDIMAGENAME="" +TOTALLINES="" +CURRENTLINE=0 +if [ -e ${IMAGEROOT}/images.conf ] +then + source ${IMAGEROOT}/images.conf + # check if all required variables are set + [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" + [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" +else + die "${IMAGEROOT}/images.conf not found" +fi ### helper scripts ### @@ -100,6 +99,29 @@ return 0 } +mount_rootfs() +{ + local retval + + if is_mounted --location "${INSTALLROOT}" + then + echo $"${INSTALLROOT} already mounted" >&2 + else + mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" + fi + [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot +} + +umount_rootfs() +{ + is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot + is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} +} + +install_do_reboot() +{ + reboot +} run_hardware_detection() { @@ -166,9 +188,9 @@ # all disks but exclude ramdisks export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') # remove the boot device from ALL_DISKS if it was an usbstick - if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] + if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] then - bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" + bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") fi export ALL_CDROMS="$(get_hwinfo cdrom)" @@ -188,7 +210,7 @@ # run this only if FDISKPARTITIONBELOW256MB is not already 1 if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] then - if hdd_size_below_256mb ${HDD} + if device_minimum_size "${HDD}" 256 then FDISKPARTIONBELOW256MB=1 else @@ -263,16 +285,10 @@ mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die } -install_mount_rootfs() -{ - is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" - install -d ${INSTALLROOT}/boot || dialog_die -} - install_system_image() { pushd ${INSTALLROOT} > /dev/null - tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} + tar xvjpf ${IMAGEROOT}}/${CDIMAGENAME} -C ${INSTALLROOT} popd > /dev/null } @@ -294,33 +310,17 @@ addconfig 'NETWORKING="dhcp"' # intel framebuffer quirk - if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] + CONFIG="${INSTALLROOT}/etc/splash/splash.conf" + if [ -e ${CONFIG} ] && [ -e /proc/fb ] then - if [ -e /proc/fb ] + if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] then - if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] - then - 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 + fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') + [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die fi fi } -install_umount_rootfs() -{ - is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot - is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} -} - -install_do_reboot() -{ - reboot -} - ### installer dialogs ### @@ -483,7 +483,7 @@ task_setup_hdd_partitions_manual dialog_setup_hdd_format setup_hdd_format > /dev/null - install_mount_rootfs + mount_rootfs (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image dialog_install_settings @@ -500,7 +500,7 @@ bootloader_config bootloader_install - install_umount_rootfs + umount_rootfs dialog_install_successful } @@ -511,7 +511,7 @@ task_setup_hdd_partitions_auto dialog_setup_hdd_format setup_hdd_format > /dev/null - install_mount_rootfs + mount_rootfs (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image dialog_install_settings @@ -528,7 +528,7 @@ bootloader_config bootloader_install - install_umount_rootfs + umount_rootfs dialog_install_successful }