Skip to content
Snippets Groups Projects
Commit 1a887e8c authored by Christopher Spinrath's avatar Christopher Spinrath
Browse files

Merge branch 'fix_remaster_rootfs'

This changeset resolves the "set -e" issue in remaster_rootfs.
Additionally, some cleanups (cf. issue #337) have been applied.
parents 12bfdbf8 2c559d64
Branches
Tags
No related merge requests found
......@@ -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()
......
......@@ -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
......
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment