From e87c01331c147d7a256f9f1d53d05cab8632d808 Mon Sep 17 00:00:00 2001 From: SunBK201 Date: Fri, 29 Dec 2023 21:03:19 +0800 Subject: [PATCH] fix: switch to POSIX-compatible shell --- install.sh | 14 +++++++------- ua3f.service | 8 ++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 76dc636..7f65f54 100755 --- a/install.sh +++ b/install.sh @@ -19,17 +19,17 @@ getcpucore version=0.2.0 ua3f_tar=ua3f-$version-$cpucore.tar.gz -if id -u shellclash &> /dev/null; then - chmod o+w /etc/clash &> /dev/null +if id -u shellclash >/dev/null 2>&1; then + chmod o+w /etc/clash >/dev/null 2>&1 fi if [ -f "ua3f" ]; then rm "ua3f" - killall ua3f &> /dev/null + killall ua3f >/dev/null 2>&1 fi -if ! command -v sudo &> /dev/null; then - opkg update &> /dev/null && opkg install sudo &> /dev/null +if ! command -v sudo >/dev/null 2>&1; then + opkg update >/dev/null 2>&1 && opkg install sudo >/dev/null 2>&1 fi chmod ugo+w /var/log @@ -81,8 +81,8 @@ if [ $? -ne 0 ]; then fi mv controller.lua /usr/lib/lua/luci/controller/ua3f.lua -rm /tmp/luci-modulecache/* &> /dev/null -rm /tmp/luci-indexcache* &> /dev/null +rm /tmp/luci-modulecache/* >/dev/null 2>&1 +rm /tmp/luci-indexcache* >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "Install UA3F Success." diff --git a/ua3f.service b/ua3f.service index bfc56f7..fbcfb1d 100755 --- a/ua3f.service +++ b/ua3f.service @@ -38,13 +38,9 @@ start_service() { procd_set_param stdout 1 procd_set_param stderr 1 - if - id -u shellclash &>/dev/null - then + if id -u shellclash >/dev/null 2>&1; then procd_set_param user shellclash - elif - id -u nobody &>/dev/null - then + elif id -u nobody >/dev/null 2>&1; then procd_set_param user nobody fi