From 9c37085f71b3fd7dd182813834c6e8017077f08c Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 12 Nov 2013 11:01:24 +0100 Subject: ship:fix esudo --- ship/lib/core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ship/lib/core') diff --git a/ship/lib/core b/ship/lib/core index 3a6b33ff..e0edc2be 100644 --- a/ship/lib/core +++ b/ship/lib/core @@ -10,7 +10,7 @@ is_root(){ esudo(){ # becomes root with sudo powers # unless nosudo env is set - if test "${nosudo-false}" != true || is_root; then + if test "${nosudo-false}" != true && ! is_root; then echo "we're going sudo..." >&2 exec sudo -E "$0" "$@" exit 23 # go to hell -- cgit v1.2.3 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(+) (limited to 'ship/lib/core') 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 From 235cfb673d84dc151aa502f854e5daaf4487feb8 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 12 Nov 2013 14:43:13 +0100 Subject: ship: trap_add -> defer --- ship/lib/core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ship/lib/core') diff --git a/ship/lib/core b/ship/lib/core index 80be5d2e..1ef1fbf9 100644 --- a/ship/lib/core +++ b/ship/lib/core @@ -8,7 +8,7 @@ is_root(){ test $(id -u) -eq 0 } -trap_add(){ +defer(){ #close enough trapstr="$1;${trapstr:-exit}" trap "$trapstr" INT TERM EXIT KILL -- cgit v1.2.3