openmamba-dist-upgrade: added script for distribution upgrade from milestone3 to milestone4 or rolling

This commit is contained in:
Silvan Calarco 2016-12-18 15:36:11 +01:00
parent 742f98e95e
commit b8c23c2673
2 changed files with 422 additions and 0 deletions

View File

@ -236,6 +236,7 @@ install-desktop:
install-openmamba-update:
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_SCRIPT) openmamba-update/openmamba-update $(DESTDIR)$(bindir)
$(INSTALL_SCRIPT) openmamba-update/openmamba-dist-upgrade $(DESTDIR)$(sbindir)
$(INSTALL_SCRIPT) openmamba-update/openmamba-netsrpms $(DESTDIR)$(bindir)
install: $(pck_infiles:.in=) \

View File

@ -0,0 +1,421 @@
#!/bin/bash
# openmamba dist-upgrade script
# Copyright (c) 2016 by Silvan Calarco <silvan.calarco@mambasoft.it>
echo "openmamba dist-upgrade script"
echo "Copyright (c) 2016 by Silvan Calarco <silvan.calarco@mambasoft.it>"
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"
rm -f $SMART_FILE_ROLLING
else
SMART_FILE="$SMART_FILE_ROLLING"
rm -f $SMART_FILE_MILESTONE
fi
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
rm -f /var/lib/smart/cache
rm -f /var/lib/smart/channels/*
#smart install http://cdn.openmamba.org/pub/openmamba/milestone4/RPMS.${RPMARCH}/smart-1.5-9mamba.${RPMARCH}.rpm
smart update || exit 1
smart install smart || exit 1
#smart install -y smart || exit 1
#smart install -y glibc libreadline libreadline6 libncurses libncurses5 libtirpc libtirpc1 \
# libnettle libnettle4 libgnutls libgnutls28
echo "Upgrading, this may take a long time!"
smart upgrade -y || exit 1
echo "DONE! Please reboot now."