#!/bin/bash # openmamba dist-upgrade script # Copyright (c) 2016 by Silvan Calarco echo "openmamba dist-upgrade script" echo "Copyright (c) 2016 by Silvan Calarco " echo [ $UID -eq 0 ] || { echo "ERROR: this script must be run as root user; aborting." exit 1 } RELEASE=$1 ARCH=`uname -m` if [ "$ARCH" == "i686" ]; then RPMARCH="i586" COMPONENTS="$RPMARCH" elif [ "$ARCH" == "x86_64" ]; then RPMARCH="$ARCH" COMPONENTS="$RPMARCH i586" else RPMARCH="$ARCH" COMPONENTS="$RPMARCH" fi [ "$RELEASE" == "rolling" -o "$RELEASE" == "milestone4" ] || { echo "Usage:" echo "openmamba-dist-upgrade [rolling|milestone4|reset]" exit 1 } . /etc/os-release if [ "$OPENMAMBA_MILESTONE" != "milestone3" ]; then echo "ERROR: this script only applies to openmamba milestone3 release; aborting." exit 1 fi SMART_FILE_MILESTONE=/etc/smart/distro.d/10-openmamba-milestone4-repositories.py SMART_FILE_ROLLING=/etc/smart/distro.d/90-openmamba-devel-repositories.py if [ "$RELEASE" == "milestone4" ]; then SMART_FILE="$SMART_FILE_MILESTONE" REPOSITORY="milestone4" rm -f $SMART_FILE_ROLLING else SMART_FILE="$SMART_FILE_ROLLING" REPOSITORY="devel" rm -f $SMART_FILE_MILESTONE fi echo -n " System will be upgraded to openmamba milestone4 HINTS: - this operation can't be reversed - it is always a good practice to have a backup of, at least, personal important data - broadband connection needed, possibly connect your computer to cable network - prepare to wait, upgrade may take up to some hours depending on the speed of your computer and network - if this is a laptop plug it to AC power - in case of problems you may find help on the forums at openmamba.org web site Proceed with upgrade [y/N]?" read ans [ "$ans" = "y" ] || exit 0 echo "Upgrading current openmamba release..." #smart update || exit 1 #smart upgrade -y || exit 1 echo "Configuring for release $RELEASE..." if [ "$RELEASE" == "milestone4" ]; then cat > $SMART_FILE << _EOF # # openmamba milestone4 channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4")): sysconf.set(("channels", "milestone4"), {"alias": "milestone4", "type": "apt-rpm", "name": "stable milestone4 base packages", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4", "components": "${COMPONENTS}"}) # # openmamba milestone4-games channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-games")): sysconf.set(("channels", "milestone4-games"), {"alias": "milestone4-games", "type": "apt-rpm", "name": "stable milestone4 games packages", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-games", "components": "${COMPONENTS}"}) # # openmamba milestone4-updates channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-updates")): sysconf.set(("channels", "milestone4-updates"), {"alias": "milestone4-updates", "type": "apt-rpm", "name": "stable milestone4 updates packages", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-updates", "components": "${COMPONENTS}"}) # # openmamba milestone4-kernel channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-kernel")): sysconf.set(("channels", "milestone4-kernel"), {"alias": "milestone4-kernel", "type": "apt-rpm", "name": "newest kernel release for milestone4 stable systems", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-kernel", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba milestone4-kernel-next channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-kernel-next")): sysconf.set(("channels", "milestone4-kernel-next"), {"alias": "milestone4-kernel-next", "type": "apt-rpm", "name": "experimental kernel release for milestone4 stable systems", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-kernel-next", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba milestone4-kde4 channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-kde4")): sysconf.set(("channels", "milestone4-kde4"), {"alias": "milestone4-kde4", "type": "apt-rpm", "name": "newest kde4 release for milestone4 stable systems", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-kde4", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba milestone4-xorg channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-xorg")): sysconf.set(("channels", "milestone4-xorg"), {"alias": "milestone4-xorg", "type": "apt-rpm", "name": "newest X.org release for milestone4 stable systems", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-xorg", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba milestone4-makedist channel configuration for Smart Package Manager # if not sysconf.get(("channels", "milestone4-makedist")): sysconf.set(("channels", "milestone4-makedist"), {"alias": "milestone4-makedist", "type": "apt-rpm", "name": "experimental milestone4 makedist packages", "baseurl": "http://cdn.openmamba.org/pub/openmamba/milestone4-makedist", "components": "${COMPONENTS}", "disabled": "yes"}) import os import sys release=os.popen("openmamba-release -c").read() for r in ["milestone4","milestone4-updates","milestone4-games","milestone4-makedist","milestone4-kernel",\ "milestone4-kde4","milestone4-xorg","milestone4-kernel-next"]: channel=sysconf.get(("channels", r)) if channel: if channel['baseurl'].startswith('http://www.openmamba.org/'): channel['baseurl'] = \ channel['baseurl'].replace('http://www.openmamba.org/','http://cdn.openmamba.org/') channel['fingerprint']='A402 AA41 82DE 06DD 0C82 943A B771 C004 8746 8781' sysconf.set(("channels",r),channel) for r in ["milestone4","milestone4-updates","milestone4-games"]: channel=sysconf.get(("channels", r)) if channel: channel['disabled']=False sysconf.set(("channels",r),channel) for r in [ "milestone3", "milestone3-games", "milestone3-updates", "milestone3-makedist", "milestone3-kernel", "devel", "devel-games" ]: channel=sysconf.get(("channels", r)) if channel: channel['disabled']=True sysconf.set(("channels",r),channel) _EOF else cat > $SMART_FILE << _EOF # # openmamba devel channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel")): sysconf.set(("channels", "devel"), {"alias": "devel", "type": "apt-rpm", "name": "base repository [rolling]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel", "components": "${COMPONENTS}"}) # # openmamba devel-games channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-games")): sysconf.set(("channels", "devel-games"), {"alias": "devel-games", "type": "apt-rpm", "name": "branch of base repository containing big games [rolling]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-games", "components": "${COMPONENTS}"}) # # openmamba devel-kde4 channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-kde4")): sysconf.set(("channels", "devel-kde4"), {"alias": "devel-kde4", "type": "apt-rpm", "name": "latest kde4 release [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-kde4", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-kernel channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-kernel")): sysconf.set(("channels", "devel-kernel"), {"alias": "devel-kernel", "type": "apt-rpm", "name": "latest kernel release [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-kernel", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-xorg channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-xorg")): sysconf.set(("channels", "devel-xorg"), {"alias": "devel-xorg", "type": "apt-rpm", "name": "latest xorg release [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-xorg", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-gnome channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-gnome")): sysconf.set(("channels", "devel-gnome"), {"alias": "devel-gnome", "type": "apt-rpm", "name": "latest Gnome release [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-gnome", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-misc channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-misc")): sysconf.set(("channels", "devel-misc"), {"alias": "devel-misc", "type": "apt-rpm", "name": "latest miscellaneous releases [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-misc", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-makedist channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-makedist")): sysconf.set(("channels", "devel-makedist"), {"alias": "devel-makedist", "type": "apt-rpm", "name": "auxiliary repository for makedist (livecd, flash 1GB) [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-makedist", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-embedded channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-embedded")): sysconf.set(("channels", "devel-embedded"), {"alias": "devel-embedded", "type": "apt-rpm", "name": "auxiliary repository for embedded systems [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-embedded", "components": "${COMPONENTS}", "manual": "yes", "disabled": "yes"}) # # openmamba devel-autodist channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-autodist")): sysconf.set(("channels", "devel-autodist"), {"alias": "devel-autodist", "type": "apt-rpm", "name": "auxiliary repository for autodist (automatic builds) [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-autodist", "components": "${COMPONENTS}", "manual": "yes", "disabled": "yes"}) # # openmamba devel-future channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-future")): sysconf.set(("channels", "devel-future"), {"alias": "devel-future", "type": "apt-rpm", "name": "auxiliary repository for not yet integrated new releases [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-future", "components": "${COMPONENTS}", "manual": "yes", "disabled": "yes"}) # # openmamba devel-past channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-past")): sysconf.set(("channels", "devel-past"), {"alias": "devel-past", "type": "apt-rpm", "name": "archive repository for obsoleted and removed packages [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-past", "components": "${COMPONENTS}", "manual": "yes", "disabled": "yes"}) # # openmamba devel-java channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-java")): sysconf.set(("channels", "devel-java"), {"alias": "devel-java", "type": "apt-rpm", "name": "contributed java packages [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-java", "components": "${COMPONENTS}", "disabled": "yes"}) # # openmamba devel-contrib channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-contrib")): sysconf.set(("channels", "devel-contrib"), {"alias": "devel-contrib", "type": "apt-rpm", "name": "auxiliary repository for contributors [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-contrib", "components": "${COMPONENTS}", "manual": "yes", "disabled": "yes"}) # # openmamba devel-kernel-past channel configuration for Smart Package Manager # if not sysconf.get(("channels", "devel-kernel-past")): sysconf.set(("channels", "devel-kernel-past"), {"alias": "devel-kernel-past", "type": "apt-rpm", "name": "previous kernel release [unstable]", "baseurl": "http://cdn.openmamba.org/pub/openmamba/devel-kernel-past", "components": "${COMPONENTS}", "disabled": "yes"}) import os import sys release=os.popen("openmamba-release -c").read() #if release.startswith('devel'): for r in ["devel","devel-games","devel-kde4","devel-kernel","devel-xorg","devel-makedist","devel-gnome",\ "devel-misc","devel-java","devel-embedded","devel-autodist","devel-future","devel-past", "devel-contrib","devel-kernel-past"]: channel=sysconf.get(("channels", r)) if channel: if channel['baseurl'].startswith('http://www.openmamba.org/'): channel['baseurl'] = \ channel['baseurl'].replace('http://www.openmamba.org/','http://cdn.openmamba.org/') channel['fingerprint']='A402 AA41 82DE 06DD 0C82 943A B771 C004 8746 8781' sysconf.set(("channels",r),channel) for r in ["devel","devel-games"]: channel=sysconf.get(("channels", r)) if channel: channel['disabled']=False sysconf.set(("channels",r),channel) for r in ["devel-embedded","devel-autodist","devel-future","devel-past","devel-contrib"]: channel=sysconf.get(("channels", r)) if channel: channel['manual']=True sysconf.set(("channels",r),channel) for r in ["milestone2","milestone2-games","milestone2-updates","milestone2-makedist",\ "milestone3","milestone3-games","milestone3-updates","milestone3-makedist", "milestone4","milestone4-games","milestone4-updates","milestone4-makedist"]: channel=sysconf.get(("channels", r)) if channel: channel['disabled']=True sysconf.set(("channels",r),channel) _EOF fi echo "Preparing for upgrade..." rm -f /var/lib/smart/cache rm -f /var/lib/smart/channels/* smart update || exit 1 smart install smart || exit 1 #smart install -y smart || exit 1 echo "First upgrade stage..." if [ "$RPMARCH" == "x86_64" ]; then smart install -y libreadline libreadline@i586 libreadline6 libreadline6@i586 smart install -y libncurses libncurses@i586 libncurses5 libncurses5@i586 smart install -y libnettle libnettle@i586 libnettle4 libnettle4@i586 smart install -y libgnutls libgnutls@i586 libgnutls28 libgnutls28@i586 else smart install -y libreadline libreadline6 smart install -y libncurses libncurses5 smart install -y libnettle libnettle4 smart install -y libgnutls libgnutls28 fi smart install -y libtirpc libtirpc1 if [ "$RPMARCH" == "x86_64" ]; then smart install -y glibc glibc-multilib else smart install -y glibc fi smart install -y openmamba-install-scripts #smart install -y wxWidgets-i18n QTVER=`curl -s http://cdn.openmamba.org/pub/openmamba/${REPOSITORY}/SRPMS.base/|grep libqt5|sed "s|.*libqt5-\(.*\)\.src.rpm.*|\1|"` curl http://cdn.openmamba.org/pub/openmamba/${REPOSITORY}/RPMS.${RPMARCH}/libqt5-common-${QTVER}.${RPMARCH}.rpm \ -o /tmp/libqt5-common-${QTVER}.${RPMARCH}.rpm rpm -U /tmp/libqt5-common-${QTVER}.${RPMARCH}.rpm --nodeps --force echo "Second upgrade stage, this may take a long time!" smart upgrade -y || exit 1 echo "DONE! You may now REBOOT the system into openmamba ${RELEASE}." #sleep 10 #reboot