From fb71eec28c092e3c0be866fe52cb89d2c06d9ba8 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 14 Apr 2022 15:22:22 -0400 Subject: make it easier to run sbopkglint without installing it --- Makefile | 9 +++++---- README | 4 ++++ sbopkglint | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index baa5ab8..7351f2d 100644 --- a/Makefile +++ b/Makefile @@ -20,14 +20,15 @@ all: @echo "Use 'make install PREFIX=' to install $(PROJ)." install: man - install -d -oroot -groot -m0755 \ + install -d -m0755 \ $(DESTDIR)$(TESTDIR) \ $(DESTDIR)$(BINDIR) \ $(DESTDIR)$(MAN1DIR) \ $(DESTDIR)$(DOCDIR) - install -oroot -groot -m0755 $(SCRIPTS) $(DESTDIR)$(BINDIR)/ - install -oroot -groot -m0644 sbopkglint.d/* $(DESTDIR)$(TESTDIR)/ - install -oroot -groot -m0644 $(DOCS) $(DESTDIR)$(DOCDIR)/ + install -m0755 $(SCRIPTS) $(DESTDIR)$(BINDIR)/ + sed -i 's,@PREFIX@,$(PREFIX),' $(DESTDIR)$(BINDIR)/sbopkglint + install -m0644 sbopkglint.d/* $(DESTDIR)$(TESTDIR)/ + install -m0644 $(DOCS) $(DESTDIR)$(DOCDIR)/ gzip -9c < sbolint.1 > $(DESTDIR)$(MAN1DIR)/sbolint.1.gz gzip -9c < sbopkglint.1 > $(DESTDIR)$(MAN1DIR)/sbopkglint.1.gz diff --git a/README b/README index ed255c2..899e26d 100644 --- a/README +++ b/README @@ -39,6 +39,10 @@ You can also run sbolint and sbopkglint directly from the source directory (e.g. ./sbopkglint), if you can think of a reason for that (maybe you're hacking on the tests). +If you want, you can just symlink sbolint and sbopkglint to some +directory in your $PATH (e.g. if you keep your local scripts in +~/bin). + Git Hook: To use the git hook, copy pre-commit-sbolint to .git/hooks/pre-commit diff --git a/sbopkglint b/sbopkglint index 970816c..6409fc4 100755 --- a/sbopkglint +++ b/sbopkglint @@ -409,8 +409,20 @@ while true; do esac done -# where the test scripts live, space-separated list. -SBOPKGLINT_PATH=${SBOPKGLINT_PATH:-"./sbopkglint.d /usr/share/sbo-maintainer-tools/sbopkglint.d /usr/local/share/sbo-maintainer-tools/sbopkglint.d"} +# where the test scripts live, space-separated list. to allow for +# running sbopkglint from within its own directory, without installing it, +# check for a sbopkglint.d in the script's dir. +script_dir="$( dirname $( realpath $0 ) )" + +# this line gets modified by 'make install'. +prefix_dir="@PREFIX@" + +case "$prefix_dir" in + @*) ;; # unset, don't use. + *) prefix_script_dir+=" $prefix_dir/share/sbo-maintainer-tools/sbopkglint.d" +esac + +SBOPKGLINT_PATH=${SBOPKGLINT_PATH:-"$script_dir/sbopkglint.d $prefix_script_dir"} if [ "$(id -u)" != "0" ]; then exec sudo \ -- cgit v1.2.3