Commit d3180ec7 authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

Refactor test install script to be DRYer

parent c98797a3
......@@ -24,49 +24,38 @@ APT_LIST=/etc/apt/sources.list.d/symbiosis.list
# upgrade - upgrade to latest from a symbiosis-stretch base
# dist-upgrade - upgrade to latest from symbiosis-jessie
if [ "upgrade" = "$ACTION" ] ; then
do_upgrade() {
echo "I: seed debconf"
debconf-set-selections < "$CONF/debconf-preseed"
debconf-set-selections < "$1/debconf-preseed"
echo "I: Install current symbiosis.bytemark.co.uk release"
echo "deb http://symbiosis.bytemark.co.uk/$DEBIAN_RELEASE/ ./" > $APT_LIST
echo "I: perform update"
apt-get $APT_OPTS update
apt-get $APT_OPTS install $(< $CONF/packages)
echo "I: Re-seed debconf"
debconf-set-selections < "$CONF/debconf-preseed"
echo "I: perform $2"
if [ "$2" = "install" ] ; then
apt-get $APT_OPTS install $(< $1/packages)
else
apt-get $APT_OPTS $2
fi
}
echo "I: Add new version's sources"
cp $CONF/sources.list $APT_LIST
echo "deb http://repo.bytemark.co.uk/open-source/symbiosis/$BRANCH_NAME/latest/ ./" >> $APT_LIST
apt-get $APT_OPTS upgrade
if [ "upgrade" = "$ACTION" ] ; then
echo "I: Install current symbiosis.bytemark.co.uk release"
echo "deb http://symbiosis.bytemark.co.uk/$DEBIAN_RELEASE/ ./" > $APT_LIST
elif [ "dist-upgrade" = "$ACTION" ] ; then
echo "I: seed debconf with $OLD_DEBIAN_RELEASE config"
debconf-set-selections < "$OLD_CONF/debconf-preseed"
do_upgrade $CONF install
elif [ "dist-upgrade" = "$ACTION" ] ; then
echo "I: Install $OLD_DEBIAN_RELEASE version of Symbiosis from symbiosis.bytemark.co.uk"
echo "deb http://symbiosis.bytemark.co.uk/$OLD_DEBIAN_RELEASE/ ./" > $APT_LIST
apt-get $APT_OPTS update
apt-get $APT_OPTS install $(< $OLD_CONF/packages)
echo "I: Re-seed debconf with $DEBIAN_RELEASE config"
debconf-set-selections < "$CONF/debconf-preseed"
do_upgrade $OLD_CONF install
echo "I: Add new version's sources"
cp $CONF/sources.list $APT_LIST
echo "deb http://repo.bytemark.co.uk/open-source/symbiosis/$BRANCH_NAME/latest/ ./" >> $APT_LIST
sed -e "s/$OLD_DEBIAN_RELEASE/$DEBIAN_RELEASE/g" -i /etc/apt/sources.list
cat /etc/apt/sources.list $APT_LIST
echo "I: Perform dist-upgrade"
apt-get $APT_OPTS update
apt-get $APT_OPTS dist-upgrade
else
echo "I: Install latest version of Symbiosis from repo.bytemark.co.uk"
cp $CONF/sources.list $APT_LIST
echo "deb http://repo.bytemark.co.uk/open-source/symbiosis/$BRANCH_NAME/latest/ ./" >> $APT_LIST
apt-get $APT_OPTS update
apt-get $APT_OPTS install $(< $CONF/packages)
fi
echo "I: $ACTION $BRANCH_NAME version of Symbiosis from repo.bytemark.co.uk"
cp $CONF/sources.list $APT_LIST
echo "deb http://repo.bytemark.co.uk/open-source/symbiosis/$BRANCH_NAME/latest/ ./" >> $APT_LIST
do_upgrade $CONF $ACTION
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment