waja

waja / gist:a9d3a0cf847d4652b4f394afdff970d2

Last active 3 months ago

Like 0

Jan Wagner revised this gist 4 years ago · 9afeead

2 files changed, 3 insertions, 186 deletions

README.md (file created)
@@ -0,0 +1,3 @@
1 + # New location
2 +
3 + Head over to https://github.com/waja/debian-update-cheatsheets/blob/stretch2buster/stretch2buster.sh
stretch2buster.sh (file deleted)

Diff is too large to be shown

Jan Wagner revised this gist 4 years ago · 32ec114

1 file changed, 3 insertions, 3 deletions

stretch2buster.sh
@@ -156,14 +156,14 @@ source /etc/default/config-mysql-server-auth; mysql -u root --password=${MYSQLPW
156 156
157 157 # remove old squeeze packages left around (keep eyes open!)
158 158 apt autoremove && \
159 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli' | awk '/^i *A/ { print $3 }') && \
160 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli' | awk '/^i/ { print $2 }') && \
159 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli|ttytter' | awk '/^i *A/ { print $3 }') && \
160 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli|ttytter' | awk '/^i/ { print $2 }') && \
161 161 apt purge $(dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '/^rc/ { print $2 }') && \
162 162 apt purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') && \
163 163 apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') && \
164 164 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 }') && \
165 165 apt purge $(dpkg -l | grep -E 'deb8|jessie' | grep -v xen | grep -v -E 'linux-image|debian-security-support' | awk '{ print $2 }') && \
166 - apt purge $(dpkg -l | grep -E 'deb9|stretch' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2|phpmyadmin' | awk '{ print $2 }') && \
166 + apt purge $(dpkg -l | grep -E 'deb9|stretch' | grep -v xen | grep -v -E 'linux-image|debian-security-support|icinga2|phpmyadmin|ttytter' | awk '{ print $2 }') && \
167 167 apt -y install deborphan && apt purge $(deborphan | grep -v xen | grep -v -E 'libpam-cracklib|libapache2-mpm-itk')
168 168 apt purge $(dpkg -l | awk '/^rc/ { print $2 }')
169 169

Jan Wagner revised this gist 4 years ago · 0641b40

1 file changed, 2 insertions, 2 deletions

stretch2buster.sh
@@ -156,8 +156,8 @@ source /etc/default/config-mysql-server-auth; mysql -u root --password=${MYSQLPW
156 156
157 157 # remove old squeeze packages left around (keep eyes open!)
158 158 apt autoremove && \
159 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding' | awk '/^i *A/ { print $3 }') && \
160 - apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding' | awk '/^i/ { print $2 }') && \
159 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli' | awk '/^i *A/ { print $3 }') && \
160 + apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding|hp-health|hpacucli' | awk '/^i/ { print $2 }') && \
161 161 apt purge $(dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '/^rc/ { print $2 }') && \
162 162 apt purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') && \
163 163 apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') && \

Jan Wagner revised this gist 5 years ago · db5a8cd

1 file changed, 7 insertions, 7 deletions

stretch2buster.sh
@@ -106,13 +106,6 @@ sed -i '/codename=..distro_codename.-updates/ s#^//# #' /tmp/50unattended-upgra
106 106 /bin/bash /usr/bin/ucf --three-way --debconf-ok /tmp/50unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades && \
107 107 [ "$CFG" == "/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old" ] && mv $CFG /etc/apt/apt.conf.d/50unattended-upgrades.ucf-save
108 108
109 - ## phpmyadmin
110 - 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 && \
111 - if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \
112 - else CFG=/etc/phpmyadmin/config.inc.php; fi
113 - sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG
114 - sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG
115 -
116 109 # full-upgrade
117 110 apt-get dist-upgrade
118 111
@@ -128,6 +121,13 @@ rename s/php70/php73/g /etc/nginx/conf.d/*php70*.conf
128 121 sed -i s/php7.0-fpm/php7.3-fpm/g /etc/nginx/conf.d/*.conf /etc/nginx/snippets/*.conf /etc/nginx/sites-available/*
129 122 systemctl restart nginx
130 123
124 + # phpmyadmin
125 + 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 && \
126 + if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/config.inc.php.dpkg-new; \
127 + else CFG=/etc/phpmyadmin/config.inc.php; fi
128 + sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG
129 + sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG
130 +
131 131 # Update old postfix configurations
132 132 cp /etc/postfix/main.cf /tmp/main.cf && \
133 133 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 && \

Jan Wagner revised this gist 5 years ago · 0ba800a

1 file changed, 3 insertions, 5 deletions

stretch2buster.sh
@@ -83,11 +83,9 @@ if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; els
83 83 sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG
84 84
85 85 # transition sshd port changes
86 - if [ -f /etc/ssh/sshd_config.dpkg-new ]; then
87 - SSH_PORT=$(grep "^ *Port" /etc/ssh/sshd_config | cut -d' ' -f2)
88 - if [ -n ${SSH_PORT} ]; then
89 - sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config && /etc/init.d/ssh restart
90 - fi
86 + SSH_PORT=$(grep "^ *Port" /etc/ssh/sshd_config | cut -d' ' -f2)
87 + if [ -n ${SSH_PORT} ]; then
88 + sed -i "s/^#Port 22/Port ${SSH_PORT}/" /tmp/file2mIMWI && /etc/init.d/ssh restart
91 89 fi
92 90
93 91 # Fix our ssh pub key package configuration

Jan Wagner revised this gist 5 years ago · 97da2e0

1 file changed, 8 insertions, 3 deletions

stretch2buster.sh
@@ -82,6 +82,14 @@ sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG
82 82 if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi
83 83 sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG
84 84
85 + # transition sshd port changes
86 + if [ -f /etc/ssh/sshd_config.dpkg-new ]; then
87 + SSH_PORT=$(grep "^ *Port" /etc/ssh/sshd_config | cut -d' ' -f2)
88 + if [ -n ${SSH_PORT} ]; then
89 + sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config && /etc/init.d/ssh restart
90 + fi
91 + fi
92 +
85 93 # Fix our ssh pub key package configuration
86 94 # Accept MAINTAINERS version (and run this snippet afterwards)
87 95 [ -x /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst ] && \
@@ -107,9 +115,6 @@ if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/conf
107 115 sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG
108 116 sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG
109 117
110 - # transition sshd port changes
111 - sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart
112 -
113 118 # full-upgrade
114 119 apt-get dist-upgrade
115 120

Jan Wagner revised this gist 5 years ago · 0095760

1 file changed, 3 insertions

stretch2buster.sh
@@ -148,6 +148,9 @@ BindPaths=/run/systemd/notify:/var/lib/unbound/run/systemd/notify
148 148 EOF
149 149 systemctl daemon-reload && systemctl restart unbound
150 150
151 + # Apply pdns-backend database migration
152 + source /etc/default/config-mysql-server-auth; mysql -u root --password=${MYSQLPW} $(grep ^gmysql-dbname /etc/powerdns/pdns.d/pdns.local.gmysql.conf | cut -d= -f 2) < /usr/share/pdns-backend-mysql/schema/3.4.0_to_4.1.0_schema.mysql.sql
153 +
151 154 # remove old squeeze packages left around (keep eyes open!)
152 155 apt autoremove && \
153 156 apt purge $(aptitude search ?obsolete | grep -v -E 'linux-image|mailscanner|phpmyadmin|check-openmanage|check-linux-bonding' | awk '/^i *A/ { print $3 }') && \

Jan Wagner revised this gist 5 years ago · 72d4a5d

1 file changed, 1 insertion, 1 deletion

stretch2buster.sh
@@ -129,7 +129,7 @@ systemctl restart nginx
129 129 cp /etc/postfix/main.cf /tmp/main.cf && \
130 130 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 && \
131 131 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 && \
132 - diff -Nur /tmp/postfix/main.cf /etc/postfix/main.cf && \
132 + diff -Nur /tmp/main.cf /etc/postfix/main.cf && \
133 133 postfix reload
134 134
135 135 # transition docker-ce to buster package

Jan Wagner revised this gist 5 years ago · 8c51643

1 file changed, 3 insertions

stretch2buster.sh
@@ -48,6 +48,9 @@ aptitude unmarkauto $(dpkg-query -W 'linux-image-4.9.0*' | cut -f1)
48 48 # have a look into required and free disk space
49 49 apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h
50 50
51 + # purge already remove packages
52 + apt purge $(dpkg -l | awk '/^rc/ { print $2 }')
53 +
51 54 # check for a linux-image meta package
52 55 dpkg -l "linux-image*" | grep ^ii | grep -i meta || echo "Please have a look into https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.en.html#kernel-metapackage!"
53 56

Jan Wagner revised this gist 5 years ago · 2b1bdbb

1 file changed, 3 insertions

stretch2buster.sh
@@ -48,6 +48,9 @@ aptitude unmarkauto $(dpkg-query -W 'linux-image-4.9.0*' | cut -f1)
48 48 # have a look into required and free disk space
49 49 apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h
50 50
51 + # check for a linux-image meta package
52 + dpkg -l "linux-image*" | grep ^ii | grep -i meta || echo "Please have a look into https://www.debian.org/releases/stretch/amd64/release-notes/ch-upgrading.en.html#kernel-metapackage!"
53 +
51 54 # record session
52 55 script -t 2>~/upgrade-buster.time -a ~/upgrade-buster.script
53 56