Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Laxman-SM/a26efce027e1bd593ed5e1d5fd886c58 to your computer and use it in GitHub Desktop.
Save Laxman-SM/a26efce027e1bd593ed5e1d5fd886c58 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