diff options
-rw-r--r-- | src/pro-archman.sh | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/pro-archman.sh b/src/pro-archman.sh index 93fa4b5..2e0332e 100644 --- a/src/pro-archman.sh +++ b/src/pro-archman.sh @@ -99,25 +99,23 @@ main() exit 1 fi - mkdir -p "${opt_base_dir}/.db" - lock="${opt_base_dir}/.db/lock" - if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then - printf '%s: Error: ' "${0##*/}" >&2 - printf "$(get_msg 'lock_fail')\n" >&2 - exit 2 - fi - if [ "x${opt_cmd}" != 'x' ]; then run_cmd "${opt_cmd}" "${@}" status=${?} else + mkdir -p "${opt_base_dir}/.db" + lock="${opt_base_dir}/.db/lock" + if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then + printf '%s: Error: ' "${0##*/}" >&2 + printf "$(get_msg 'lock_fail')\n" >&2 + exit 2 + fi get_conf run_cmd "${@}" status=${?} + fini fi - fini - return ${status} } |