| @@ -63,6 +63,14 @@ EOF | |||
| 63 | 63 | [ "$(which aptitude)" = "/usr/bin/aptitude" ] && apt install aptitude && \ | |
| 64 | 64 | [ "$(which apt)" = "/usr/bin/apt" ] && apt install apt | |
| 65 | 65 | ||
| 66 | + | # transition sshd port changes and adjusted authkeyfile | |
| 67 | + | if [ ! -d /etc/ssh/sshd_config.d ]; then mkdir -p /etc/ssh/sshd_config.d; fi | |
| 68 | + | if [ ! $(grep ^Port /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/port.conf; fi | |
| 69 | + | if [ ! $(grep ^AuthorizedKeysFile /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/authorizedkeysfile.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/authorizedkeysfile.conf ; fi | |
| 70 | + | # transition ssh changes | |
| 71 | + | if [ ! -d /etc/ssh/ssh_config.d ]; then mkdir -p /etc/ssh/ssh_config.d; fi | |
| 72 | + | if [ ! $(grep "^ *Port" /etc/ssh/ssh_config | tee /etc/ssh/ssh_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/ssh_config.d/port.conf; fi | |
| 73 | + | ||
| 66 | 74 | # minimal system upgrade | |
| 67 | 75 | apt upgrade | |
| 68 | 76 | ||
| @@ -76,11 +84,6 @@ sed -i 's#root\ttest#root\tperl -e "sleep int(rand(3600))" \&\& test#' $CFG | |||
| 76 | 84 | if [ -f /etc/chrony/chrony.conf.new ]; then CFG=/etc/chrony/chrony.conf.new; else CFG=/etc/chrony/chrony.conf; fi | |
| 77 | 85 | sed s/2.debian.pool/0.de.pool/g /usr/share/chrony/chrony.conf > $CFG | |
| 78 | 86 | ||
| 79 | - | # Fix our ssh pub key package configuration | |
| 80 | - | # Accept MAINTAINERS version (and run this snippet afterwards) | |
| 81 | - | [ -x /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst ] && \ | |
| 82 | - | /var/lib/dpkg/info/config-openssh-server-authorizedkeys-core.postinst configure | |
| 83 | - | ||
| 84 | 87 | # migrate unattended-upgrades config, modify the new config to our needs and place it where it is expected. | |
| 85 | 88 | # 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) | |
| 86 | 89 | 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 && \ | |
| @@ -100,14 +103,6 @@ if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/conf | |||
| 100 | 103 | sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG | |
| 101 | 104 | sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG | |
| 102 | 105 | ||
| 103 | - | # transition sshd port changes and adjusted authkeyfile | |
| 104 | - | if [ ! -d /etc/ssh/sshd_config.d ]; then mkdir -p /etc/ssh/sshd_config.d; fi | |
| 105 | - | if [ ! $(grep ^Port /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/port.conf; fi | |
| 106 | - | if [ ! $(grep ^AuthorizedKeysFile /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/authorizedkeysfile.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/authorizedkeysfile.conf ; fi | |
| 107 | - | # transition ssh changes | |
| 108 | - | if [ ! -d /etc/ssh/ssh_config.d ]; then mkdir -p /etc/ssh/ssh_config.d; fi | |
| 109 | - | if [ ! $(grep "^ *Port" /etc/ssh/ssh_config | tee /etc/ssh/ssh_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/ssh_config.d/port.conf; fi | |
| 110 | - | ||
| 111 | 106 | # full-upgrade | |
| 112 | 107 | apt full-upgrade | |
| 113 | 108 | ||
waja / gist:cced251f4e8c4cc886d955ff01755343
Last active 3 months ago
Jan Wagner revised this gist 5 years ago · efbb230
1 file changed, 8 insertions, 13 deletions
Jan Wagner revised this gist 5 years ago · d9801b6
1 file changed, 2 insertions
| @@ -46,6 +46,8 @@ aptitude unmarkauto $(dpkg-query -W 'linux-image-4.19.0*' | cut -f1) | |||
| 46 | 46 | # have a look into required and free disk space | |
| 47 | 47 | apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h | |
| 48 | 48 | ||
| 49 | + | # check for a linux-image meta package | |
| 50 | + | dpkg -l "linux-image*" | grep ^ii | grep -i meta || echo "Please have a look into https://www.debian.org/releases/bullseye/amd64/release-notes/ch-upgrading.en.html#kernel-metapackage!" | |
| 49 | 51 | # record session | |
| 50 | 52 | script -t 2>~/upgrade-bullseye.time -a ~/upgrade-bullseye.script | |
| 51 | 53 | ||
Jan Wagner revised this gist 5 years ago · fb70f0d
1 file changed, 3 insertions
| @@ -102,6 +102,9 @@ sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][ | |||
| 102 | 102 | if [ ! -d /etc/ssh/sshd_config.d ]; then mkdir -p /etc/ssh/sshd_config.d; fi | |
| 103 | 103 | if [ ! $(grep ^Port /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/port.conf; fi | |
| 104 | 104 | if [ ! $(grep ^AuthorizedKeysFile /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/authorizedkeysfile.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/authorizedkeysfile.conf ; fi | |
| 105 | + | # transition ssh changes | |
| 106 | + | if [ ! -d /etc/ssh/ssh_config.d ]; then mkdir -p /etc/ssh/ssh_config.d; fi | |
| 107 | + | if [ ! $(grep "^ *Port" /etc/ssh/ssh_config | tee /etc/ssh/ssh_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/ssh_config.d/port.conf; fi | |
| 105 | 108 | ||
| 106 | 109 | # full-upgrade | |
| 107 | 110 | apt full-upgrade | |
Jan Wagner revised this gist 5 years ago · 7a12c6c
1 file changed, 4 insertions, 2 deletions
| @@ -98,8 +98,10 @@ if [ -f /etc/phpmyadmin/config.inc.php.dpkg-new ]; then CFG=/etc/phpmyadmin/conf | |||
| 98 | 98 | sed -i "s/\['auth_type'\] = 'cookie'/\['auth_type'\] = 'http'/" $CFG | |
| 99 | 99 | sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][\$i]['auth_type'] = 'http';#" $CFG | |
| 100 | 100 | ||
| 101 | - | # transition sshd port changes | |
| 102 | - | sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart | |
| 101 | + | # transition sshd port changes and adjusted authkeyfile | |
| 102 | + | if [ ! -d /etc/ssh/sshd_config.d ]; then mkdir -p /etc/ssh/sshd_config.d; fi | |
| 103 | + | if [ ! $(grep ^Port /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/port.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/port.conf; fi | |
| 104 | + | if [ ! $(grep ^AuthorizedKeysFile /etc/ssh/sshd_config | tee /etc/ssh/sshd_config.d/authorizedkeysfile.conf | wc -l) -gt 0 ]; then rm /etc/ssh/sshd_config.d/authorizedkeysfile.conf ; fi | |
| 103 | 105 | ||
| 104 | 106 | # full-upgrade | |
| 105 | 107 | apt full-upgrade | |
Jan Wagner revised this gist 5 years ago · ca96af4
1 file changed, 1 insertion, 1 deletion
| @@ -102,7 +102,7 @@ sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][ | |||
| 102 | 102 | sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart | |
| 103 | 103 | ||
| 104 | 104 | # full-upgrade | |
| 105 | - | apt dist-upgrade | |
| 105 | + | apt full-upgrade | |
| 106 | 106 | ||
| 107 | 107 | # Migrate (webserver) from php7.3 to php7.4 | |
| 108 | 108 | apt install $(dpkg -l |grep php7.3 | awk '/^i/ { print $2 }' |grep -v ^php7.3-opcache |sed s/php7.3/php/) | |
Jan Wagner revised this gist 5 years ago · 71a15f0
1 file changed, 1 insertion, 1 deletion
| @@ -41,7 +41,7 @@ dpkg --get-selections "*" > ~/curr-pkgs.txt | |||
| 41 | 41 | # unmark packages auto | |
| 42 | 42 | aptitude unmarkauto vim net-tools && \ | |
| 43 | 43 | aptitude unmarkauto libapache2-mpm-itk && \ | |
| 44 | - | aptitude unmarkauto $(dpkg-query -W 'linux-image-4.9.0*' | cut -f1) | |
| 44 | + | aptitude unmarkauto $(dpkg-query -W 'linux-image-4.19.0*' | cut -f1) | |
| 45 | 45 | ||
| 46 | 46 | # have a look into required and free disk space | |
| 47 | 47 | apt-get -o APT::Get::Trivial-Only=true dist-upgrade || df -h | |
Jan Wagner revised this gist 5 years ago · 82c78e7
1 file changed, 6 insertions, 6 deletions
| @@ -30,7 +30,7 @@ sed -i s/buster/bullseye/g /etc/apt/preferences* | |||
| 30 | 30 | sed -i s/buster/bullseye/g /etc/apt/sources.list.d/*buster* | |
| 31 | 31 | rename.ul buster bullseye /etc/apt/sources.list.d/*buster* | |
| 32 | 32 | rgrep --color buster /etc/apt/sources.list* | |
| 33 | - | apt-get update --allow-releaseinfo-change | |
| 33 | + | apt update | |
| 34 | 34 | ||
| 35 | 35 | # check package status | |
| 36 | 36 | dpkg --audit | |
| @@ -57,12 +57,12 @@ libc6 libraries/restart-without-asking boolean true | |||
| 57 | 57 | EOF | |
| 58 | 58 | /usr/bin/debconf-set-selections /tmp/buster.preseed | |
| 59 | 59 | ||
| 60 | - | # update aptitude first | |
| 61 | - | [ "$(which aptitude)" = "/usr/bin/aptitude" ] && aptitude install aptitude && \ | |
| 60 | + | # update aptitude and apt first | |
| 61 | + | [ "$(which aptitude)" = "/usr/bin/aptitude" ] && apt install aptitude && \ | |
| 62 | 62 | [ "$(which apt)" = "/usr/bin/apt" ] && apt install apt | |
| 63 | 63 | ||
| 64 | 64 | # minimal system upgrade | |
| 65 | - | aptitude upgrade | |
| 65 | + | apt upgrade | |
| 66 | 66 | ||
| 67 | 67 | # randomize crontab | |
| 68 | 68 | if [ -f /etc/crontab.dpkg-new ]; then CFG=/etc/crontab.dpkg-new; else CFG=/etc/crontab; fi | |
| @@ -102,7 +102,7 @@ sed -i "s#//\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'http';#\$cfg['Servers'][ | |||
| 102 | 102 | sed -i "s/^#Port 22/Port 1234/" /etc/ssh/sshd_config && /etc/init.d/ssh restart | |
| 103 | 103 | ||
| 104 | 104 | # full-upgrade | |
| 105 | - | apt-get dist-upgrade | |
| 105 | + | apt dist-upgrade | |
| 106 | 106 | ||
| 107 | 107 | # Migrate (webserver) from php7.3 to php7.4 | |
| 108 | 108 | apt install $(dpkg -l |grep php7.3 | awk '/^i/ { print $2 }' |grep -v ^php7.3-opcache |sed s/php7.3/php/) | |
| @@ -150,7 +150,7 @@ reboot && sleep 180; echo u > /proc/sysrq-trigger ; sleep 2 ; echo s > /proc/sys | |||
| 150 | 150 | # Upgrade postgres | |
| 151 | 151 | # See also https://www.debian.org/releases/buster/amd64/release-notes/ch-information.de.html#plperl | |
| 152 | 152 | if [ "$(dpkg -l | grep "postgresql-9.4" | awk {'print $2'})" = "postgresql-9.4" ]; then \ | |
| 153 | - | aptitude install postgresql-9.6 && \ | |
| 153 | + | apt install postgresql-9.6 && \ | |
| 154 | 154 | pg_dropcluster --stop 9.6 main && \ | |
| 155 | 155 | /etc/init.d/postgresql stop && \ | |
| 156 | 156 | pg_upgradecluster -v 9.6 9.4 main && \ | |
Jan Wagner revised this gist 5 years ago · 7d51c76
1 file changed, 1 insertion, 1 deletion
| @@ -28,7 +28,7 @@ sed -i s/buster/bullseye/g /etc/apt/sources.list* | |||
| 28 | 28 | sed -i "s/ stable/ bullseye/g" /etc/apt/sources.list* | |
| 29 | 29 | sed -i s/buster/bullseye/g /etc/apt/preferences* | |
| 30 | 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* | |
| 31 | + | rename.ul buster bullseye /etc/apt/sources.list.d/*buster* | |
| 32 | 32 | rgrep --color buster /etc/apt/sources.list* | |
| 33 | 33 | apt-get update --allow-releaseinfo-change | |
| 34 | 34 | ||
Jan Wagner revised this gist 5 years ago · b315a63
1 file changed, 1 insertion, 1 deletion
| @@ -30,7 +30,7 @@ sed -i s/buster/bullseye/g /etc/apt/preferences* | |||
| 30 | 30 | sed -i s/buster/bullseye/g /etc/apt/sources.list.d/*buster* | |
| 31 | 31 | rename s/buster/bullseye/g /etc/apt/sources.list.d/*buster* | |
| 32 | 32 | rgrep --color buster /etc/apt/sources.list* | |
| 33 | - | apt-get update | |
| 33 | + | apt-get update --allow-releaseinfo-change | |
| 34 | 34 | ||
| 35 | 35 | # check package status | |
| 36 | 36 | dpkg --audit | |
Jan Wagner revised this gist 5 years ago · 569465e
1 file changed, 1 insertion
| @@ -36,6 +36,7 @@ apt-get update | |||
| 36 | 36 | dpkg --audit | |
| 37 | 37 | aptitude search "~ahold" | grep "^.h" | |
| 38 | 38 | dpkg --get-selections | grep hold | |
| 39 | + | dpkg --get-selections "*" > ~/curr-pkgs.txt | |
| 39 | 40 | ||
| 40 | 41 | # unmark packages auto | |
| 41 | 42 | aptitude unmarkauto vim net-tools && \ | |