Files
op-packages/isp-split/files/etc/uci-defaults/99-isp-split
T

31 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# 首次启动初始化 —— 用于把本包直接编译进固件的情况
#
# 为什么需要:打进固件时,opkg/apk 的 postinst 在镜像构建阶段就被跳过
# (IPKG_INSTROOT 非空),所以 /etc/rc.d 的自启软链不会自动建立。
# OpenWrt 会在首次启动时执行 /etc/uci-defaults/ 下的脚本,就在这里补上。
[ -x /usr/sbin/isp-split ] || exit 0
/etc/init.d/isp-split enable >/dev/null 2>&1
# A-14:state 首次创建就 700;旧版本留下的 755 也在这里纠正。
mkdir -p /etc/isp-split/state 2>/dev/null || true
chmod 700 /etc/isp-split/state 2>/dev/null || true
# 启用每日更新(只改数据,不重写 mwan3 配置)
if [ -x /etc/init.d/cron ]; then
mkdir -p /etc/crontabs
touch /etc/crontabs/root
if ! grep -q 'isp-split' /etc/crontabs/root 2>/dev/null; then
echo "17 4 * * * /usr/sbin/isp-split refresh >/dev/null 2>&1 # isp-split" \
>> /etc/crontabs/root
fi
/etc/init.d/cron enable >/dev/null 2>&1
/etc/init.d/cron restart >/dev/null 2>&1
fi
logger -t isp-split "固件内置初始化完成:已开自启与每日更新;运行 isp-split plan 进行预演"
exit 0