mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-11-05 22:19:32 +01:00
000393712e
SVN-Revision: 6651
35 lines
531 B
Bash
35 lines
531 B
Bash
getvar() {
|
|
eval "echo \"\${$1}\""
|
|
}
|
|
|
|
var2file() {
|
|
local var
|
|
eval "var=\"\${$1}\""
|
|
if [ -n "$var" ]; then echo "$var" > "$2"; fi
|
|
}
|
|
|
|
isset() {
|
|
local var
|
|
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
|
|
}
|
|
}
|
|
)}
|
|
|
|
md5s() {
|
|
which md5sum 2>&- >&- && md5sum "$@" | awk '{print $1}' || md5 "$@"
|
|
}
|