Created
January 31, 2021 08:34
-
-
Save fakhamatia/edb7f5ac3d7876b05a46b7b0e97bf910 to your computer and use it in GitHub Desktop.
Find URL of dependencies of a package
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 | |
packageName=$1 | |
apt-get install $packageName --print-uris | grep "'" | awk '{print $1}' | sed "s/'//g" | sed -e 's/^/wget /' >"${packageName}_URL.sh" | |
numPacks=$(wc -l "${packageName}_URL.sh" | awk '{ print $1 }') | |
if [ $numPacks == "1" ]; then | |
echo "No needed any depends packages." | |
elif [ $numPacks == "0" ]; then | |
echo "ERROR: Failed to find any URL for $packageName. Please check the package" | |
rm "${packageName}_URL.sh" | |
exit 1 | |
fi | |
echo " $numPacks packages need to install $packageName " | |
sed -i -e '1i#!/bin/bash\' "${packageName}_URL.sh" | |
chmod u+x "${packageName}_URL.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment