From dea2e9719dbc7b855292e227696497d8a893193b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 07 Oct 2014 13:13:33 -0400 Subject: session_begin(): Check for /prokit/installing --- 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' -- cgit v0.9.1