Last active 6 months ago

Revision 84b310903d12c344ea9f7998bdc4c3776f8b0799

squeeze2wheezy.sh Raw
1Please also refer to http://www.debian.org/releases/wheezy/releasenotes and use your brain!
2For Roundcube and Sqlite Backend see: http://wiki.debian.org/Roundcube/DeprecationOfSQLitev2
3
4
5# upgrade to UTF-8 locales (http://www.debian.org/releases/testing/i386/release-notes/ap-old-stuff.en.html#switch-utf8)
6dpkg-reconfigure locales
7
8# remove unused config file
9rm -rf /etc/network/options /etc/environment
10
11# change distro (please move 3rd party sources to /etc/apt/sources.list.d/)
12sed -i s/squeeze/wheezy/g /etc/apt/sources.list*
13sed -i "s/ stable/ wheezy/g" /etc/apt/sources.list*
14sed -i s/squeeze/wheezy/g /etc/apt/preferences*
15sed -i /proposed-updates/d /etc/apt/sources.list*
16sed -i /volatile/d /etc/apt/sources.list*
17sed -i /etch/d /etc/apt/sources.list*
18sed -i /lenny/d /etc/apt/sources.list*
19sed -i s#/backports.org/debian#/ftp.de.debian.org/debian#g /etc/apt/sources.list*
20sed -i s/debian-backports/debian/g /etc/apt/sources.list*
21if [ "$( dpkg -l | grep "^ii.*php5-suhosin" | wc -l)" -ge "1" ]; then \
22 wget http://ftp.cyconet.org/debian/sources.list.d/wheezy-updates-cyconet.list \
23 -O /etc/apt/sources.list.d/wheezy-updates-cyconet.list
24fi
25aptitude update
26
27# check package status
28dpkg --audit
29aptitude search "~ahold" | grep "^.h"
30dpkg --get-selections | grep hold
31
32# unmark packages auto
33aptitude unmarkauto vim
34aptitude unmarkauto $(dpkg-query -W 'linux-image-2.6.*' | cut -f1)
35
36# have a look into required and free disk space
37apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h
38
39# check if we have PAE available (http://www.debian.org/releases/testing/i386/release-notes/ch-upgrading.en.html#idp573136)
40grep -q '^flags.*\bpae\b' /proc/cpuinfo && echo "We support PAE: yes" || echo "We support PAE: no (please install linux-image-486 and remove linux-image-.*-686)"
41
42# record session
43script -t 2>~/upgrade-wheezy.time -a ~/upgrade-wheezy.script
44
45# install our preseed so libc doesn't whine
46cat > /tmp/wheezy.preseed <<EOF
47libc6 glibc/upgrade boolean true
48libc6 glibc/restart-services string
49libc6 libraries/restart-without-asking boolean true
50EOF
51/usr/bin/debconf-set-selections /tmp/wheezy.preseed
52
53# minimal system upgrade
54aptitude upgrade
55
56# randomize crontab
57sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' /etc/crontab
58sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' /etc/crontab
59
60# phpmyadmin
61sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" /etc/phpmyadmin/config.inc.php
62sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" /etc/phpmyadmin/config.inc.php
63
64# remove anonymous mysql access
65mysql -u root -p -e "DELETE FROM mysql.user WHERE User=''; DELETE FROM mysql.db WHERE Db='test' AND Host='%' OR Db='test\\_%' AND Host='%'; FLUSH PRIVILEGES;"
66
67# xen
68/bin/sed -i -e 's/^[# ]*\((dom0-min-mem\).*\().*\)$/\1 512\2/' /etc/xen/xend-config.sxp
69sed -i s/XENDOMAINS_RESTORE=true/XENDOMAINS_RESTORE=false/ /etc/default/xendomains
70sed -i s#XENDOMAINS_SAVE=/var/lib/xen/save#XENDOMAINS_SAVE=\"\"# /etc/default/xendomains
71mv /etc/grub.d/20_linux_xen /etc/grub.d/09_linux_xen
72echo 'GRUB_CMDLINE_XEN="dom0_mem=512M"' >> /etc/default/grub
73
74# maybe we want to change some shorewall config stuff again
75sed -i s/^startup=0/startup=1/ /etc/default/shorewall
76
77# dist-upgrade
78aptitude dist-upgrade
79
80# migrate expose.ini
81[ -f /etc/php5/conf.d/expose.ini ] && mv /etc/php5/conf.d/expose.ini /etc/php5/mods-available/local-expose.ini && php5enmod local-expose/90
82# migrate local suhosin config
83find /etc/php5/conf.d/ -type f -name "*suhosin.ini" -exec mv '{}' /etc/php5/mods-available/local-suhosin.ini \; && php5enmod local-suhosin/90
84
85# mysql
86
87# vsftpd and chroot_local_user?
88if [ "$(grep -i ^chroot_local_user=yes /etc/vsftpd.conf | wc -l)" -ge "1" ]; then \
89 echo "deb http://ftp.cyconet.org/debian wheezy-updates main non-free contrib" >> /etc/apt/sources.list.d/wheezy-updates-cyconet.list; \
90 aptitude update; aptitude install -t wheezy-updates vsftpd && \
91 echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf && /etc/init.d/vsftpd restart; \
92fi
93
94# remove old squeeze packages left around (keep eyes open!)
95apt-get autoremove
96aptitude search ?obsolete
97dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '{print $2}' | xargs aptitude -y purge
98dpkg -l | grep lenny | grep -v xen | awk '{print $2}' | xargs aptitude -y purge
99dpkg -l | grep squeeze | grep -v xen | grep -v linux-image | awk '{print $2}' | xargs aptitude -y purge
100aptitude -y install deborphan && deborphan | grep -v xen | grep -v libpam-cracklib | xargs aptitude -y purge
101dpkg -l | grep ^r | awk '{print $2}' | xargs aptitude -y purge