#!/bin/bash
# =====================
# 配置参数
# =====================
# 脚本URL
export mirror=https://script.kejizero.online
# 私有Gitea
export gitea=git.kejizero.online/zhao
# GitHub镜像
export github="github.com"
# 修改默认ip
sed -i "s/192.168.1.1/10.0.0.1/g" package/base-files/files/bin/config_generate
sed -i "s/192.168.1.1/10.0.0.1/g" package/base-files/luci2/bin/config_generate
# 修改名称
sed -i 's/LEDE/ZeroWrt/' package/base-files/files/bin/config_generate
sed -i 's/LEDE/ZeroWrt/' package/base-files/luci2/bin/config_generate
# 修改内核版本
sed -i 's/6.6/6.12/' target/linux/qualcommax/Makefile
##WiFi
sed -i "s/LEDE/ZeroWrt/g" package/kernel/mac80211/files/lib/wifi/mac80211.sh
# banner
curl -s $mirror/Customize/base-files/banner > package/base-files/files/etc/banner
# key-build.pub
mkdir -p files/root
curl -so files/root/key-build.pub $mirror/openwrt/files/root/key-build.pub
chmod +x files/root/key-build.pub
# NTP
sed -i 's/0.openwrt.pool.ntp.org/ntp1.aliyun.com/g' package/base-files/files/bin/config_generate
sed -i 's/1.openwrt.pool.ntp.org/ntp2.aliyun.com/g' package/base-files/files/bin/config_generate
sed -i 's/2.openwrt.pool.ntp.org/time1.cloud.tencent.com/g' package/base-files/files/bin/config_generate
sed -i 's/3.openwrt.pool.ntp.org/time2.cloud.tencent.com/g' package/base-files/files/bin/config_generate
# 版本设置
cat << 'EOF' >> feeds/luci/modules/luci-mod-status/ucode/template/admin_status/index.ut
EOF
# 加入作者信息
sed -i "s/DISTRIB_DESCRIPTION='*.*'/DISTRIB_DESCRIPTION='ZeroWrt-$(date +%Y%m%d)'/g" package/base-files/files/etc/openwrt_release
sed -i "s/DISTRIB_REVISION='*.*'/DISTRIB_REVISION=' By OPPEN321'/g" package/base-files/files/etc/openwrt_release
sed -i 's|^OPENWRT_RELEASE=".*"|OPENWRT_RELEASE="ZeroWrt 标准版 @R250605 BY OPPEN321"|' package/base-files/files/usr/lib/os-release
# distfeeds.conf
mkdir -p files/etc/opkg
cat > files/etc/opkg/distfeeds.conf < package/new/luci-theme-argon/htdocs/luci-static/argon/img/bg1.jpg
# argon-config
git clone https://github.com/jerrykuku/luci-app-argon-config.git package/new/luci-app-argon-config
sed -i "s/bing/none/g" package/new/luci-app-argon-config/root/etc/config/argon
# 主题设置
sed -i 's#Powered by <%= ver.luciname %> (<%= ver.luciversion %>) /#探索无限 /#' package/new/luci-theme-argon/luasrc/view/themes/argon/footer.htm
sed -i 's|ArgonTheme <%# vPKG_VERSION %>|OpenWRT |g' package/new/luci-theme-argon/luasrc/view/themes/argon/footer.htm
sed -i 's#Powered by <%= ver.luciname %> (<%= ver.luciversion %>) /#探索无限 /#' package/new/luci-theme-argon/luasrc/view/themes/argon/footer_login.htm
sed -i 's|ArgonTheme <%# vPKG_VERSION %>|OpenWRT |g' package/new/luci-theme-argon/luasrc/view/themes/argon/footer_login.htm
# default-settings
rm -rf package/lean/default-settings
git clone --depth=1 -b ipq https://github.com/zhiern/default-settings package/new/default-settings
# install feeds
./scripts/feeds update -a
./scripts/feeds install -a