check for dpkg lock, note about mail server

This commit is contained in:
Matthew Saunders Brown 2024-03-14 15:22:09 -07:00
parent fc633b6b9b
commit 2f8c7c4781

View File

@ -9,7 +9,7 @@
# require root # require root
if [ "${EUID}" -ne 0 ]; then if [ "${EUID}" -ne 0 ]; then
echo "This script must be run as root" echo "This script must be run as root."
exit 1 exit 1
fi fi
@ -17,7 +17,14 @@ fi
os_id=`lsb_release -is` os_id=`lsb_release -is`
os_release=`lsb_release -rs` os_release=`lsb_release -rs`
if [ $os_id != Ubuntu ] || [ $os_release != 22.04 ]; then if [ $os_id != Ubuntu ] || [ $os_release != 22.04 ]; then
echo "this installer only runs on Ubuntu 22.04, bailing out" echo "This installer only runs on Ubuntu 22.04, bailing out."
exit 1
fi
if lsof /var/lib/dpkg/lock-frontend ; then
echo "Could not get lock /var/lib/dpkg/lock-frontend"
echo "See output above for info on what is holding the lock."
echo "What for the command above to complete, then re-run this script."
exit 1 exit 1
fi fi
@ -132,3 +139,4 @@ cp sbin/* /usr/local/sbin/
echo "" echo ""
echo "Unattended upgrades & fail2ban are configured to send notifications to $WEBMASTER." echo "Unattended upgrades & fail2ban are configured to send notifications to $WEBMASTER."
echo "Update /etc/apt/apt.conf.d/50unattended-upgrades and /etc/fail2ban/jail.local to suit your needs." echo "Update /etc/apt/apt.conf.d/50unattended-upgrades and /etc/fail2ban/jail.local to suit your needs."
echo "NOTE: No mail server has been installed and emails won't send without one. See the README for more info."