Created
May 27, 2023 14:51
-
-
Save InvisibleRain/d88434eb698f24050291a02918605abd to your computer and use it in GitHub Desktop.
Download package dependecies recursively on debian-like systems
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 | |
set -e | |
# If argument is non-empty and the package exitst | |
if [[ -n $1 ]] && [[ $(apt show $1) ]]; then | |
dir=$HOME/$1 | |
#rm -rf $dir # Uncomment for development | |
mkdir $dir | |
cd $dir | |
apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances $1 | \ | |
grep "^\w" | \ | |
sort -u | \ | |
sudo xargs apt-get download | |
sudo chown $USER * | |
echo -e "\n\nDownloaded all deps into $dir" | |
# Return to the previous dir | |
cd - > /dev/null | |
else | |
echo 'usage: "./download-deps.sh package-name"' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment