diff --git a/scripts/common_functions.sh b/scripts/common_functions.sh index 82b2fd8ed37e8659d5af5e523c18689e15c675bf..0e6065889563d4e33eafb0aa7e72347b3896af66 100644 --- a/scripts/common_functions.sh +++ b/scripts/common_functions.sh @@ -60,10 +60,18 @@ function install_debs() function divert_initctl() { dpkg-divert --local --rename --add /sbin/initctl - ln -s /bin/true /sbin/initctl || ( echo "LIPCK: Failed to divert initcl!" && revert_initctl && exit 1 ) + if ! ln -s /bin/true /sbin/initctl; then + echo "LIPCK: Failed to divert initctl!" + revert_initctl + exit 1 + fi # Fix sysvinit legacy invoke-rc.d issue with nonexisting scripts dpkg-divert --local --rename --add /usr/sbin/invoke-rc.d - ln -s /bin/true /usr/sbin/invoke-rc.d + if ! ln -s /bin/true /usr/sbin/invoke-rc.d; then + echo "LIPCK: Failed to divert invoke-rc.d!" + revert_initctl + exit 1 + fi } function revert_initctl() diff --git a/scripts/remaster_rootfs.sh b/scripts/remaster_rootfs.sh index 076da54932dec9589a66eafc15e6812383a128ee..3a674694e610192e87e80031fcd06c755b9120bd 100755 --- a/scripts/remaster_rootfs.sh +++ b/scripts/remaster_rootfs.sh @@ -57,25 +57,42 @@ function install_packages_from_file() APT_OPTIONS=$2 PKGS=$(get_packages_from_file "$1") - aptitude install -y $APT_OPTIONS $PKGS + apt-get -y $APT_OPTIONS install $PKGS } function install_packages() { apt-get dist-upgrade --assume-yes --force-yes - apt-get install aptitude -y + apt-get -y autoremove + #apt-get install aptitude -y - #aptitude full-upgrade -y # make sure we have the newest versions + #apt-get dist-upgrade -y # make sure we have the newest versions #Some daily images do not have a kernel; #ensure that a valid kernel is installed - KERNEL_PKG=linux-signed-generic-lts-trusty - [ "$(uname -m)" == "x86_64" ] || KERNEL_PKG=linux-image-generic-lts-trusty - aptitude reinstall $KERNEL_PKG -y - apt-cache depends $KERNEL_PKG | tail -n+2 | awk '{print $NF}' | xargs aptitude reinstall -y + + #make sure we have a initrd (otherwise the kernel update may fail + if [ ! -e "$(readlink -f /initrd.img)" ]; then + echo "LIPCK: No initrd in place; generating new one." + update-initramfs -v -c -k all + fi + + #Note: this does only work if we have a recent install iso since older kernels are removed from + # the repositories + KERNEL_PKG=$(dpkg -S "$(readlink -f /vmlinuz)" | cut -d ":" -f1) + if [ -z "$KERNEL_PKG" ]; then + echo "LIPCK: remaster_rootfs: unable to determine installed kernel version; giving up..." + fi + #[ "$(uname -m)" == "x86_64" ] || KERNEL_PKG=linux-image-generic-lts-trusty + if [ ! -e "$(readlink -f /initrd.img)" ]; then + echo "LIPCK: No kernel in place; try to reinstall kernel image package:" + echo " $KERNEL_PKG" + apt-get --reinstall -y install $KERNEL_PKG + #apt-cache depends $KERNEL_PKG | tail -n+2 | awk '{print $NF}' | xargs apt-get --reinstall -y install + fi install_packages_from_file "$CONTRIB_DIR/pre_installed_packages" "" - install_packages_from_file "$CONTRIB_DIR/pre_installed_packages.without-recommends" "--without-recommends" + install_packages_from_file "$CONTRIB_DIR/pre_installed_packages.without-recommends" "--no-install-recommends" install_lang_packages diff --git a/scripts/uck_functions.sh b/scripts/uck_functions.sh index b6e614c2c5d65e2deb7853fd6b749244eb195625..5b4c67c7bc51fb2bd72476c720850080a474ebfc 100644 --- a/scripts/uck_functions.sh +++ b/scripts/uck_functions.sh @@ -26,12 +26,12 @@ function install_lang_packages() MISSING_LANG_PKG="$(check-language-support -l en_US) $MISSING_LANG_PKG" # check for missing packages for de_DE and en_US if [ -n "$MISSING_LANG_PKG" ]; then - aptitude install $MISSING_LANG_PKG -y + apt-get -y install $MISSING_LANG_PKG fi - EXTRA_LANG_PKG="$(dpkg-query --show | cut -f1 | grep -E '^(language-pack|language-support|firefox-locale|thunderbird-locale|libreoffice-help|libreoffice-l10n)' | grep -Ev "[-](de|en)\>")" # remove extra language packages + EXTRA_LANG_PKG="$(dpkg-query --show | cut -f1 | grep -E '^(language-pack|language-support|firefox-locale|thunderbird-locale|libreoffice-help|libreoffice-l10n)' | grep -Ev "[-](de|en)\>" || true)" # remove extra language packages if [ -n "$EXTRA_LANG_PKG" ]; then - aptitude purge $EXTRA_LANG_PKG -y + apt-get -y purge $EXTRA_LANG_PKG fi }