Forked from jay-johnson/Downloading all Debian Packages from a Repo
Created
June 19, 2016 07:50
-
-
Save Laxman-SM/a26efce027e1bd593ed5e1d5fd886c58 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