#!/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() { echo " * [ LliureX Up ] : Nothing to do" } # Pre Upgrade Actions _serverPreUpgradeActions() { echo "$SERVER_ATENTION_MESSAGE" } _musicaPreUpgradeActions() { echo " * [ LliureX Up ] : Musica Upgrade" } _infantilPreUpgradeActions() { echo " * [ LliureX Up ] : Infantil Upgrade" } _desktopPreUpgradeActions() { echo " * [ LliureX Up ] : Desktop Upgrade" } _xDesktopPreUpgradeActions() { echo " * [ LliureX Up ] : XDesktop Upgrade" } _biblioPreUpgradeActions() { echo " * [ LliureX Up ] : Biblioteca Upgrade" } _clientPreUpgradeActions() { echo " * [ LliureX Up ] : Client Upgrade" } _teachersPreUpgradeActions() { echo " * [ LliureX Up ] : Teachers Upgrade" } _pimePreUpgradeActions() { echo " * [ LliureX Up ] : 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 " * [ LliureX Up ] : * Musica Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_MUSIC" } _infantilCddVersionFixer() { echo " * [ LliureX Up ] : * Infantil Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_INFANTIL" } _desktopCddVersionFixer() { echo " * [ LliureX Up ] : * Desktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_DESKTOP" } _eduDesktopCddVersionFixer() { echo " * [ LliureX Up ] : * Edu Desktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_EDUDESKTOP" } _xDesktopCddVersionFixer() { echo " * [ LliureX Up ] : * Xdesktop Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_XDESKTOP" } _biblioCddVersionFixer() { echo " * [ LliureX Up ] : * Biblioteca Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_BIBLIOTECA" } _clientCddVersionFixer() { echo " * [ LliureX Up ] : * Client" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_CLIENT" } _teachersCddVersionFixer() { echo " * [ LliureX Up ] : * Teachers Upgrade" # Install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_TEACHERS" } _liteCddVersionFixer(){ echo " * [ LliureX Up ] : * Lite Upgrade" # install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_LITE" } _gvaCddVersionFixer() { echo " * [ LliureX Up ] : * GVA Upgrade" # install some packages apt-get install -y --force-yes "$PACKAGES_INSTALL_ON_GVA" } _pimeCddVersionFixer() { echo " * [ LliureX Up ] : * 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_GVA -eq 0 ] ; then _gvaCddVersionFixer elif [ $IS_BIBLIO -eq 0 ] ; then _biblioCddVersionFixer elif [ $IS_INFANTIL -eq 0 ] ; then _infantilCddVersionFixer elif [ $IS_EDUDESKTOP -eq 0 ] ; then _eduDesktopCddVersionFixer elif [ $IS_PIME -eq 0 ] ; then _pimeCddVersionFixer 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_LITE -eq 0 ] ; then _liteCddVersionFixer else echo " * [ LliureX Up ] : * Is almost a Desktop" _desktopCddVersionFixer fi _commonPostUpgradeActions } _usage() { echo "# Unknown argument" } _die() { echo "Error: $1" exit 1 } ACTION="$1" case "$ACTION" in migrate|partial) _migrate ;; info) _info ;; *) _usage ;; esac exit 0