From 656fa81eb9f126434433e2947159a58ae1806f7b Mon Sep 17 00:00:00 2001 From: oxape Date: Fri, 2 Oct 2020 19:15:01 +0800 Subject: [PATCH] Match only whole word `v2ray` in systemd unit files. (#153) Also fix SC2143. Co-authored-by: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> Signed-off-by: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> --- install-release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install-release.sh b/install-release.sh index 061ae21..ffba673 100644 --- a/install-release.sh +++ b/install-release.sh @@ -344,7 +344,7 @@ install_v2ray() { # Used to store V2Ray log files if [[ ! -d '/var/log/v2ray/' ]]; then - if [[ -n "$(id nobody | grep nogroup)" ]]; then + if id nobody | grep -qw 'nogroup'; then install -d -m 700 -o nobody -g nogroup /var/log/v2ray/ install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/access.log install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/error.log @@ -442,7 +442,7 @@ check_update() { } remove_v2ray() { - if [[ -n "$(systemctl list-unit-files | grep 'v2ray')" ]]; then + if systemctl list-unit-files | grep -qw 'v2ray'; then if [[ -n "$(pidof v2ray)" ]]; then stop_v2ray fi @@ -543,7 +543,7 @@ main() { fi # Determine if V2Ray is running - if [[ -n "$(systemctl list-unit-files | grep 'v2ray')" ]]; then + if systemctl list-unit-files | grep -qw 'v2ray'; then if [[ -n "$(pidof v2ray)" ]]; then stop_v2ray V2RAY_RUNNING='1'