summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pro-archman.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/pro-archman.sh b/src/pro-archman.sh
index 732db76..b1accae 100644
--- a/src/pro-archman.sh
+++ b/src/pro-archman.sh
@@ -104,11 +104,7 @@ main()
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
- error 2 "$(get_msg 'lock_fail')"
- fi
+ lock
get_conf
run_cmd "${@}"
status=${?}
@@ -139,6 +135,15 @@ get_options()
return 0
}
+lock()
+{
+ mkdir -p "${opt_base_dir}/.db"
+ lock="${opt_base_dir}/.db/lock"
+ if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then
+ error 2 "$(get_msg 'lock_fail')"
+ fi
+}
+
get_conf()
{
local old_dir=