Последняя активность 6 months ago

Jan Wagner ревизий этого фрагмента 4 years ago. К ревизии

1 file changed, 28 insertions, 41 deletions

stretch2buster.sh переименован в buster2bullseye.sh

@@ -1,21 +1,18 @@
1 - Please also refer to http://www.debian.org/releases/buster/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 :)
1 + Please also refer to http://www.debian.org/releases/bullseye/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 2
3 3 # Crossgrading ?!?
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?"
4 + [ "$(dpkg --print-architecture)" == "i386" ] && echo "How about crossgrading to amd64 as described in https://stbuehler.de/blog/article/2017/06/28/debian_buster__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 -
9 - # upgrade to UTF-8 locales (http://www.debian.org/releases/buster/amd64/release-notes/ap-old-stuff.en.html#switch-utf8)
6 + # upgrade to UTF-8 locales (http://www.debian.org/releases/bullseye/amd64/release-notes/ap-old-stuff.en.html#switch-utf8)
10 7 dpkg-reconfigure locales
11 8
12 9 # remove unused config file
13 10 rm -rf /etc/network/options /etc/environment
14 11
15 - # are there 3rd party packages installed? (https://www.debian.org/releases/buster/amd64/release-notes/ch-upgrading.de.html#system-status)
12 + # are there 3rd party packages installed? (https://www.debian.org/releases/bullseye/amd64/release-notes/ch-upgrading.de.html#system-status)
16 13 aptitude search '~i(!~ODebian)'
17 14
18 - # check for ftp protocol in sources lists (https://www.debian.org/releases/buster/amd64/release-notes/ch-information.en.html#deprecation-of-ftp-apt-mirrors)
15 + # check for ftp protocol in sources lists (https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html#deprecation-of-ftp-apt-mirrors)
19 16 rgrep --color "deb ftp" /etc/apt/sources.list*
20 17
21 18 # Transition and remove entries from older releases
@@ -27,12 +24,12 @@ sed -i /jessie/d /etc/apt/sources.list*
27 24 sed -i /volatile/d /etc/apt/sources.list*
28 25 sed -i /proposed-updates/d /etc/apt/sources.list*
29 26 # change distro (please move 3rd party sources to /etc/apt/sources.list.d/), maybe look into http://ftp.cyconet.org/debian/sources.list.d/
30 - sed -i s/stretch/buster/g /etc/apt/sources.list*
31 - sed -i "s/ stable/ buster/g" /etc/apt/sources.list*
32 - sed -i s/stretch/buster/g /etc/apt/preferences*
33 - sed -i s/stretch/buster/g /etc/apt/sources.list.d/*stretch*
34 - rename s/stretch/buster/g /etc/apt/sources.list.d/*stretch*
35 - rgrep --color stretch /etc/apt/sources.list*
27 + sed -i s/buster/bullseye/g /etc/apt/sources.list*
28 + sed -i "s/ stable/ bullseye/g" /etc/apt/sources.list*
29 + sed -i s/buster/bullseye/g /etc/apt/preferences*
30 + sed -i s/buster/bullseye/g /etc/apt/sources.list.d/*buster*
31 + rename s/buster/bullseye/g /etc/apt/sources.list.d/*buster*
32 + rgrep --color buster /etc/apt/sources.list*
36 33 apt-get update
37 34
38 35 # check package status
@@ -49,15 +46,15 @@ aptitude unmarkauto $(dpkg-query -W 'linux-image-4.9.0*' | cut -f1)
49 46 apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h
50 47
51 48 # record session
52 - script -t 2>~/upgrade-buster.time -a ~/upgrade-buster.script
49 + script -t 2>~/upgrade-bullseye.time -a ~/upgrade-bullseye.script
53 50
54 51 # install our preseed so libc doesn't whine
55 - cat > /tmp/stretch.preseed <<EOF
52 + cat > /tmp/buster.preseed <<EOF
56 53 libc6 glibc/upgrade boolean true
57 54 libc6 glibc/restart-services string
58 55 libc6 libraries/restart-without-asking boolean true
59 56 EOF
60 - /usr/bin/debconf-set-selections /tmp/stretch.preseed
57 + /usr/bin/debconf-set-selections /tmp/buster.preseed
61 58
62 59 # update aptitude first
63 60 [ "$(which aptitude)" = "/usr/bin/aptitude" ] && aptitude install aptitude && \
@@ -95,7 +92,6 @@ sed -i '/codename=..distro_codename.-updates/ s#^//# #' /tmp/50unattended-upgra
95 92 [ "$CFG" == "/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old" ] && mv $CFG /etc/apt/apt.conf.d/50unattended-upgrades.ucf-save
96 93
97 94 ## phpmyadmin
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 95 if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \
100 96 else CFG=/etc/phpmyadmin/config.inc.php; fi
101 97 sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG
@@ -107,16 +103,16 @@ sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart
107 103 # full-upgrade
108 104 apt-get dist-upgrade
109 105
110 - # Migrate (webserver) from php7.0 to php7.3
111 - apt install $(dpkg -l |grep php7.0 | awk '/^i/ { print $2 }' |grep -v ^php7.0-opcache |sed s/php7.0/php/)
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/
106 + # Migrate (webserver) from php7.3 to php7.4
107 + apt install $(dpkg -l |grep php7.3 | awk '/^i/ { print $2 }' |grep -v ^php7.3-opcache |sed s/php7.3/php/)
108 + [ -L /etc/apache2/mods-enabled/mpm_prefork.load ] && a2dismod php7.3 && a2enmod php7.4 && systemctl restart apache2; ls -la /etc/php/7.3/*/conf.d/
113 109 # php-fpm
114 - tail -10 /etc/php/7.0/fpm/pool.d/www.conf
115 - vi /etc/php/7.3/fpm/pool.d/www.conf
116 - systemctl disable php7.0-fpm && systemctl stop php7.0-fpm && systemctl restart php7.3-fpm
110 + tail -10 /etc/php/7.3/fpm/pool.d/www.conf
111 + vi /etc/php/7.4/fpm/pool.d/www.conf
112 + systemctl disable php7.3-fpm && systemctl stop php7.3-fpm && systemctl restart php7.4-fpm
117 113 # nginx
118 - rename s/php70/php73/g /etc/nginx/conf.d/*php70*.conf
119 - sed -i s/php7.0-fpm/php7.3-fpm/g /etc/nginx/conf.d/*.conf /etc/nginx/snippets/*.conf /etc/nginx/sites-available/*
114 + rename s/php73/php74/g /etc/nginx/conf.d/*php73*.conf
115 + sed -i s/php7.3-fpm/php7.4-fpm/g /etc/nginx/conf.d/*.conf /etc/nginx/snippets/*.conf /etc/nginx/sites-available/*
120 116 systemctl restart nginx
121 117
122 118 # Update old postfix configurations
@@ -126,21 +122,11 @@ if [ -z $(postconf -nh compatibility_level) ]; then sed -iE 's/^readme_directory
126 122 diff -Nur /tmp/postfix/main.cf /etc/postfix/main.cf && \
127 123 postfix reload
128 124
129 - # transition docker-ce to buster package
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}
131 -
132 - # transition icingaweb2 to buster package
133 - ICINGAWEB2_VER="$(apt-cache policy icingaweb2 | grep "\.buster" | head -1 | awk '{print $1}')" && [ -n "${ICINGAWEB2_VER}" ] && apt install icingaweb2=${ICINGAWEB2_VER} icingaweb2-common=${ICINGAWEB2_VER} icingaweb2-module-monitoring=${ICINGAWEB2_VER} php-icinga=${ICINGAWEB2_VER} icingacli=${ICINGAWEB2_VER}
125 + # transition docker-ce to bullseye package
126 + DOCKER_VER="$(apt-cache policy docker-ce | grep debian-bullseye | head -1 | awk '{print $1}')" && [ -n "${DOCKER_VER}" ] && apt install docker-ce=${DOCKER_VER} docker-ce-cli=${DOCKER_VER}
134 127
135 - # provide /etc/dovecot/private/dovecot.key from default config to prevent failing to start dovecot
136 - ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/dovecot/private/dovecot.key
137 -
138 - # Fixing systemd unit for chrooted unbound (https://bugs.debian.org/931583)
139 - mkdir -p /etc/systemd/system/unbound.service.d/ && cat > /etc/systemd/system/unbound.service.d/override.conf <<EOF
140 - [Service]
141 - BindPaths=/run/systemd/notify:/var/lib/unbound/run/systemd/notify
142 - EOF
143 - systemctl daemon-reload && systemctl restart unbound
128 + # transition icingaweb2 to bullseye package
129 + ICINGAWEB2_VER="$(apt-cache policy icingaweb2 | grep "\.bullseye" | head -1 | awk '{print $1}')" && [ -n "${ICINGAWEB2_VER}" ] && apt install icingaweb2=${ICINGAWEB2_VER} icingaweb2-common=${ICINGAWEB2_VER} icingaweb2-module-monitoring=${ICINGAWEB2_VER} php-icinga=${ICINGAWEB2_VER} icingacli=${ICINGAWEB2_VER}
144 130
145 131 # remove old squeeze packages left around (keep eyes open!)
146 132 apt autoremove && \
@@ -152,6 +138,7 @@ apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print
152 138 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 }') && \
153 139 apt purge $(dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{ print $2 }') && \
154 140 apt purge $(dpkg -l | grep -E 'deb9|stretch' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2|phpmyadmin' | awk '{ print $2 }') && \
141 + apt purge $(dpkg -l | grep -E 'deb10|buster' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2|phpmyadmin' | awk '{ print $2 }') && \
155 142 apt -y install deborphan && apt purge $(deborphan | grep -v xen | grep -v -E 'libpam-cracklib|libapache2-mpm-itk')
156 143 apt purge $(dpkg -l | awk '/^rc/ { print $2 }')
157 144
@@ -160,7 +147,7 @@ reboot && sleep 180; echo u > /proc/sysrq-trigger ; sleep 2 ; echo s > /proc/sys
160 147
161 148 ### not needed until now
162 149 # Upgrade postgres
163 - # See also https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.de.html#plperl
150 + # See also https://www.debian.org/releases/buster/amd64/release-notes/ch-information.de.html#plperl
164 151 if [ "$(dpkg -l | grep "postgresql-9.4" | awk {'print $2'})" = "postgresql-9.4" ]; then \
165 152 aptitude install postgresql-9.6 && \
166 153 pg_dropcluster --stop 9.6 main && \

Jan Wagner ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 5 years ago. К ревизии

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 ревизий этого фрагмента 6 years ago. К ревизии

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 ревизий этого фрагмента 6 years ago. К ревизии

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