Last active
May 18, 2021 15:31
-
-
Save noahbliss/65345476671ab2a6f719526094f1db8d to your computer and use it in GitHub Desktop.
Debian APT Priority w/ Security Updates
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
# Taken from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725934 | |
# https://git.io/Jsgoj <- short url for this as raw | |
apt-get install debsecan | |
echo "Compare these sources.list files and implement...creating: /etc/apt/sources.list.new" | |
cat <<'EOF' > /etc/apt/sources.list.new | |
# Testing | |
deb http://deb.debian.org/debian/ testing main contrib non-free | |
deb-src http://deb.debian.org/debian/ testing main contrib non-free | |
deb http://security.debian.org/debian-security testing-security main contrib non-free | |
deb-src http://security.debian.org/debian-security testing-security main contrib non-free | |
# Unstable | |
deb http://deb.debian.org/debian/ unstable main contrib non-free | |
deb-src http://deb.debian.org/debian/ unstable main contrib non-free | |
# Experimental | |
deb http://deb.debian.org/debian/ experimental main contrib non-free | |
deb-src http://deb.debian.org/debian/ experimental main contrib non-free | |
EOF | |
cat <<'EOF' > /etc/apt/preferences.d/system | |
Package: * | |
Pin: release a=testing | |
Pin-Priority: 800 | |
Package: * | |
Pin: release a=unstable | |
Pin-Priority: 700 | |
Package: * | |
Pin: release a=experimental | |
Pin-Priority: 600 | |
EOF | |
cat <<'FFF' > /etc/apt/apt.conf.d/99debsecan | |
APT::Update::Pre-Invoke { "/usr/local/sbin/debsecan-apt-priority"; }; | |
FFF | |
cat <<'FFF' > /usr/local/sbin/debsecan-apt-priority | |
#!/bin/sh | |
set -e | |
# https://bugs.debian.org/725934 | |
rm -f /var/lib/debsecan/apt_preferences.disabled | |
> /var/lib/debsecan/apt_preferences.disabled | |
for pkg in $(debsecan | grep -E '\(fixed(\)|, )' | cut -d\ -f2 | sort -u) ; do | |
case "$pkg" in | |
*-dbgsym) | |
cat <<EOF >> /var/lib/debsecan/apt_preferences.disabled | |
Package: $pkg | |
Pin: release a=unstable-debug | |
Pin-Priority: 900 | |
EOF | |
;; | |
*) | |
cat <<EOF >> /var/lib/debsecan/apt_preferences.disabled | |
Package: $pkg | |
Pin: release a=unstable | |
Pin-Priority: 900 | |
EOF | |
;; | |
esac | |
done | |
chmod 644 /var/lib/debsecan/apt_preferences.disabled | |
mv --force /var/lib/debsecan/apt_preferences.disabled /var/lib/debsecan/apt_preferences | |
FFF | |
chmod +x /usr/local/sbin/debsecan-apt-priority |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment