1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps.git synced 2025-03-09 15:50:00 +00:00

Check that update is not running

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-01-07 08:01:34 +01:00
parent f46fd4d47a
commit 3085b2e9a6

View file

@ -39,8 +39,6 @@ umask 0022
export LC_ALL=C
export PATH=$PATH:/sbin
export DEBIAN_FRONTEND=noninteractive
rm -f /var/lib/dpkg/lock
rm -f /var/lib/dpkg/lock-frontend
# Check Linux version
if test -f /etc/os-release ; then
@ -59,6 +57,19 @@ elif [ "$ID" != "debian" ] && [ "$ID" != "ubuntu" ]; then
exit 1
fi
# Check if DPKG is locked and for broken packages
dpkg -i /dev/zero 2>/dev/null
if [ "$?" -eq 2 ]; then
echo "E: dpkg database is locked. Check that an update is not running in background..."
exit 1
fi
apt-get check >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo "E: \`apt-get check\` failed, you may have broken packages. Aborting..."
exit 1
fi
# Fix old string...
if [ -f /etc/motd ] && grep --quiet 'OpenMPCTProuter VPS' /etc/motd ; then
sed -i 's/OpenMPCTProuter/OpenMPTCProuter/g' /etc/motd