summaryrefslogtreecommitdiff
path: root/introspect.sh
blob: 9ae80edcf27a578e67232e2ab026bff3af6d0299 (plain)
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
30
31
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