Skip to content

Instantly share code, notes, and snippets.

@amoilanen
Created October 21, 2016 17:38
Show Gist options
  • Save amoilanen/11a62661689859957281897202e352f1 to your computer and use it in GitHub Desktop.
Save amoilanen/11a62661689859957281897202e352f1 to your computer and use it in GitHub Desktop.
Cleans up accidentally added ubuntu repos from the apt sources list in Debian
#Cleans up accidentally added Ubuntu repositories from the Debian's repository list
#!/bin/bash
sourcesDir=/etc/apt/sources.list.d
fileNames=$(ls $sourcesDir)
for fileName in $fileNames
do
fullFilePath=$sourcesDir/$fileName
fileSourcesList=$(cat $fullFilePath)
if [[ "$fileSourcesList" =~ "ubuntu" ]]
then
echo "$fullFilePath contains Ubuntu repositories, will be removed"
rm -f $fullFilePath
else
echo "$fullFilePath does not contain Ubuntu repositories"
fi
done
echo "DONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment