diff options
author | Felix Fietkau <nbd@openwrt.org> | 2006-11-27 04:25:34 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2006-11-27 04:25:34 +0000 |
commit | 387570cc06ab3aca5824f1856b50a5e3ae5c2dc7 (patch) | |
tree | e6fb09b1dc1a0712bb7de1a20fab3a19853fd099 /include/shell.sh | |
parent | a1ac6d1d9f89278cbd65cbb4b46481e63a29159a (diff) | |
download | mtk-20170518-387570cc06ab3aca5824f1856b50a5e3ae5c2dc7.zip mtk-20170518-387570cc06ab3aca5824f1856b50a5e3ae5c2dc7.tar.gz mtk-20170518-387570cc06ab3aca5824f1856b50a5e3ae5c2dc7.tar.bz2 |
trap chmod errors in tar unpack on bsd - modes like 02755 fail
SVN-Revision: 5656
Diffstat (limited to 'include/shell.sh')
-rw-r--r-- | include/shell.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/shell.sh b/include/shell.sh index 6ee0cf6..1e60692 100644 --- a/include/shell.sh +++ b/include/shell.sh @@ -13,3 +13,18 @@ isset() { eval "var=\"\${$1}\"" [ -n "$var" ] } + +trapret() {( + local retvals="$1"; shift + local cmd="$1"; shift + for retval in $(echo $retvals); do + local trap_$retval=1 + done + "$cmd" "$@" || { + local retval="$?" + eval "trapped=\${trap_$retval}" + [ -n "$trapped" ] || { + return $retval + } + } +)} |