From 4048d6f5dbaca8ff078dc4941c55338bea485fc6 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 26 Jul 2018 21:33:57 +1200 Subject: Add initial rough script --- LICENCE | 18 ++++++++++++++++++ introspect.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 LICENCE create mode 100755 introspect.sh diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..7be4529 --- /dev/null +++ b/LICENCE @@ -0,0 +1,18 @@ +/************************************************************************ + * pkg-introspect * + * (C) Copyright 2018 David Phillips * + * * + * pkg-introspect is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * pkg-introspect is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with pkg-introspect. If not, see * + * . * + ************************************************************************/ 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 -- cgit v1.1