Jan Wagner ревизий этого фрагмента 4 years ago. К ревизии
2 files changed, 3 insertions, 186 deletions
README.md(файл создан)
| @@ -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 (файл удалён)
| @@ -1,186 +0,0 @@ | |||
| 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 :) | |
| 2 | - | ||
| 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?" | |
| 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) | |
| 10 | - | dpkg-reconfigure locales | |
| 11 | - | ||
| 12 | - | # remove unused config file | |
| 13 | - | rm -rf /etc/network/options /etc/environment | |
| 14 | - | ||
| 15 | - | # are there 3rd party packages installed? (https://www.debian.org/releases/buster/amd64/release-notes/ch-upgrading.de.html#system-status) | |
| 16 | - | aptitude search '~i(!~ODebian)' | |
| 17 | - | ||
| 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) | |
| 19 | - | rgrep --color "deb ftp" /etc/apt/sources.list* | |
| 20 | - | ||
| 21 | - | # Transition and remove entries from older releases | |
| 22 | - | sed -i /lenny/d /etc/apt/sources.list* | |
| 23 | - | sed -i /sarge/d /etc/apt/sources.list* | |
| 24 | - | sed -i /squeeze/d /etc/apt/sources.list* | |
| 25 | - | sed -i /wheezy/d /etc/apt/sources.list* | |
| 26 | - | sed -i /jessie/d /etc/apt/sources.list* | |
| 27 | - | sed -i /volatile/d /etc/apt/sources.list* | |
| 28 | - | sed -i /proposed-updates/d /etc/apt/sources.list* | |
| 29 | - | # 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* | |
| 36 | - | apt-get update | |
| 37 | - | ||
| 38 | - | # check package status | |
| 39 | - | dpkg --audit | |
| 40 | - | aptitude search "~ahold" | grep "^.h" | |
| 41 | - | dpkg --get-selections | grep hold | |
| 42 | - | ||
| 43 | - | # unmark packages auto | |
| 44 | - | aptitude unmarkauto vim net-tools && \ | |
| 45 | - | aptitude unmarkauto libapache2-mpm-itk && \ | |
| 46 | - | aptitude unmarkauto $(dpkg-query -W 'linux-image-4.9.0*' | cut -f1) | |
| 47 | - | ||
| 48 | - | # have a look into required and free disk space | |
| 49 | - | apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h | |
| 50 | - | ||
| 51 | - | # purge already remove packages | |
| 52 | - | apt purge $(dpkg -l | awk '/^rc/ { print $2 }') | |
| 53 | - | ||
| 54 | - | # check for a linux-image meta package | |
| 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!" | |
| 56 | - | ||
| 57 | - | # record session | |
| 58 | - | script -t 2>~/upgrade-buster.time -a ~/upgrade-buster.script | |
| 59 | - | ||
| 60 | - | # install our preseed so libc doesn't whine | |
| 61 | - | cat > /tmp/stretch.preseed <<EOF | |
| 62 | - | libc6 glibc/upgrade boolean true | |
| 63 | - | libc6 glibc/restart-services string | |
| 64 | - | libc6 libraries/restart-without-asking boolean true | |
| 65 | - | EOF | |
| 66 | - | /usr/bin/debconf-set-selections /tmp/stretch.preseed | |
| 67 | - | ||
| 68 | - | # update aptitude first | |
| 69 | - | [ "$(which aptitude)" = "/usr/bin/aptitude" ] && aptitude install aptitude && \ | |
| 70 | - | [ "$(which apt)" = "/usr/bin/apt" ] && apt install apt | |
| 71 | - | ||
| 72 | - | # minimal system upgrade | |
| 73 | - | aptitude upgrade | |
| 74 | - | ||
| 75 | - | # randomize crontab | |
| 76 | - | if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
| 77 | - | sed -i 's#root cd#root perl -e "sleep int(rand(300))" \&\& cd#' $CFG | |
| 78 | - | sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG | |
| 79 | - | ||
| 80 | - | # chrony update, modify the new config to our needs and place it where it is expected. | |
| 81 | - | # Accept MAINTAINERS version (and run this snippet afterwards) | |
| 82 | - | if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi | |
| 83 | - | sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG | |
| 84 | - | ||
| 85 | - | # transition sshd port changes | |
| 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 | |
| 89 | - | fi | |
| 90 | - | ||
| 91 | - | # Fix our ssh pub key package configuration | |
| 92 | - | # Accept MAINTAINERS version (and run this snippet afterwards) | |
| 93 | - | [ -x /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst ] && \ | |
| 94 | - | /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst configure | |
| 95 | - | ||
| 96 | - | # migrate unattended-upgrades config, modify the new config to our needs and place it where it is expected. | |
| 97 | - | # 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) | |
| 98 | - | 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 && \ | |
| 99 | - | cp /usr/share/unattended-upgrades/50unattended-upgrades /tmp/ && \ | |
| 100 | - | MAIL=$(grep ^Unattended-Upgrade::Mail $CFG | awk -F\" '{print $2}'); sed -i 's#//Unattended-Upgrade::Mail ".*";#Unattended-Upgrade::Mail "'${MAIL}'";#g' /tmp/50unattended-upgrades && \ | |
| 101 | - | TIME=$(grep ^Unattended-Upgrade::Automatic-Reboot-Time $CFG | awk -F\" '{print $2}'); if [ "${TIME}" != "" ]; then sed -i 's#//Unattended-Upgrade::Automatic-Reboot-Time "02:00"#Unattended-Upgrade::Automatic-Reboot-Time "'${TIME}'"#' /tmp/50unattended-upgrades; fi | |
| 102 | - | sed -i 's#// "origin=Debian,codename=${distro_codename}-updates"# "origin=Debian,codename=${distro_codename}-updates"#' /tmp/50unattended-upgrades && \ | |
| 103 | - | sed -i 's#//Unattended-Upgrade::Remove-Unused-Dependencies "false"#Unattended-Upgrade::Remove-Unused-Dependencies "true"#' /tmp/50unattended-upgrades && \ | |
| 104 | - | sed -i 's#//Unattended-Upgrade::Automatic-Reboot "false"#Unattended-Upgrade::Automatic-Reboot "true"#' /tmp/50unattended-upgrades && \ | |
| 105 | - | sed -i '/codename=..distro_codename.-updates/ s#^//# #' /tmp/50unattended-upgrades && \ | |
| 106 | - | /bin/bash /usr/bin/ucf --three-way --debconf-ok /tmp/50unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades && \ | |
| 107 | - | [ "$CFG" == "/etc/apt/apt.conf.d/50unattended-upgrades.ucf-old" ] && mv $CFG /etc/apt/apt.conf.d/50unattended-upgrades.ucf-save | |
| 108 | - | ||
| 109 | - | # full-upgrade | |
| 110 | - | apt-get dist-upgrade | |
| 111 | - | ||
| 112 | - | # Migrate (webserver) from php7.0 to php7.3 | |
| 113 | - | apt install $(dpkg -l |grep php7.0 | awk '/^i/ { print $2 }' |grep -v ^php7.0-opcache |sed s/php7.0/php/) | |
| 114 | - | [ -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/ | |
| 115 | - | # php-fpm | |
| 116 | - | tail -10 /etc/php/7.0/fpm/pool.d/www.conf | |
| 117 | - | vi /etc/php/7.3/fpm/pool.d/www.conf | |
| 118 | - | systemctl disable php7.0-fpm && systemctl stop php7.0-fpm && systemctl restart php7.3-fpm | |
| 119 | - | # nginx | |
| 120 | - | rename s/php70/php73/g /etc/nginx/conf.d/*php70*.conf | |
| 121 | - | sed -i s/php7.0-fpm/php7.3-fpm/g /etc/nginx/conf.d/*.conf /etc/nginx/snippets/*.conf /etc/nginx/sites-available/* | |
| 122 | - | systemctl restart nginx | |
| 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 | - | # Update old postfix configurations | |
| 132 | - | cp /etc/postfix/main.cf /tmp/main.cf && \ | |
| 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 && \ | |
| 134 | - | 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 && \ | |
| 135 | - | diff -Nur /tmp/main.cf /etc/postfix/main.cf && \ | |
| 136 | - | postfix reload | |
| 137 | - | ||
| 138 | - | # transition docker-ce to buster package | |
| 139 | - | 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} | |
| 140 | - | ||
| 141 | - | # transition icingaweb2 to buster package | |
| 142 | - | 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} | |
| 143 | - | ||
| 144 | - | # provide /etc/dovecot/private/dovecot.key from default config to prevent failing to start dovecot | |
| 145 | - | ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/dovecot/private/dovecot.key | |
| 146 | - | ||
| 147 | - | # Fixing systemd unit for chrooted unbound (https://bugs.debian.org/931583) | |
| 148 | - | mkdir -p /etc/systemd/system/unbound.service.d/ && cat > /etc/systemd/system/unbound.service.d/override.conf <<EOF | |
| 149 | - | [Service] | |
| 150 | - | BindPaths=/run/systemd/notify:/var/lib/unbound/run/systemd/notify | |
| 151 | - | EOF | |
| 152 | - | systemctl daemon-reload && systemctl restart unbound | |
| 153 | - | ||
| 154 | - | # Apply pdns-backend database migration | |
| 155 | - | 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 | |
| 156 | - | ||
| 157 | - | # remove old squeeze packages left around (keep eyes open!) | |
| 158 | - | apt autoremove && \ | |
| 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 | - | apt purge $(dpkg -l | grep etch | grep -v xen | grep -v unbound | grep -v finch | awk '/^rc/ { print $2 }') && \ | |
| 162 | - | apt purge $(dpkg -l | grep lenny | grep -v xen | awk '/^rc/ { print $2 }') && \ | |
| 163 | - | apt purge $(dpkg -l | grep -E 'deb6|squeeze' | grep -v xen | awk '/^rc/ { print $2 }') && \ | |
| 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 | - | 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|ttytter' | awk '{ print $2 }') && \ | |
| 167 | - | apt -y install deborphan && apt purge $(deborphan | grep -v xen | grep -v -E 'libpam-cracklib|libapache2-mpm-itk') | |
| 168 | - | apt purge $(dpkg -l | awk '/^rc/ { print $2 }') | |
| 169 | - | ||
| 170 | - | # for the brave YoloOps crowd | |
| 171 | - | reboot && sleep 180; echo u > /proc/sysrq-trigger ; sleep 2 ; echo s > /proc/sysrq-trigger ; sleep 2 ; echo b > /proc/sysrq-trigger | |
| 172 | - | ||
| 173 | - | ### not needed until now | |
| 174 | - | # Upgrade postgres | |
| 175 | - | # See also https://www.debian.org/releases/stretch/amd64/release-notes/ch-information.de.html#plperl | |
| 176 | - | if [ "$(dpkg -l | grep "postgresql-9.4" | awk {'print $2'})" = "postgresql-9.4" ]; then \ | |
| 177 | - | aptitude install postgresql-9.6 && \ | |
| 178 | - | pg_dropcluster --stop 9.6 main && \ | |
| 179 | - | /etc/init.d/postgresql stop && \ | |
| 180 | - | pg_upgradecluster -v 9.6 9.4 main && \ | |
| 181 | - | sed -i "s/^manual/auto/g" /etc/postgresql/9.6/main/start.conf && \ | |
| 182 | - | sed -i "s/^port = .*/port = 5432/" /etc/postgresql/9.6/main/postgresql.conf && \ | |
| 183 | - | sed -i "s/^shared_buffers = .*/shared_buffers = 128MB/" /etc/postgresql/9.6/main/postgresql.conf && \ | |
| 184 | - | /etc/init.d/postgresql restart; \ | |
| 185 | - | fi | |
| 186 | - | pg_dropcluster 9.4 main | |
Jan Wagner ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 ревизий этого фрагмента 4 years ago. К ревизии
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 | ||