Advertisement
metalx1000

Get and extract Debian packages and dependencies

Jun 23rd, 2015
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. dir="debs"
  4.  
  5. if [ "$#" -lt 1 ]
  6. then
  7.   echo "usage: $0 <package>"
  8.   exit
  9. fi
  10.  
  11. mkdir -p "$dir"
  12. cd "$dir"
  13.  
  14. #get packages
  15. deps="$(apt-cache depends $1|grep "Depends:"|awk '{print $2}'|tr '\n' ' ')"
  16. apt-get --print-uris --reinstall --yes install $1 $deps| grep ^\' | cut -d\' -f2|
  17. while read url
  18. do
  19.   wget -c "$url"
  20. done
  21.  
  22. #extract packages
  23. for i in *.deb;
  24. do
  25.   ar vx "$i"
  26.   tar xzvf data.tar.gz
  27.   tar xJvf data.tar.xz
  28.   rm data.tar.* control.tar.gz debian-binary $i
  29. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement