#!/bin/bash

# 升级syspress插件
xycall installurl  "http://tw06d0006.onething.net/lxs/output/plugin-syspress_0.6.6_xybm.ipk"
sleep 10
syspress_local_ver=$(xycall info plugin-syspress | jq -r .local_version)
[ "$(printf '%s\n' "0.6.6" "${syspress_local_ver}" | sort -V | tail -n 1)" == "0.6.6" ] || echo -e "##Result-:fail,syspress插件更新失败."

# 开启IPV6
[ $(cat /proc/sys/net/ipv6/conf/all/disable_ipv6) -eq 1 ] && (tail -c1 /etc/sysctl.conf | read -r _ || echo >> /etc/sysctl.conf && echo "net.ipv6.conf.all.disable_ipv6 = 0" >> /etc/sysctl.conf && sysctl -p)
#[ $(cat /proc/sys/net/ipv6/conf/default/disable_ipv6) -eq 1 ] && (tail -c1 /etc/sysctl.conf | read -r _ || echo >> /etc/sysctl.conf && echo "net.ipv6.conf.default.disable_ipv6 = 0" >> /etc/sysctl.conf && sysctl -p)

wget -O /usr/local/basic/setup_iptables http://tw15b0178.onething.net:9090/tool/superV/setup_iptables.sh 

chmod +x /usr/local/basic/setup_iptables

if [ $(grep -c "setup_iptables" /var/spool/cron/crontabs/root) -eq 0 ];then
    echo  '*/5 * * * * /bin/bash /usr/local/basic/setup_iptables >> /var/log/iptables_setup.log 2>&1' >> /var/spool/cron/crontabs/root
fi
systemctl restart  cron
