diff options
author | David Phillips <david@sighup.nz> | 2018-07-26 21:33:57 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-07-26 21:33:57 +1200 |
commit | 4048d6f5dbaca8ff078dc4941c55338bea485fc6 (patch) | |
tree | 14be8b1bd7212bbb2c711d4c6d594241fd8f5dff /introspect.sh | |
download | pkg-introspect-4048d6f5dbaca8ff078dc4941c55338bea485fc6.tar.xz |
Add initial rough script
Diffstat (limited to 'introspect.sh')
-rwxr-xr-x | introspect.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/introspect.sh b/introspect.sh new file mode 100755 index 0000000..9ae80ed --- /dev/null +++ b/introspect.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +function get_pkginfo_field() { + local file="$1" + local field="$2" + # FIXME remove dep on GNU tar + tar --to-stdout -xf "$file" .PKGINFO | grep '^'"$field"'' | awk -F' = ' '{print $2}' +} + +function die_usage() { + echo "FIXME" +} + +if [ "$#" -le 2 ]; then + echo Not enough arguments + die_usage +fi + +case "$1" in + "field") + # FIXME must have two more aguments + get_pkginfo_field $2 $3 + ;; + "files") + echo Not implemented + exit 1 + ;; + *) + echo "Unknown action \"$2\"" + die_usage + ;; +esac |