1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #!/bin/bash
get_all_depends() { apt-cache depends --no-pre-depends --no-suggests --no-recommends \ --no-conflicts --no-breaks --no-enhances\ --no-replaces --recurse $1 | awk '{print $2}'| tr -d '<>' | sort --unique }
for pkg in $* do all_depends=$(get_all_depends $pkg) echo "所有依赖共计"$(echo $all_depends | wc -w)"个" echo $all_depends i=0 for depend in $all_depends do i=$((i+1)) echo "\033[1;32m正在下载第$i个依赖:"$depend "\033[0m" apt-get download $depend done apt-get download $pkg done
|