summaryrefslogtreecommitdiffstats
path: root/ship/lib/core
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-11-12 12:08:29 +0100
committermakefu <github@syntax-fehler.de>2013-11-12 12:08:29 +0100
commit5e85a920a6c9ee68e1171f27d816151d8825b78a (patch)
tree6810a2843000915c604dd5d645e1e3aa4e555c8c /ship/lib/core
parent16e39cc6a98977cc731abc19069b79aa9918654d (diff)
ship:core contains trap_add
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(){