fetch_ppa.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # Trusty=14.04, Precise=12.04
  3. PPA_DISTRO=trusty
  4. # Architecture=i386, amd64
  5. PPA_ARCH=amd64
  6. # These shouldn't change
  7. PPA_HOST=http://ppa.launchpad.net
  8. PPA_USER=tobydox
  9. PPA_PROJECT=mingw-x-trusty
  10. PPA_ROOT=$PPA_HOST/$PPA_USER/$PPA_PROJECT/ubuntu
  11. PPA_URL=$PPA_ROOT/dists/$PPA_DISTRO/main/binary-$PPA_ARCH/Packages.gz
  12. ppa_dir=./ppa/
  13. temp_file=/tmp/ppa_listing_$$
  14. temp_temp_file=/tmp/ppa_listing_temp_$$
  15. skip_files="binutils openssl flac libgig libogg libvorbis x-bootstrap zlib"
  16. skip_files="$skip_files x-runtime gcc qt_4 qt5 x-stk pkgconfig"
  17. skip_files="$skip_files glib2 libpng"
  18. echo "Connecting to $PPA_URL to get list of packages..."
  19. wget -qO- $PPA_URL | gzip -d -c | grep "Filename:" > $temp_file
  20. for j in $skip_files ; do
  21. grep -v "$j" $temp_file > $temp_temp_file
  22. mv $temp_temp_file $temp_file
  23. done
  24. line_count=$(wc -l $temp_file |awk '{print $1}')
  25. echo "Found $line_count packages for download..."
  26. echo "Downloading packages. They will be saved to $ppa_dir"
  27. mkdir $ppa_dir
  28. while read -r j
  29. do
  30. echo "Downloading $j..."
  31. echo "$PPA_ROOT/$j"
  32. wget -qO "$ppa_dir$(basename "$j")" "$(echo "$PPA_ROOT/$j" | sed 's/\/Filename: /\//gi')"
  33. done < $temp_file
  34. echo "Cleaning up temporary files..."
  35. rm -rf $temp_file
  36. echo "Packages have been saved to $ppa_dir. Please run extract_debs.sh"