From 5e85a920a6c9ee68e1171f27d816151d8825b78a Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 12 Nov 2013 12:08:29 +0100 Subject: ship:core contains trap_add --- ship/lib/core | 7 +++++++ 1 file changed, 7 insertions(+) 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(){ -- cgit v1.2.3