Skip to content

Instantly share code, notes, and snippets.

@mcg
Last active December 14, 2015 15:58
Show Gist options
  • Save mcg/5111523 to your computer and use it in GitHub Desktop.
Save mcg/5111523 to your computer and use it in GitHub Desktop.
Are my PPA's current? Now with color
!/bin/bash
#read distro from option
dist=$1
#if option is missing, use /etc/lsb-release
if [[ ${dist} = "" ]]
then
dist=$(grep "DISTRIB_CODENAME" /etc/lsb-release | cut -f 2 -d"=")
fi
ppa_urls=$(for i in $(ls /etc/apt/sources.list.d/*.list); do grep -e"^#\sdeb" ${i}| grep -v src | sed 's/# //' |cut -f 2 -d" "; done)
for i in ${ppa_urls}
do
found_ppa=$(curl -s "$i/dists/" | grep ${dist})
if [[ ${found_ppa} =~ .*"$dist".* ]]
then
echo -e "\e[1;34mPPA for ${dist} found: ${i}\e[0m"
else
echo -e "\e[1;31m$i ${dist} not found\e[0m"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment