#!/bin/sh # SourcesList evolutor # 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 "Change the software origins")" BACKUP_SOURCES_LIST="$(gettext "Making a backup of sources.list file on /etc/apt/sources.list.backup-lliurex-up")" CHANGED_SOURCES_LIST_MESSAGE="$(gettext "Software origins updated")" # Methods _info() { echo "$INFO_MESSAGE" } _migrate() { # Test upgrade version if is a server vc=0 lliurex-version -n | grep -q 13.06 || vc=1 if [ $vc -eq 0 ]; then if [ -x /usr/sbin/platinum-upgrade ]; then /usr/sbin/platinum-upgrade || true fi fi # Backup sources list echo "$CHANGED_SOURCES_LIST_MESSAGE" cp -f $SOURCES_LIST_PATH $BACKUP_SOURCES_LIST_PATH # Change values sed -i "s%$OLD_GENERATION_PATTERN%$NEXT_GENERATION_PATTERN%g;s%$OLD_CODENAME%$NEXT_CODENAME%g" $SOURCES_LIST_PATH # Added source.list client rc=0 lliurex-version -t client || rc=1 if [ $rc -eq 0 ] ; then sed -i "s%$OLD_GENERATION%$NEXT_GENERATION%g;s%$OLD_CODENAME%$NEXT_CODENAME%g" $SOURCES_LIST_PATH fi #echo "# Added by LliureX UP #" >> "$SOURCES_LIST_PATH" #echo "$SOURCES_LIST_OK" >> "$SOURCES_LIST_PATH" #echo "# Added by LliureX UP #" >> "$SOURCES_LIST_PATH" [ ! -f /etc/apt/preferences.d/lsb_lliurex_pinning ] || rm -f /etc/apt/preferences.d/lsb_lliurex_pinning echo "$CHANGED_SOURCES_LIST_MESSAGE" } _usage() { echo " * [ LliureX Up ] : # Unknown argument" } _die() { echo " * [ LliureX Up ] : Error: $1" exit 1 } ACTION="$1" case "$ACTION" in migrate|partial) _migrate ;; info) _info ;; *) _usage ;; esac exit 0