fixing script

This commit is contained in:
afeiszli 2021-11-16 14:18:41 -05:00
parent 1a16e5ad25
commit b42568a7ce

View file

@ -17,7 +17,7 @@ elif [ -f /etc/centos-release ]; then
install_cmd='yum install -y' install_cmd='yum install -y'
elif [ -f /etc/fedora-release ]; then elif [ -f /etc/fedora-release ]; then
install_cmd='dnf install -y' install_cmd='dnf install -y'
elif [ OS == "FreeBSD" ]; then elif [ "${OS}" = "FreeBSD" ]; then
install_cmd='pkg install -y' install_cmd='pkg install -y'
else else
install_cmd='' install_cmd=''
@ -31,7 +31,7 @@ dependencies="wireguard"
set -- $dependencies set -- $dependencies
while [ -n "$1" ]; do while [ -n "$1" ]; do
echo $1 echo $1
if [ OS == "FreeBSD" ]; then if [ "${OS}" = "FreeBSD" ]; then
is_installed=$(pkg check -d $1 | grep '100%') is_installed=$(pkg check -d $1 | grep '100%')
if [ "${is_installed}" = '100%' ]; then if [ "${is_installed}" = '100%' ]; then
echo " " $1 is installed echo " " $1 is installed
@ -161,20 +161,20 @@ else
fi fi
chmod +x netclient chmod +x netclient
EXTRA_ARGS = "" EXTRA_ARGS=""
if [ OS == "FreeBSD" ]; then if [ "${OS}" = "FreeBSD" ]; then
EXTRA_ARGS = "--daemon=off" EXTRA_ARGS = "--daemon=off"
fi fi
if [ -z "${NAME}" ]; then if [ -z "${NAME}" ]; then
sudo ./netclient join -t $KEY EXTRA_ARGS sudo ./netclient join -t $KEY $EXTRA_ARGS
else else
sudo ./netclient join -t $KEY --name $NAME EXTRA_ARGS sudo ./netclient join -t $KEY --name $NAME $EXTRA_ARGS
fi fi
rm -f netclient rm -f netclient
if [ OS == "FreeBSD" ]; then if [ "${OS}" = "FreeBSD" ]; then
tee /usr/local/etc/rc.d/netclient <<'EOF' >/dev/null tee /usr/local/etc/rc.d/netclient <<'EOF' >/dev/null
#!/bin/sh #!/bin/sh
@ -197,4 +197,4 @@ run_rc_command "$1"
EOF EOF
/usr/local/etc/rc.d/netclient enable /usr/local/etc/rc.d/netclient enable
/usr/local/etc/rc.d/netclient start /usr/local/etc/rc.d/netclient start
fi fi