#!/bin/sh
# Script to upgrade from Slackware 11.0 to Slackware 12.0
# This script is written following instructions in
#   http://mirrors.unixsol.org/slackware/slackware-12.0/CHANGES_AND_HINTS.TXT
#
# Use at your own risk (of course)
#
# This script is for servers (no X tricks are added)
# If you want to update your descktop PC with Slack 12 use:
#   http://georgi.unixsol.org/programs/slackware/slack11-to-slack12-desktop.sh
#
# Written by Georgi Chorbadzhiyski (georgi@unixsol.org)
# License: Public domain
#

# Download slackware
mkdir slack-12.0 2>/dev/null
cd slack-12.0
rsync --exclude 't/*' --exclude 'tcl/*' --exclude 'e/*' --exclude 'kde/*' --exclude 'kdei/*' --exclude 'x/*' --exclude 'xap/*' -av --progress mirrors.unixsol.org::slackware/slackware-12.0/slackware/. .

# First update basic stuff
(
	cd a
	upgradepkg glibc-solibs-*.tgz
	upgradepkg glibc-zoneinfo-*.tgz
	upgradepkg pkgtools-*.tgz
)

# First remove old X packages, because they'll interfere with modular X instalation
# This must be done *BEFORE* aaa_base update
(
	cd /var/log/packages
	removepkg x11-* fontconfig* dejavu-ttf* ttf-indic-fonts*
)

(
	cd a
	upgradepkg aaa_base-*.tgz
	upgradepkg aaa_elflibs-*.tgz

	# Split from pkgtools
	installpkg dialog-*.tgz
	installpkg aaa_terminfo-*.tgz
	# Split from bin
	installpkg file-*.tgz
	installpkg patch-*.tgz
	installpkg tree-*.tgz
	installpkg which-*.tgz
	# Split from sysvinit
	installpkg sysvinit-scripts-*.tgz

	upgradepkg bin-*.tgz
	upgradepkg sysvinit-*.tgz
	upgradepkg udev-*.tgz
)

# Networking tools update /packages split from ex tcpip package)
(
	cd n
	installpkg bridge-utils-*.tgz
	installpkg bsd-finger-*.tgz
	installpkg ethtool-*.tgz
	installpkg iputils-*.tgz
	installpkg mtr-*.tgz
	installpkg net-tools-*.tgz
	installpkg netkit-ftp-*.tgz
	installpkg network-scripts-*.tgz
	installpkg telnet-*.tgz
	installpkg vlan-*.tgz
	removepkg tcpip
)

(cd ap;  upgradepkg lvm%lvm2-*.tgz)
(cd d;   upgradepkg pkgconfig%pkg-config-*.tgz)

# Package removals
removepkg hotplug
removepkg pcmcia-cs
removepkg umsdos-progs
removepkg gnu-gs-fonts
removepkg byacc
removepkg alsa-driver
removepkg glut
removepkg mpeg_lib

# Upgrade everything
# On this stage you can run slackcheck or swaret or whatever you want but the easiest
# way is to run upgradepkg */*.tgz
upgradepkg */*.tgz

# Get new config files
(
	cd /etc/rc.d/
	mv rc.4.new rc.4
	mv rc.6.new rc.6
	mv rc.M.new rc.M
	mv rc.S.new rc.S
	mv rc.inet1.conf.new rc.inet1.conf
	mv rc.udev.new rc.udev
	mv rc.sshd.new rc.sshd
	mv rc.syslog.new rc.syslog
	mv rc.rpc.new rc.rpc
	mv rc.bind.new rc.bind
)

(
	cd /etc
	mv inittab.new inittab
	mv services.new services
	mv DIR_COLORS.new DIR_COLORS
	mv csh.login.new csh.login
	mv login.defs.new login.defs
	mv ntp.conf.new ntp.conf
	mv nscd.conf.new nscd.conf
	mv nsswitch.conf.new nsswitch.conf
	mv profile.new profile
	mv syslog.conf.new syslog.conf
	mv wgetrc.new wgetrc
)
