From 85fbaf4d901ccfa61f591cd50b60db7c18dce021 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Thu, 17 Aug 2023 19:44:52 -0600 Subject: [PATCH] Apply lint suggestions --- scripts/install-lib | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/install-lib b/scripts/install-lib index 6899464a4..27c77b040 100644 --- a/scripts/install-lib +++ b/scripts/install-lib @@ -181,7 +181,7 @@ remove-bind-mount() { # # $1 - Full name of the systemd unit, e.g. "draft.service" unit-exists() { - [ $(systemctl --quiet list-unit-files "${1}" | grep "${1}" | wc -l) -eq 1 ] + [ $(systemctl --quiet list-unit-files "${1}" | grep -c "${1}") -eq 1 ] } # Stops and disabled a unit @@ -190,15 +190,15 @@ unit-exists() { # # $1 - Full name of the systemd unit, e.g. "draft.service" disable-unit() { - if ! unit-exists "$1"; then + if ! unit-exists "${1}"; then return fi if is-active "$1"; then - echo "Stopping $1" - systemctl stop "$1" + echo "Stopping ${1}" + systemctl stop "${1}" fi - if is-enabled "$1"; then - echo "Disabling $1" - systemctl disable "$1" + if is-enabled "${1}"; then + echo "Disabling ${1}" + systemctl disable "${1}" fi }