Last active
May 1, 2017 15:48
-
-
Save sublimino/7fdcfac9bb3d8c582ab1ee8a618e86b6 to your computer and use it in GitHub Desktop.
update-debian-to-testing.sh
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
#!/bin/bash | |
set -euo pipefail | |
OUTFILE=/tmp/fastest-sources.list | |
ARCHITECTURES=$(printf "$( | |
dpkg --print-architecture | |
dpkg --print-foreign-architectures | |
)") | |
NS_ARCH_OPTIONS=$(echo "${ARCHITECTURES}" | sed -E 's#(.*)#--arch \1#' | tr '\n' ' ') | |
cp -a /etc/apt/sources.list ~/sources.list.bak | |
sudo apt install apt-listbugs apt-listchanges netselect-apt -t testing | |
sudo netselect-apt testing ${NS_ARCH_OPTIONS} --outfile "${OUTFILE}" --nonfree --sources | |
SOURCES=$(sed -E '/^#|^$/d' "${OUTFILE}") | |
( | |
for REPO in testing unstable; do | |
echo "${SOURCES}" | sed "s#testing#${REPO}#" | sed -E "s/^(deb(-src)?)/\1 [arch=$(printf "${ARCHITECTURES}" | tr '\n' ',')]/" | |
echo | |
done | |
echo "deb http://security.debian.org/ testing/updates main contrib non-free" | |
echo "deb-src http://security.debian.org/ testing/updates main contrib non-free" | |
) | sudo tee /etc/apt/sources.list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment