From 9ace44f799343f6746b82c38f2b1d57324f3bf19 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 15 Sep 2018 10:36:47 +0200 Subject: [PATCH] Add qpkg. --- Makefile | 1 + Readme.md | 5 +++++ src/qpkg | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100755 src/qpkg diff --git a/Makefile b/Makefile index be0902c..4cd9742 100644 --- a/Makefile +++ b/Makefile @@ -13,5 +13,6 @@ help: install: install -d -m 755 $(DESTDIR)$(BINDIR) install -m 755 src/cpkg $(DESTDIR)$(BINDIR) + install -m 755 src/qpkg $(DESTDIR)$(BINDIR) install -m 755 src/ipkg $(DESTDIR)$(BINDIR) install -m 755 src/rpkg $(DESTDIR)$(BINDIR) diff --git a/Readme.md b/Readme.md index df1dc47..28f9f99 100644 --- a/Readme.md +++ b/Readme.md @@ -10,6 +10,7 @@ something useful. * zstd * tar * coreutils + * findutils ## Installation ``` bash @@ -28,6 +29,10 @@ mkdir /pkg # folder for storing packages cd build_dir/of/foo cpkg make install # DESTDIR is set by cpkg ``` +**q**ist **p**ac**k**a**g**e version: +``` bash +qpkg foo +``` **i**nstall **p**ac**k**a**g**e: ``` bash diff --git a/src/qpkg b/src/qpkg new file mode 100755 index 0000000..501b3b1 --- /dev/null +++ b/src/qpkg @@ -0,0 +1,21 @@ +#!/bin/bash + +PKGDIR="${FPKG_ROOT}/pkg" + +if [ $# -ne 1 ] +then + echo "Did not specify exactly one argument" + exit 1 +fi + +version=$(find $PKGDIR -regex ".*/$1-[a-z.0-9]*.tar.zst" -type f -printf "%f\n" | sort -V | tail -n 1) + +if [ "$version" = "" ] +then + echo "Package not found" + exit 1 +else + version=${version##*-} + version=${version%.tar.zst} + echo $version +fi