blob: 4c4a0400638c57ecfca03c12b88bfd62c1ae5181 (
plain)
1 #!/bin/bash
2 #
3 # Print a list of files to download, formatted in one of three ways:
4 # - the files required to install a specified package
5 # - the files required to install a package and all its dependencies
6 # (even dependencies that are already present on the system)
7 # - all files required to update your system
8 #
9 # version 1.0 by Johannes Winkelmann, updated 2021-06 by John McQuah
10
11 version=1.1
12
13 args=()
14 for a in $@; do
15 if [ $a == "--all" ]; then
16 ALL="yes"
17 elif [ $a == "--diff" ]; then
18 DIFF="yes"
19 else
20 args=(${args[*]} $a)
21 fi
22 done
23
24 if [ "$args" = "" ] && [ ! "$DIFF" = "yes" ]; then
25 echo "Usage: `basename $0` <port1> [<port2> ...]"
26 echo " `basename $0` --all <port1> [<port2> ...]"
27 echo " `basename $0` --diff"
28 exit -1
29 fi
30
31
32
33 if [ "$DIFF" = "yes" ]; then
34 list=(`prt-get quickdiff`)
35 elif [ "$ALL" = "yes" ]; then
36 list=(`prt-get quickdep ${args[*]}`)
37 else
38 wlist=(${args[*]} `prt-get depends ${args[*]} | grep "\[ "|awk '{print $3}'`)
39 list=(`echo "${wlist[*]}" | sort | uniq`)
40 fi
41
42 SRCGLOB=$(grep PKGMK_SOURCE_DIR /etc/pkgmk.conf | sed 's/^\s*#// ; s/.*=//; s/\"//g')
43
44 for l in ${list[*]}; do
45 PORTDIR=`prt-get path $l`
46 . $PORTDIR/Pkgfile
47 SAVELOC=`eval printf '%s' "$SRCGLOB"`
48 for (( p=0; p<${#source[@]}; p++ )) ; do
49 if [[ ${source[$p]} =~ ^(http|ftp|https): ]]; then
50 if [ -n "${renames[$p]}" -a "${renames[$p]}" != "SKIP" ]; then
51 FILE=${renames[$p]}
52 else
53 FILE=$(echo "${source[$p]}" | sed 's,.*/,,')
54 fi
55 [ -e ${SAVELOC:-$PORTDIR}/$FILE ] || echo ${source[$p]}
56 fi
57 done
58 done
|