Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scripts/clash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ tools(){
fi
}
#获取设置默认显示
[ -n "$(cat /etc/crontabs/root 2>&1| grep otapredownload)" ] && mi_update=禁用 || mi_update=启用
grep -qE "^\s*[^#].*otapredownload" /etc/crontabs/root >/dev/null 2>&1 && mi_update=禁用 || mi_update=启用
[ "$mi_autoSSH" = "已配置" ] && mi_autoSSH_type=32m已配置 || mi_autoSSH_type=31m未配置
[ -f $CRASHDIR/tools/tun.ko ] && mi_tunfix=32m已启用 || mi_tunfix=31m未启用
#
Expand Down Expand Up @@ -1672,7 +1672,16 @@ tools(){
tools

elif [ -x /usr/sbin/otapredownload ] && [ "$num" = 5 ]; then
[ "$mi_update" = "禁用" ] && sed -i "/otapredownload/d" /etc/crontabs/root || echo "15 3,4,5 * * * /usr/sbin/otapredownload >/dev/null 2>&1" >> /etc/crontabs/root
if [ "$mi_update" = "禁用" ]; then
grep -q "otapredownload" /etc/crontabs/root && \
sed -i "/^[^\#]*otapredownload/ s/^/#/" /etc/crontabs/root || \
echo "#15 3,4,5 * * * /usr/sbin/otapredownload >/dev/null 2>&1" >> /etc/crontabs/root
else
grep -q "otapredownload" /etc/crontabs/root && \
sed -i "/^\s*#.*otapredownload/ s/^\s*#//" /etc/crontabs/root || \
echo "15 3,4,5 * * * /usr/sbin/otapredownload >/dev/null 2>&1" >> /etc/crontabs/root
fi

echo -----------------------------------------------
echo -e "已\033[33m$mi_update\033[0m小米路由器的自动更新,如未生效,请在官方APP中同步设置!"
sleep 1
Expand Down