#/bin/sh -e

echo
echo "=== This is reference only.  Read the release file and follow it. ==="
echo
exit 1
# The folowing worked for woody when it was testing
echo
echo "=== make sure to select http mode or ftp mode ==="
echo
# zap old sources.list
cd /etc/apt
cp -f sources.list sources.old
:>sources.list  
# apt-setup in testing requires to be run from /
cd /
sleep 1
apt-setup noprobe 
# ... select http or ftp
cd /etc/apt
# create template
grep -e "^deb " sources.list             >sources.deb
grep -e "^deb-" sources.list             >sources.src
# create new sources.list (Keep stable source list as comment)
sed -e "s/^d/#d/" /usr/share/doc/apt/examples/sources.list >sources.list
sed -e "s/stable/testing/"  sources.deb >>sources.list
# update/upgrade to testing (just the core only.)
apt-get update
apt-get install libc6 perl libdb2 debconf 
apt-get install apt apt-utils dpkg dselect
# create typical preferences to track testing
cat >preferences <<EOF
Package: *
Pin: release a=testing
Pin-Priority: 600

Package: *
Pin: release a=unstable
Pin-Priority: 50

EOF
sed -e "s/stable/unstable/" sources.deb >>sources.list
sed -e "s/stable/unstable/" sources.src | \
sed -e "s/^deb-/#deb-/"                 >>sources.list
# rm -f sources.deb sources.src
echo
echo "A guideline for /etc/apt/preferences"
echo
echo " track stable:            change  Pin-Priority of testing  to  50"
echo " track testing:           keep as is"
echo " track testing(unstable): change  Pin-Priority of unstable to 500"
echo " track unstable(testing): change  Pin-Priority of unstable to 800"
echo
echo "Run apt-get update && apt-get dist-upgrade"

# upgrade rest of the system.  In case of crash, try again :)
#apt-get update
#apt-get dist-upgrade
dselect update && dselect select
echo -n "Are you OK, then press RETURN.  Otherwise, press Ctrl-C"
read
dselect install