Skip to content

Instantly share code, notes, and snippets.

@Marwe
Created February 7, 2021 11:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marwe/e8ee158eb41360072573357be137c703 to your computer and use it in GitHub Desktop.
Save Marwe/e8ee158eb41360072573357be137c703 to your computer and use it in GitHub Desktop.
Block MS repo on raspbian
#!/bin/bash
# manual rasbian fix 2021-02-06 needed
# if added already, remove ms repos and prevent them being installed on PI with rasbian (done without consent or opt-in)
# https://www.reddit.com/r/rebhu/comments/lcos3c/microsoft_repo_installed_on_all_raspberry_pis/
# https://github.com/RPi-Distro/raspberrypi-sys-mods/issues/41#issuecomment-773220437
for i in /etc/apt/trusted.gpg.d/microsoft.gpg /etc/apt/sources.list.d/vscode.list
do
rm -vf "$i"
touch "$i"
chattr +i "$i"
done
if [ -z "$(grep 'packages\.microsoft\.com' /etc/hosts)" ] ; then
echo "# added by script $0 to prevent packages from microsoft, see https://github.com/RPi-Distro/raspberrypi-sys-mods/issues/42" | tee -a /etc/hosts
echo "# developers are locking down discussion in their space, so consider swithing distro" | tee -a /etc/hosts
echo '0.0.0.1 packages.microsoft.com' | tee -a /etc/hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment