Skip to content

Instantly share code, notes, and snippets.

@alexhayes
Forked from simonexmachina/building-install.sh
Created June 5, 2012 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexhayes/2873159 to your computer and use it in GitHub Desktop.
Save alexhayes/2873159 to your computer and use it in GitHub Desktop.
Switch apt source to next distro - basically so we can get a working php4-domxml installed
#!/bin/bash
V30=`grep "3.0" /etc/issue`
V31=`grep "3.1" /etc/issue`
V4=`grep "4." /etc/issue`
V5=`grep "5." /etc/issue`
V6=`grep "6." /etc/issue`
UPDATE_SOURCES=1
if [ "$V30" != "" ]; then
VERSION='woody'
ALT='sarge'
elif [ "$V31" != "" ]; then
VERSION='sarge'
ALT='etch'
elif [ "$V4" != "" ]; then
VERSION='etch'
ALT='lenny'
elif [ "$V5" != "" ]; then
VERSION='lenny'
ALT='squeeze'
else
echo "Refusing to switch apt-source - can't determine distribution"
cat /etc/issue
exit 1
fi
VERSIONDEF="deb http://ftp.iinet.net.au/debian/debian-archive/debian/ $VERSION main contrib non-free"
ALTDEF="deb http://ftp.iinet.net.au/debian/debian-archive/debian/ $ALT main contrib non-free"
if [ "$1" == "rollback" ]; then
sed -e "s/^deb/#ALT deb/g" -e "s/^#DEFAULT deb/deb/g" --in-place /etc/apt/sources.list && \
apt-get update
elif [ "$1" == "forward" ]; then
sed -e "s/^deb/#DEFAULT deb/" -e "s/#ALT deb/deb/g" --in-place /etc/apt/sources.list && \
apt-get update
else
sed -e "s/^deb/#DEFAULT deb/" --in-place /etc/apt/sources.list && \
echo $ALTDEF >> /etc/apt/sources.list &&
apt-get update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment