* updated suricata (7.0.6 -> 7.0.7)
[t2sde.git] / misc / archive / showdeps.sh
bloba11d5361ad4b41d9cc99acc12afcc4f2a8d087ab
1 #!/bin/sh
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 #
5 # T2 SDE: misc/archive/showdeps.sh
6 # Copyright (C) 2004 - 2005 The T2 SDE Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 root=
18 usage() {
19 cat <<EOT
20 usage: $0 [-root <root>] [<pkg>]+
21 EOT
24 getdeps() {
25 if [ -f package/*/$1/$1.cache ]; then
26 grep -e "^\[DEP\]" package/*/$1/$1.cache | cut -d' ' -f2- | tr '\n' ' '
27 else
28 echo "unknown"
31 getprio() {
32 local prio=
33 if [ -f package/*/$1/$1.desc ]; then
34 prio=`sed -n -e "s,^\[P\] . .* \(.*\),\1,p" package/*/$1/$1.desc`
37 [ -n "$prio" ] && echo "$prio" || echo "---.---"
39 pkginstalled() {
40 [ -f $root/var/adm/packages/$1 ]
43 digdeps() {
44 local deep="$1" pkg="$2" prefix="$3"
45 local cache="$4" banner= dep=
47 [ $deep -eq 0 ] && return 0
48 (( deep-- ))
50 banner="$pkg($( getprio $pkg ))"
52 if pkginstalled $pkg; then
53 banner="$banner+"
54 else
55 banner="$banner-"
58 echo -e "$prefix$banner"
59 for dep in $( getdeps $pkg ); do
60 if [ "$dep" == "unknown" ]; then
61 echo -e "$prefix$banner\tNODEPS"
62 elif [ -z "$(echo "$cache" | grep ":$dep:" )" ]; then
63 digdeps $deep $dep "$prefix$banner\t" "$cache$pkg:"
65 done
68 while [ $# -ne 0 ]; do
69 case "$1" in
70 -root) root=$2
71 shift ;;
72 -*) echo "ERROR: Option $1 is not recognized."
73 usage; exit 1 ;;
75 break;
76 esac
77 shift
78 done
80 for pkg; do
81 if [ -f package/*/$pkg/$pkg.desc ]; then
82 digdeps 2 $pkg '' ':'
83 else
84 echo "ERROR: '$pkg' not found!" 1>&2
86 done