From a5aa4edffdd86a9edf884c08b29cf8c4da13b44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 29 Dec 2020 00:50:54 +0100 Subject: [PATCH] installer.sh: Properly check for enabled ModemManager service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A systemd service may be marked as enabled as vendor preset, and this breaks the check we used to check if it was active. Here's what you get in an Ubuntu 20.04 installation: ❯ sudo systemctl status ModemManager ● ModemManager.service - Modem Manager Loaded: loaded (/lib/systemd/system/ModemManager.service; disabled; vendor preset: enabled) Active: inactive (dead) ❯ systemctl list-unit-files ModemManager.service UNIT FILE STATE VENDOR PRESET ModemManager.service disabled enabled 1 unit files listed While the list-unit-files can be filtered using `--state=enabled`, we can just rely on `systemctl is-enabled` instead. --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index e019c0c..e0757d4 100644 --- a/installer.sh +++ b/installer.sh @@ -63,7 +63,7 @@ if [ ! -z "${MISSING_PACKAGES}" ]; then fi # Check if Modem Manager is enabled -if systemctl list-unit-files ModemManager.service | grep enabled > /dev/null 2>&1; then +if systemctl is-enabled ModemManager.service &> /dev/null; then warn "ModemManager service is enabled. This might cause issue when using serial devices." fi