Created
August 6, 2023 13:33
-
-
Save jaka/70c835ff6f48b642dfefe62ed40a935c to your computer and use it in GitHub Desktop.
Upgrade to Debian Bookworm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /var/lib/apt/lists/ -mindepth 1 -maxdepth 1 -type f -size +0 -print -delete | |
file=/etc/apt/sources.list | |
if [ -f "$file" ]; then | |
owner=$(stat -c %U:%G "$file") | |
perms=$(stat -c %a "$file") | |
mv -v "$file" "$file.$(date +%y%m%d%H%M%S)" | |
fi | |
[ -z "$owner" ] || owner="root:root" | |
[ -z "$perms" ] || perms=644 | |
cat <<EOF >"$file" | |
deb http://deb.debian.org/debian/ bookworm main | |
deb http://security.debian.org/debian-security bookworm-security main | |
deb http://deb.debian.org/debian/ bookworm-updates main | |
EOF | |
chown $owner "$file" | |
chmod $perms "$file" | |
apt-get update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment