Last active 6 months ago

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 7 insertions

stretch2buster.sh

@@ -119,6 +119,13 @@ rename s/php70/php73/g /etc/nginx/conf.d/*php70*.conf
119 119 sed -i s/php7.0-fpm/php7.3-fpm/g /etc/nginx/conf.d/*.conf /etc/nginx/snippets/*.conf /etc/nginx/sites-available/*
120 120 systemctl restart nginx
121 121
122 + # Update old postfix configurations
123 + cp /etc/postfix/main.cf /tmp/main.cf && \
124 + if [ $(postconf -n smtpd_relay_restrictions | wc -l) -eq 0 ]; then sed -i '/^myhostname.*/i smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination' /etc/postfix/main.cf; fi && \
125 + if [ -z $(postconf -nh compatibility_level) ]; then sed -iE 's/^readme_directory = no/readme_directory = no\n\n# See http:\/\/www.postfix.org\/COMPATIBILITY_README.html -- default to 2 on\n# fresh installs.\ncompatibility_level = 2\n\n/' /etc/postfix/main.cf; fi && \
126 + diff -Nur /tmp/postfix/main.cf /etc/postfix/main.cf && \
127 + postfix reload
128 +
122 129 # transition docker-ce to buster package
123 130 DOCKER_VER="$(apt-cache policy docker-ce | grep debian-buster | head -1 | awk '{print $1}')" && [ -n "${DOCKER_VER}" ] && apt install docker-ce=${DOCKER_VER} docker-ce-cli=${DOCKER_VER}
124 131

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh

@@ -109,7 +109,7 @@ apt-get dist-upgrade
109 109
110 110 # Migrate (webserver) from php7.0 to php7.3
111 111 apt install $(dpkg -l |grep php7.0 | awk '/^i/ { print $2 }' |grep -v ^php7.0-opcache |sed s/php7.0/php/)
112 - a2dismod php7.0; a2enmod php7.3 && systemctl restart apache2; ls -la /etc/php/7.0/*/conf.d/
112 + [ -L /etc/apache2/mods-enabled/mpm_prefork.load ] && a2dismod php7.0 && a2enmod php7.3 && systemctl restart apache2; ls -la /etc/php/7.0/*/conf.d/
113 113 # php-fpm
114 114 tail -10 /etc/php/7.0/fpm/pool.d/www.conf
115 115 vi /etc/php/7.3/fpm/pool.d/www.conf

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh

@@ -72,7 +72,7 @@ sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' $CFG
72 72 sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG
73 73
74 74 # chrony update, modify the new config to our needs and place it where it is expected.
75 - # Keep LOCAL config if asked when upgrading
75 + # Accept MAINTAINERS version (and run this snippet afterwards)
76 76 if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi
77 77 sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG
78 78

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh

@@ -95,7 +95,7 @@ sed -i '/codename=..distro_codename.-updates/ s#^//# #' /tmp/50unattended-upgra
95 95 [ "$CFG" == "/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old" ] && mv $CFG /etc/apt/apt.conf.d/50unattended-upgrades.ucf-save
96 96
97 97 ## phpmyadmin
98 - if [ "$(dpkg -l | grep -c phpmyadmin)" = "1" ]; then wget https://gist.githubusercontent.com/waja/77e3d2febb0745478466344f0ce5a50e/raw/deploy_phpmyadmin_buster.sh -O /tmp/a && sh /tmp/a; fi && \
98 + if [ "$(dpkg -l | grep -Ec '^i.*phpmyadmin ')" = "1" ]; then wget https://gist.githubusercontent.com/waja/77e3d2febb0745478466344f0ce5a50e/raw/deploy_phpmyadmin_buster.sh -O /tmp/a && sh /tmp/a; fi && \
99 99 if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \
100 100 else CFG=/etc/phpmyadmin/config.inc.php; fi
101 101 sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 1 insertion

stretch2buster.sh

@@ -95,6 +95,7 @@ sed -i '/codename=..distro_codename.-updates/ s#^//# #' /tmp/50unattended-upgra
95 95 [ "$CFG" == "/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old" ] && mv $CFG /etc/apt/apt.conf.d/50unattended-upgrades.ucf-save
96 96
97 97 ## phpmyadmin
98 + if [ "$(dpkg -l | grep -c phpmyadmin)" = "1" ]; then wget https://gist.githubusercontent.com/waja/77e3d2febb0745478466344f0ce5a50e/raw/deploy_phpmyadmin_buster.sh -O /tmp/a && sh /tmp/a; fi && \
98 99 if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \
99 100 else CFG=/etc/phpmyadmin/config.inc.php; fi
100 101 sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh

@@ -143,7 +143,7 @@ apt purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') && \
143 143 apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') && \
144 144 apt purge $(dpkg -l | grep -E 'deb7|wheezy' | grep -v xen | grep -v -E 'linux-image|mailscanner|openswan|debian-security-support' | awk '/^rc/ { print $2 }') && \
145 145 apt purge $(dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{ print $2 }') && \
146 - apt purge $(dpkg -l | grep -E 'deb9|stretch' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2' | awk '{ print $2 }') && \
146 + apt purge $(dpkg -l | grep -E 'deb9|stretch' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2|phpmyadmin' | awk '{ print $2 }') && \
147 147 apt -y install deborphan && apt purge $(deborphan | grep -v xen | grep -v -E 'libpam-cracklib|libapache2-mpm-itk')
148 148 apt purge $(dpkg -l | awk '/^rc/ { print $2 }')
149 149

Jan Wagner revised this gist 5 years ago. Go to revision

1 file changed, 2 insertions, 2 deletions

stretch2buster.sh

@@ -136,8 +136,8 @@ systemctl daemon-reload && systemctl restart unbound
136 136
137 137 # remove old squeeze packages left around (keep eyes open!)
138 138 apt autoremove && \
139 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin' | awk '/^i *A/ { print $3 }') && \
140 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin' | awk '/^i/ { print $2 }') && \
139 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding' | awk '/^i *A/ { print $3 }') && \
140 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding' | awk '/^i/ { print $2 }') && \
141 141 apt purge $(dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '/^rc/ { print $2 }') && \
142 142 apt purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') && \
143 143 apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') && \

Jan Wagner revised this gist 6 years ago. Go to revision

1 file changed, 3 insertions

stretch2buster.sh

@@ -100,6 +100,9 @@ if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/conf
100 100 sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG
101 101 sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG
102 102
103 + # transition sshd port changes
104 + sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart
105 +
103 106 # full-upgrade
104 107 apt-get dist-upgrade
105 108

Jan Wagner revised this gist 6 years ago. Go to revision

1 file changed, 3 insertions

stretch2buster.sh

@@ -3,6 +3,9 @@ Please also refer to http://www.debian.org/releases/buster/releasenotes and use
3 3 # Crossgrading ?!?
4 4 [ "$(dpkg --print-architecture)" == "i386" ] && echo "How about crossgrading to amd64 as described in https://stbuehler.de/blog/article/2017/06/28/debian_stretch__upgrade_32-bit_to_64-bit.html?"
5 5
6 + # Since running buster with older kernels may not work well (eg jessie kernels) lets see if we have a domU without own kernel
7 + if [ -d /sys/module/xen_netfront -a $(dpkg -l | grep grub-xen-bin | wc -l) = 0 -a $(dpkg -l | grep linux-image | wc -l) = 0 ]; then echo "Please run 'apt install grub-xen-bin grub-xen linux-image-amd64 && update-grub' to install a recent kernel and boot your domU with it next time"; fi
8 +
6 9 # upgrade to UTF-8 locales (http://www.debian.org/releases/buster/amd64/release-notes/ap-old-stuff.en.html#switch-utf8)
7 10 dpkg-reconfigure locales
8 11

Jan Wagner revised this gist 6 years ago. Go to revision

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh

@@ -79,7 +79,7 @@ sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG
79 79 /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst configure
80 80
81 81 # migrate unattended-upgrades config, modify the new config to our needs and place it where it is expected.
82 - # Keep LOCAL config if asked when upgrading (and run this snippet afterwards, when dpkg is not blocked anymore)
82 + # Keep LOCAL config if asked when upgrading (and run this snippet afterwards, when dpkg is not blocked anymore and choose 'package maintainer version' then, cause this is the one we are adjusting here)
83 83 if [ -f /etc/apt/apt.conf.d/50unattended-upgrades.ucf-old ]; then CFG=/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old; else CFG=/etc/apt/apt.conf.d/50unattended-upgrades; fi && \
84 84 cp /usr/share/unattended-upgrades/50unattended-upgrades /tmp/ && \
85 85 MAIL=$(grep ^Unattended-Upgrade::Mail $CFG | awk -F\" '{print $2}'); sed -i 's#//Unattended-Upgrade::Mail ".*";#Unattended-Upgrade::Mail "'${MAIL}'";#g' /tmp/50unattended-upgrades && \