fix: sudo does not exist

This commit is contained in:
SunBK201 2023-12-10 17:44:21 +08:00
parent 634925e7e0
commit 27f05d125c
3 changed files with 11 additions and 7 deletions

View File

@ -220,7 +220,7 @@ func CopyPileline(dst io.Writer, src io.Reader) {
buf[start+i] = payloadByte[i]
}
} else {
logrus.Debug(fmt.Sprintf("[%s] Not found User-Agent", string(parser.Host())))
logrus.Debug(fmt.Sprintf("[%s] Not found User-Agent, Add LRU Relay Cache", string(parser.Host())))
dst.Write(buf[0:nr])
io.Copy(dst, src)
cache.Add(string(dst.(*net.TCPConn).RemoteAddr().String()), string(dst.(*net.TCPConn).RemoteAddr().String()))

View File

@ -21,7 +21,11 @@ ua3f_tar=ua3f-$version-$cpucore.tar.gz
if [ -f "ua3f" ]; then
rm "ua3f"
killall ua3f >/dev/null 2>&1
killall ua3f &> /dev/null
fi
if ! command -v sudo &> /dev/null then
opkg update &> /dev/null && opkg install sudo &> /dev/null
fi
chmod ugo+w /var/log

View File

@ -4,12 +4,12 @@ START=99
start() {
echo "ua3f is starting"
if id -u shellclash >/dev/null 2>&1; then
sudo -u shellclash /root/ua3f >/dev/null 2>&1 &
elif id -u nobody >/dev/null 2>&1; then
sudo -u nobody /root/ua3f >/dev/null 2>&1 &
if id -u shellclash &> /dev/null; then
sudo -u shellclash /root/ua3f &> /dev/null &
elif id -u nobody &> /dev/null; then
sudo -u nobody /root/ua3f &> /dev/null &
else
/root/ua3f >/dev/null 2>&1 &
/root/ua3f &> /dev/null &
fi
}