Files
be.ems/tools/misc/downpkg.sh
2023-10-18 10:26:12 +08:00

26 lines
657 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
#$1 pkg
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 -e "所有依赖共计"$(echo $all_depends | wc -w)"个"
echo $all_depends
i=0
for depend in $all_depends
do
i=$((i+1))
echo -e "\033[1;32m正在下载第$i个依赖"$depend "\033[0m"
apt-get download $depend
done
done