mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-11 06:56:58 +02:00
Avoid problems where PW prompt in enter_chroot.sh would block other terminals.
Change-Id: Ibd32a4be12e88d183dd0acbcb156582ad946c92f BUG=chromium-os:11602 TEST=Added a 'sudo -K' as the first line of teardown_env to simulate sudo timeout, then performed steps in bug report (without 15 minute wait). Review URL: http://codereview.chromium.org/6250116
This commit is contained in:
parent
79088f496e
commit
a8d9cc18b0
@ -125,6 +125,10 @@ sudo chmod 0777 "$FLAGS_chroot/var/lock"
|
||||
LOCKFILE="$FLAGS_chroot/var/lock/enter_chroot"
|
||||
|
||||
function setup_env {
|
||||
# Validate sudo timestamp before entering the critical section so that we
|
||||
# don't stall for a password while we have the lockfile.
|
||||
sudo -v
|
||||
|
||||
(
|
||||
flock 200
|
||||
echo $$ >> "$LOCKFILE"
|
||||
@ -232,6 +236,10 @@ function setup_env {
|
||||
}
|
||||
|
||||
function teardown_env {
|
||||
# Validate sudo timestamp before entering the critical section so that we
|
||||
# don't stall for a password while we have the lockfile.
|
||||
sudo -v
|
||||
|
||||
# Only teardown if we're the last enter_chroot to die
|
||||
(
|
||||
flock 200
|
||||
|
Loading…
Reference in New Issue
Block a user