Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jay-johnson/d09e62f2c9bd12e528d7c6f2a9e3ba82 to your computer and use it in GitHub Desktop.
Save jay-johnson/d09e62f2c9bd12e528d7c6f2a9e3ba82 to your computer and use it in GitHub Desktop.
Downloading all Debian Packages from a Repo
#!/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