Created
October 21, 2016 17:38
-
-
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
This file contains hidden or 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
#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