#!/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")" # Methods _commonPreUpgradeActions() { # Cache for APT clean apt-get clean } _commonPostUpgradeActions() { # Remove some files if [ -f /etc/xdg/autostart/01-lliurex-xdg-mozilla-profile.desktop ] ; then rm -f /etc/xdg/autostart/01-lliurex-xdg-mozilla-profile.desktop fi if [ -f /etc/xdg/autostart/lliurex-about.desktop ] ; then rm -f /etc/xdg/autostart/lliurex-about.desktop fi } # Pre Upgrade Actions _serverPreUpgradeActions() { echo "$SERVER_ATENTION_MESSAGE" } _musicaPreUpgradeActions() { echo "Musica Upgrade" } _infantilPreUpgradeActions() { echo "Infantil Upgrade" } _desktopPreUpgradeActions() { echo "Desktop Upgrade" } _xDesktopPreUpgradeActions() { echo "XDesktop Upgrade" } _biblioPreUpgradeActions() { echo "Biblioteca Upgrade" } _clientPreUpgradeActions() { echo "Client Upgrade" } _teachersPreUpgradeActions() { echo "Teachers Upgrade" } _pimePreUpgradeActions() { echo "Pime Upgrade" } # Post Upgrade Actions _serverCddVersionFixer() { echo "$SERVER_ATENTION_MESSAGE" # Install some packages. echo "$SERVER_INSTALL_PACKAGES_MESSAGE" apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_SERVER" } _musicaCddVersionFixer() { echo "Musica Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_MUSIC" } _infantilCddVersionFixer() { echo "Infantil Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_INFANTIL" } _desktopCddVersionFixer() { echo "Desktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_DESKTOP" } _xDesktopCddVersionFixer() { echo "Xdesktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_XDESKTOP" } _biblioCddVersionFixer() { echo "Biblioteca Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_BIBLIOTECA" } _clientCddVersionFixer() { echo "Client" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_CLIENT" } _teachersCddVersionFixer() { echo "Teachers Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_TEACHERS" } _liteCddVersionFixer(){ echo "Lite Upgrade" # install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_LITE" } _gvaCddVersionFixer() { echo "GVA Upgrade" # install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_GVA" } _pimeCddVersionFixer() { echo "Pime Upgrade" # install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_PIME" } _info() { echo "$INFO_MESSAGE" } _migrate() { _discoverCddVersion if [ $IS_SERVER -eq 0 ] ; then _serverCddVersionFixer elif [ $IS_CLIENT -eq 0 ] ; then _clientCddVersionFixer elif [ $IS_BIBLIO -eq 0 ] ; then _biblioCddVersionFixer elif [ $IS_INFANTIL -eq 0 ] ; then _infantilCddVersionFixer elif [ $IS_DESKTOP -eq 0 ] ; then _desktopCddVersionFixer elif [ $IS_XDESKTOP -eq 0 ] ; then _xDesktopCddVersionFixer elif [ $IS_MUSIC -eq 0 ] ; then _musicaCddVersionFixer elif [ $IS_TEACHERS -eq 0 ] ; then _teachersCddVersionFixer elif [ $IS_GVA -eq 0 ] ; then _gvaCddVersionFixer elif [ $IS_LITE -eq 0 ] ; then _liteCddVersionFixer elif [ $IS_PIME -eq 0 ] ; then _pimeCddVersionFixer else _desktopCddVersionFixer fi _commonPostUpgradeActions apt-get -f install } _usage() { echo "# Unknown argument" } _die() { echo "Error: $1" exit 1 } ACTION="$1" case "$ACTION" in migrate) _migrate ;; info) _info ;; *) _usage ;; esac exit 0