summaryrefslogtreecommitdiffstats
path: root/ship/lib/core
diff options
context:
space:
mode:
Diffstat (limited to 'ship/lib/core')
-rw-r--r--ship/lib/core7
1 files changed, 7 insertions, 0 deletions
diff --git a/ship/lib/core b/ship/lib/core
index e0edc2be..80be5d2e 100644
--- a/ship/lib/core
+++ b/ship/lib/core
@@ -2,9 +2,16 @@
msg() { printf "$@\n" >&2 ;}
info() { msg "** $@" ;}
error() { msg "!! $@" ;}
+die() { error "$@" ;exit 1;}
exists(){ type "$1" >/dev/null 2>/dev/null; }
is_root(){
test $(id -u) -eq 0
+}
+
+trap_add(){
+ #close enough
+ trapstr="$1;${trapstr:-exit}"
+ trap "$trapstr" INT TERM EXIT KILL
}
esudo(){