fix: sudo does not exist

This commit is contained in:
SunBK201 2023-12-10 17:44:21 +08:00
parent 5bd322f960
commit e73cba9713
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] buf[start+i] = payloadByte[i]
} }
} else { } 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]) dst.Write(buf[0:nr])
io.Copy(dst, src) io.Copy(dst, src)
cache.Add(string(dst.(*net.TCPConn).RemoteAddr().String()), string(dst.(*net.TCPConn).RemoteAddr().String())) 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 if [ -f "ua3f" ]; then
rm "ua3f" 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 fi
chmod ugo+w /var/log chmod ugo+w /var/log

View File

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