lenny2squeeze.sh
· 4.8 KiB · Bash
Originalformat
Please also refer to http://www.debian.org/releases/lenny/releasenotes and use your brain! If you can’t figure out what one of the commands below does, this is not for you. Expert mode only :)
# http://www.debian.org/releases/squeeze/i386/release-notes/ch-upgrading.de.html#purge-splashy
aptitude purge splashy
# change distro
sed -i s/lenny-restricted/restricted/g /etc/apt/sources.list
sed -i s/lenny/squeeze/g /etc/apt/sources.list
sed -i "s/ stable/ squeeze/g" /etc/apt/sources.list
sed -i s/lenny/squeeze/g /etc/apt/preferences
sed -i /proposed-updates/d /etc/apt/sources.list
sed -i /volatile/d /etc/apt/sources.list
sed -i /etch/d /etc/apt/sources.list
sed -i s#/backports.org/debian#/ftp.de.debian.org/debian-backports#g /etc/apt/sources.list
echo -e "\n#" >> /etc/apt/sources.list && \
echo "# squeeze-updates" >> /etc/apt/sources.list && \
echo "#" >> /etc/apt/sources.list && \
echo -e "deb\thttp://debian.tmt.de/debian\tsqueeze-updates\tmain" >> \
/etc/apt/sources.list
aptitude update
# check package status
dpkg --audit
aptitude search "~ahold" | grep "^.h"
dpkg --get-selections | grep hold
# unmark packages auto
aptitude unmarkauto vim
aptitude unmarkauto $(dpkg-query -W 'linux-image-2.6.*' | cut -f1)
# have a look into required and free disk space
apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h
# record session
script -t 2>~/upgrade-squeeze.time -a ~/upgrade-squeeze.script
# update aptitude first
#aptitude install aptitude
# converting auto packages from aptitude to apt with any aptitude command
#aptitude search "?false"
# minimal system upgrade
aptitude upgrade
# disable to bind mysql to localhost (from etch -> lenny migrtation)
# echo -e "[mysqld]\nbind-address = 0.0.0.0" > /etc/mysql/conf.d/bind.cnf
# phpmyadmin
echo "create database phpmyadmin" | mysql -p
sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" /etc/phpmyadmin/config.inc.php
sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" /etc/phpmyadmin/config.inc.php
# reintroduce community
sed -i "s^#rocommunity secret 10.0.0.0/16^rocommunity public^g" /etc/snmp/snmpd.conf
sed -i s/#agentAddress/agentAddress/ /etc/snmp/snmpd.conf
sed -i "s/agentAddress udp:127/#agentAddress udp:127/" /etc/snmp/snmpd.conf
# exchange debian ntp server with german once
sed -i "s/debian\.pool\.ntp\.org/de.pool.ntp.org/g" /etc/ntp.conf
# fix pam
sed -i "s/# auth required pam_wheel.so/auth required pam_wheel.so/" /etc/pam.d/su
# maybe we want to change some shorewall config stuff again
sed -i s/DISABLE_IPV6=Yes/DISABLE_IPV6=No/ /etc/shorewall/shorewall.conf
sed -i s/^startup=0/startup=1/ /etc/default/shorewall
# reenable mailnotification of smartmond
sed -i "s/m root -M exec/I 194 -I 231 -I 9 -m foo@bar.org -M exec/" /etc/smartd.conf
# for 3ware you may instead need
echo "/dev/twa0 -d 3ware,0 -a -s (L/../../7/02|S/../.././02) -I 194 -I 231 -I 9 -m foo@bar.org -M exec /usr/share/smartmontools/smartd-runner" >> /etc/smartd.conf
echo "/dev/twa0 -d 3ware,1 -a -s (L/../../7/03|S/../.././03) -I 194 -I 231 -I 9 -m foo@bar.org -M exec /usr/share/smartmontools/smartd-runner" >> /etc/smartd.conf
# disable php expose
echo "expose_php = Off" > /etc/php5/apache2/conf.d/expose.ini
# fix proftpd
sed -i s/DisplayFirstChdir/DisplayChdir/g /etc/proftpd/proftpd.conf
sed -i s/SQLHomedirOnDemand/CreateHome/g /etc/proftpd/proftpd.conf
/etc/init.d/proftpd restart
# install kernel image
aptitude install linux-image-2.6-flavor
# install udev
aptitude install udev
# dist-upgrade
aptitude dist-upgrade
# install rsyslog in favor of sysklogd
aptitude install rsyslog
# remove old lenny packages left around (keep eyes open!)
aptitude search ?obsolete
dpkg -l | grep etch | grep -v xen | awk '{print $2}' | xargs aptitude -y purge
dpkg -l | grep lenny | grep -v xen | grep -v linux-image | awk '{print $2}' | xargs aptitude -y purge
aptitude -y install deborphan && deborphan | grep -v xen | grep -v libpam-cracklib | xargs aptitude -y purge
dpkg -l | grep ^r | awk '{print $2}' | xargs aptitude -y purge
# Maybe switch to dependency based boot system?
aptitude purge libdevmapper1.02
dpkg-reconfigure sysv-rc
# migrate xen console see http://wiki.dunharg.cyconet.org/Documentation/Sniplets/Migration_from_Lenny_to_Squeeze/Enable_%2f%2fdev%2f%2fhvc_in_domU
sed -i s/XENDOMAINS_RESTORE=true/XENDOMAINS_RESTORE=false/ /etc/default/xendomains
sed -i s#XENDOMAINS_SAVE=/var/lib/xen/save#XENDOMAINS_SAVE=\"\"# /etc/default/xendomains
# wenn webalizer installiert
dpkg -l | grep webalizer && aptitude install geoip-database
# Maybe fix Vhosts
sed -i "s#/var/log/apache2#\$\{APACHE_LOG_DIR\}#g" /etc/apache2/sites-available/default
sed -i 's/ErrorLog "|/ErrorLog "||/' /etc/apache2/sites-available/*
# remove ipv6 workaround
sed -i "/up.*modprobe.* ipv6/d" /etc/network/interfaces
# Upgrade to Grub2?
upgrade-from-grub-legacy
| 1 | Please also refer to http://www.debian.org/releases/lenny/releasenotes and use your brain! If you can’t figure out what one of the commands below does, this is not for you. Expert mode only :) |
| 2 | |
| 3 | # http://www.debian.org/releases/squeeze/i386/release-notes/ch-upgrading.de.html#purge-splashy |
| 4 | aptitude purge splashy |
| 5 | |
| 6 | # change distro |
| 7 | sed -i s/lenny-restricted/restricted/g /etc/apt/sources.list |
| 8 | sed -i s/lenny/squeeze/g /etc/apt/sources.list |
| 9 | sed -i "s/ stable/ squeeze/g" /etc/apt/sources.list |
| 10 | sed -i s/lenny/squeeze/g /etc/apt/preferences |
| 11 | sed -i /proposed-updates/d /etc/apt/sources.list |
| 12 | sed -i /volatile/d /etc/apt/sources.list |
| 13 | sed -i /etch/d /etc/apt/sources.list |
| 14 | sed -i s#/backports.org/debian#/ftp.de.debian.org/debian-backports#g /etc/apt/sources.list |
| 15 | echo -e "\n#" >> /etc/apt/sources.list && \ |
| 16 | echo "# squeeze-updates" >> /etc/apt/sources.list && \ |
| 17 | echo "#" >> /etc/apt/sources.list && \ |
| 18 | echo -e "deb\thttp://debian.tmt.de/debian\tsqueeze-updates\tmain" >> \ |
| 19 | /etc/apt/sources.list |
| 20 | aptitude update |
| 21 | |
| 22 | # check package status |
| 23 | dpkg --audit |
| 24 | aptitude search "~ahold" | grep "^.h" |
| 25 | dpkg --get-selections | grep hold |
| 26 | |
| 27 | # unmark packages auto |
| 28 | aptitude unmarkauto vim |
| 29 | aptitude unmarkauto $(dpkg-query -W 'linux-image-2.6.*' | cut -f1) |
| 30 | |
| 31 | # have a look into required and free disk space |
| 32 | apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h |
| 33 | |
| 34 | # record session |
| 35 | script -t 2>~/upgrade-squeeze.time -a ~/upgrade-squeeze.script |
| 36 | |
| 37 | # update aptitude first |
| 38 | #aptitude install aptitude |
| 39 | |
| 40 | # converting auto packages from aptitude to apt with any aptitude command |
| 41 | #aptitude search "?false" |
| 42 | |
| 43 | # minimal system upgrade |
| 44 | aptitude upgrade |
| 45 | |
| 46 | |
| 47 | |
| 48 | # disable to bind mysql to localhost (from etch -> lenny migrtation) |
| 49 | # echo -e "[mysqld]\nbind-address = 0.0.0.0" > /etc/mysql/conf.d/bind.cnf |
| 50 | |
| 51 | # phpmyadmin |
| 52 | echo "create database phpmyadmin" | mysql -p |
| 53 | sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" /etc/phpmyadmin/config.inc.php |
| 54 | sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" /etc/phpmyadmin/config.inc.php |
| 55 | |
| 56 | |
| 57 | |
| 58 | # reintroduce community |
| 59 | |
| 60 | sed -i "s^#rocommunity secret 10.0.0.0/16^rocommunity public^g" /etc/snmp/snmpd.conf |
| 61 | sed -i s/#agentAddress/agentAddress/ /etc/snmp/snmpd.conf |
| 62 | sed -i "s/agentAddress udp:127/#agentAddress udp:127/" /etc/snmp/snmpd.conf |
| 63 | |
| 64 | |
| 65 | |
| 66 | # exchange debian ntp server with german once |
| 67 | sed -i "s/debian\.pool\.ntp\.org/de.pool.ntp.org/g" /etc/ntp.conf |
| 68 | |
| 69 | # fix pam |
| 70 | sed -i "s/# auth required pam_wheel.so/auth required pam_wheel.so/" /etc/pam.d/su |
| 71 | |
| 72 | # maybe we want to change some shorewall config stuff again |
| 73 | sed -i s/DISABLE_IPV6=Yes/DISABLE_IPV6=No/ /etc/shorewall/shorewall.conf |
| 74 | sed -i s/^startup=0/startup=1/ /etc/default/shorewall |
| 75 | |
| 76 | |
| 77 | |
| 78 | # reenable mailnotification of smartmond |
| 79 | sed -i "s/m root -M exec/I 194 -I 231 -I 9 -m foo@bar.org -M exec/" /etc/smartd.conf |
| 80 | # for 3ware you may instead need |
| 81 | echo "/dev/twa0 -d 3ware,0 -a -s (L/../../7/02|S/../.././02) -I 194 -I 231 -I 9 -m foo@bar.org -M exec /usr/share/smartmontools/smartd-runner" >> /etc/smartd.conf |
| 82 | echo "/dev/twa0 -d 3ware,1 -a -s (L/../../7/03|S/../.././03) -I 194 -I 231 -I 9 -m foo@bar.org -M exec /usr/share/smartmontools/smartd-runner" >> /etc/smartd.conf |
| 83 | |
| 84 | |
| 85 | |
| 86 | # disable php expose |
| 87 | echo "expose_php = Off" > /etc/php5/apache2/conf.d/expose.ini |
| 88 | |
| 89 | # fix proftpd |
| 90 | |
| 91 | sed -i s/DisplayFirstChdir/DisplayChdir/g /etc/proftpd/proftpd.conf |
| 92 | sed -i s/SQLHomedirOnDemand/CreateHome/g /etc/proftpd/proftpd.conf |
| 93 | /etc/init.d/proftpd restart |
| 94 | |
| 95 | # install kernel image |
| 96 | aptitude install linux-image-2.6-flavor |
| 97 | # install udev |
| 98 | aptitude install udev |
| 99 | |
| 100 | |
| 101 | |
| 102 | # dist-upgrade |
| 103 | aptitude dist-upgrade |
| 104 | |
| 105 | |
| 106 | |
| 107 | # install rsyslog in favor of sysklogd |
| 108 | |
| 109 | aptitude install rsyslog |
| 110 | |
| 111 | |
| 112 | # remove old lenny packages left around (keep eyes open!) |
| 113 | aptitude search ?obsolete |
| 114 | dpkg -l | grep etch | grep -v xen | awk '{print $2}' | xargs aptitude -y purge |
| 115 | dpkg -l | grep lenny | grep -v xen | grep -v linux-image | awk '{print $2}' | xargs aptitude -y purge |
| 116 | aptitude -y install deborphan && deborphan | grep -v xen | grep -v libpam-cracklib | xargs aptitude -y purge |
| 117 | dpkg -l | grep ^r | awk '{print $2}' | xargs aptitude -y purge |
| 118 | |
| 119 | # Maybe switch to dependency based boot system? |
| 120 | aptitude purge libdevmapper1.02 |
| 121 | dpkg-reconfigure sysv-rc |
| 122 | |
| 123 | # migrate xen console see http://wiki.dunharg.cyconet.org/Documentation/Sniplets/Migration_from_Lenny_to_Squeeze/Enable_%2f%2fdev%2f%2fhvc_in_domU |
| 124 | sed -i s/XENDOMAINS_RESTORE=true/XENDOMAINS_RESTORE=false/ /etc/default/xendomains |
| 125 | sed -i s#XENDOMAINS_SAVE=/var/lib/xen/save#XENDOMAINS_SAVE=\"\"# /etc/default/xendomains |
| 126 | |
| 127 | |
| 128 | # wenn webalizer installiert |
| 129 | dpkg -l | grep webalizer && aptitude install geoip-database |
| 130 | |
| 131 | # Maybe fix Vhosts |
| 132 | sed -i "s#/var/log/apache2#\$\{APACHE_LOG_DIR\}#g" /etc/apache2/sites-available/default |
| 133 | sed -i 's/ErrorLog "|/ErrorLog "||/' /etc/apache2/sites-available/* |
| 134 | |
| 135 | # remove ipv6 workaround |
| 136 | sed -i "/up.*modprobe.* ipv6/d" /etc/network/interfaces |
| 137 | |
| 138 | |
| 139 | # Upgrade to Grub2? |
| 140 | upgrade-from-grub-legacy |
| 141 |