Created
April 27, 2016 21:08
-
-
Save jay-johnson/d09e62f2c9bd12e528d7c6f2a9e3ba82 to your computer and use it in GitHub Desktop.
Downloading all Debian Packages from a Repo
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 | |
repo="<DEBIAN REPO FQDN>" | |
outputDir="<DIRECTORY TO STORE DEBIAN FILES>" | |
arch="<ARCH like binary-i386 or binary-amd64>" | |
echo "Download All Debs from Repository($repo) to dir($outputDir)" | |
pushd $outputDir >> /dev/null | |
packagenames=`wget -q -O - http://$repo/pool/main/h | grep deb | grep href | sed -e 's/\/"/ /g' | sed -e 's/"/ /g' | awk '{print $3}'` | |
for i in $packagenames | |
do | |
echo "Downloading($i)" | |
wget http://$repo/pool/main/h/$i/$(wget -q -O - http://$repo/pool/main/h/$i | grep "<a href=" | grep $arch | sed -e 's/"/ /g' | awk '{print $3}') | |
done | |
popd >> /dev/null | |
echo "" | |
echo "Done Downloading All Debs from Repository($repo) to dir($outputDir)" | |
ls $outputDir | |
echo "" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment