Improve startup
- Ubuntu 16.04 (and newer) may run apt tasks automatically on boot - If used as a startup script, apt-get commands could fail due to this - Wait for apt/dpkg lock (up to 60s) as a workaround - Ref: #252
This commit is contained in:
parent
16e437f58e
commit
b7a4bed866
@ -138,6 +138,14 @@ cd /opt/src || exiterr "Cannot enter /opt/src."
|
||||
|
||||
bigecho "Populating apt-get cache..."
|
||||
|
||||
count=0
|
||||
while fuser /var/lib/apt/lists/lock /var/lib/dpkg/lock >/dev/null 2>&1; do
|
||||
[ "$count" -ge "20" ] && exiterr "Cannot get apt/dpkg lock."
|
||||
count=$((count+1))
|
||||
printf %s .
|
||||
sleep 3
|
||||
done
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get -yq update || exiterr "'apt-get update' failed."
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user