summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-07 13:13:33 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-07 13:13:33 (EDT)
commitdea2e9719dbc7b855292e227696497d8a893193b (patch)
tree099b9c780ce6602414fcc03c7f026536f6169d62
parente110fb741bb16bb3c24253d63a259d2a19ee48c3 (diff)
session_begin(): Check for /prokit/installing
-rw-r--r--lib/cmd/build.sh2
-rw-r--r--lib/cmd/opkg.sh2
-rw-r--r--lib/cmd/shell.sh2
-rw-r--r--lib/opkg.sh2
-rw-r--r--lib/session.sh4
-rw-r--r--locale/en_US.sh2
6 files changed, 10 insertions, 4 deletions
diff --git a/lib/cmd/build.sh b/lib/cmd/build.sh
index 2a7f5d2..bbcb837 100644
--- a/lib/cmd/build.sh
+++ b/lib/cmd/build.sh
@@ -80,7 +80,7 @@ cmd_build_main()
package_init "${prev_arg}"
package_set_substvars "${arch}" "${plat}"
- session_begin "${root}" "${prev_arg}" :
+ session_begin "${root}" "${prev_arg}" : false
session_dir="$(session_dir)"
build_deps="$(package_get_build_deps "${arch}" "${plat}")"
diff --git a/lib/cmd/opkg.sh b/lib/cmd/opkg.sh
index 92d4dcb..cc3c623 100644
--- a/lib/cmd/opkg.sh
+++ b/lib/cmd/opkg.sh
@@ -75,7 +75,7 @@ cmd_opkg_main()
. "${root}/etc/os-release"
profile_set "${ID}"
- session_begin "${root}" . :
+ session_begin "${root}" . : false
session_exec opkg "${@}"
session_end
diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh
index 79e8b7a..dfff07f 100644
--- a/lib/cmd/shell.sh
+++ b/lib/cmd/shell.sh
@@ -36,7 +36,7 @@ cmd_shell_main()
. "${root}/etc/os-release"
profile_set "${ID}"
- session_begin "${root}" . :
+ session_begin "${root}" . : false
if [ ${#} -eq 0 ]; then
session_exec /bin/sh
printf '\n'
diff --git a/lib/opkg.sh b/lib/opkg.sh
index 046bc2f..2b942d3 100644
--- a/lib/opkg.sh
+++ b/lib/opkg.sh
@@ -27,7 +27,7 @@ opkg_install_all()
{
local root="${1}"
- session_begin "${root}" . :
+ session_begin "${root}" . : true
session_exec /bin/sh -c \
'opkg install $(opkg list-installed | cut -d " " -f 1)'
session_end
diff --git a/lib/session.sh b/lib/session.sh
index 5aad176..64954b5 100644
--- a/lib/session.sh
+++ b/lib/session.sh
@@ -39,6 +39,7 @@ session_begin()
local root="${1}"
local mountdir="${2}"
local atexit="${3}"
+ local installing="${4}"
rand
session_id=${rand_x}
@@ -49,6 +50,9 @@ session_begin()
session_atexit="${atexit}"
[ -d "${session_root}/prokit" ] || mkdir "${session_root}/prokit"
+ if [ -f "${session_root}/prokit/installing" ] && ! ${installing}; then
+ error 2 "$(get_msg 'install_running')"
+ fi
if ! mutex_lock_timeout "${session_root}/prokit/sessions.lock" 5; then
error 2 "$(get_msg 'cant_lock_sessions')"
diff --git a/locale/en_US.sh b/locale/en_US.sh
index 703f125..75cc1d1 100644
--- a/locale/en_US.sh
+++ b/locale/en_US.sh
@@ -45,6 +45,8 @@ msg_prokit_control_missing_fields='missing fields: %s'
# lib/session.sh
msg_prokit_cant_lock_sessions='Cannot acquire sessions state lock'
+msg_prokit_install_running='Another instance of prokit is installing this '\
+'system'
# lib/rand.sh
msg_prokit_rand_bad_x='Invalid random number generator seed value'