#!/bin/sh # Installing packages (doing the real dist-upgrade) # gettext domain TEXTDOMAIN="lliurex-up" export TEXTDOMAIN COMMON_LIBRARY="/usr/share/lliurex-up/common-upgrade-vars.sh" if [ -r $COMMON_LIBRARY ] ; then . $COMMON_LIBRARY fi #gettext messages INFO_MESSAGE="$(gettext "Install required packages")" SERVER_ATENTION_MESSAGE="$(gettext "This seems a LliureX Server, caution. ")" SERVER_REMOVE_PACKAGES_MESSAGE="$(gettext "Removing some packages")" SERVER_INSTALL_PACKAGES_MESSAGE="$(gettext "Installed some packages")" APACHE_CRT_FILE="/etc/lliurex-secrets/certs/apache/apache.crt" APACHE_CRT_FILE_NCFG="/usr/share/ca-certificates/lliurex-certs/ncfg-certs/apache.crt" APACHE_CRT_FILE_NCFG_VAR="/var/lib/llxcfg-ncfg-certs/certificates/ncfg-certs/apache.crt" # Methods _commonPreUpgradeActions() { for package in lliurex-live-ubiquity ubiquity ubiquity-casper ubiquity-frontend-gtk ubiquity-ubuntu-artwork casper-customize-mod-autologin casper-customize-mod-nsswitch; do _test_and_remove_package ${package} done } _musicaPreUpgradeActions() { echo " * [ LliureX Up ] : Musica Upgrade" } _infantilPreUpgradeActions() { echo " * [ LliureX Up ] : Infantil Upgrade" } _desktopPreUpgradeActions() { echo " * [ LliureX Up ] : Desktop Upgrade" } _biblioPreUpgradeActions() { echo " * [ LliureX Up ] : Biblioteca Upgrade" _cleanhome } _clientPreUpgradeActions() { echo " * [ LliureX Up ] : Client Upgrade" _cleanhome } _teachersPreUpgradeActions() { echo " * [ LliureX Up ] : Teachers Upgrade" } _pimePreUpgradeActions() { echo " * [ LliureX Up ] : Pime Upgrade" } # Post Upgrade Actions _serverPostUpgradeActions() { echo "$SERVER_ATENTION_MESSAGE" # Install some packages. echo "$SERVER_INSTALL_PACKAGES_MESSAGE" apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_SERVER" for package in modemmanager; do _test_and_remove_package ${package} done } _musicaPostUpgradeActions() { echo " * [ LliureX Up ] : Musica Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_MUSIC" } _infantilPostUpgradeActions() { echo " * [ LliureX Up ] : Infantil Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_INFANTIL" } _desktopPostUpgradeActions() { echo " * [ LliureX Up ] : Desktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_DESKTOP" } _biblioPostUpgradeActions() { echo " * [ LliureX Up ] : Biblioteca Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_BIBLIOTECA" } _clientPostUpgradeActions() { echo " * [ LliureX Up ] : Client" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_CLIENT" for package in modemmanager lliurex-initramfs-tools-nsswitch ; do _test_and_remove_package ${package} done } _teachersPostUpgradeActions() { echo " * [ LliureX Up ] : Teachers Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_TEACHERS" } _pimePostUpgradeActions() { echo " * [ LliureX Up ] : Pime Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_PIME" } _info() { echo "$INFO_MESSAGE" } _migrate() { _discoverCddVersion _commonPreUpgradeActions apt-get dist-upgrade -y --force-yes apt-get -f install if [ $IS_SERVER -eq 0 ] ; then _serverPostUpgradeActions fi if [ $IS_CLIENT -eq 0 ] ; then _clientPostUpgradeActions fi update-grub } _usage() { echo " * [ LliureX Up ] : # Unknown argument" } _die() { echo " * [ LliureX Up ] : Error: $1" exit 1 } _partial() { _discoverCddVersion _commonPreUpgradeActions packages_list="/tmp/packages_checked" if [ -s $packages_list ]; then apt-get --force-yes install $(cat $packages_list); apt-get -f install else echo "* [ Lliurex Up ] : File packages_checked don't exist or is empty" fi if [ $IS_SERVER -eq 0 ] ; then _serverPostUpgradeActions fi if [ $IS_CLIENT -eq 0 ] ; then _clientPostUpgradeActions fi update-grub } ACTION="$1" case "$ACTION" in migrate) _migrate ;; info) _info ;; partial) _partial ;; *) _usage ;; esac exit 0