summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2013-03-12 23:52:48 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2013-03-13 02:13:32 -0400
commited10318d3760b56e57d5e1bef04ab57761ab8bd1 (patch)
treec02d9640e287042695175d5ccfede1c079d53649
parent71576e054b4d47085f7620749660ca2bf1df47b0 (diff)
enable executing shell functions by invoking common directly.
if you want to just launch a subshell that invokes a single function (e.g. foobar) from monkeysphere's common source, you should now be able to do so with: ${SYSSHAREDIR}/common foobar
-rwxr-xr-xMakefile2
-rwxr-xr-x[-rw-r--r--]src/share/common5
2 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index d281bcb..a37aa8f 100755
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ install: all installman
install src/monkeysphere-authentication $(DESTDIR)$(PREFIX)/sbin
sed -i 's:__SYSSHAREDIR_PREFIX__:$(PREFIX):' $(DESTDIR)$(PREFIX)/sbin/monkeysphere-authentication
install src/monkeysphere-authentication-keys-for-user $(DESTDIR)$(PREFIX)/share/monkeysphere
- install -m 0644 src/share/common $(DESTDIR)$(PREFIX)/share/monkeysphere
+ install -m 0755 src/share/common $(DESTDIR)$(PREFIX)/share/monkeysphere
install -m 0644 src/share/defaultenv $(DESTDIR)$(PREFIX)/share/monkeysphere
sed -i 's:__SYSCONFDIR_PREFIX__:$(ETCPREFIX):' $(DESTDIR)$(PREFIX)/share/monkeysphere/defaultenv
sed -i 's:__SYSDATADIR_PREFIX__:$(LOCALSTATEDIR):' $(DESTDIR)$(PREFIX)/share/monkeysphere/defaultenv
diff --git a/src/share/common b/src/share/common
index f9be05a..508b064 100644..100755
--- a/src/share/common
+++ b/src/share/common
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
# -*-shell-script-*-
# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
@@ -997,3 +998,7 @@ report_cruft() {
printf "The directories above are backups left over from a monkeysphere transition.\nThey may contain copies of sensitive data (host keys, certifier lists), but\nthey are no longer needed by monkeysphere.\nYou may remove them at any time.\n\n" | log info
fi
}
+
+if [ -n "$1" ] && [ "$(type -t "$1" || true)" = "function" ]; then
+ "$@"
+fi