theme: set default theme to openwrt2020

This commit is contained in:
John Doe
2021-09-08 19:38:56 +08:00
parent 0c0d1113bc
commit 607de52d36
5 changed files with 65 additions and 50 deletions

25
scripts/merge_files.sh Normal file
View File

@@ -0,0 +1,25 @@
mv $GITHUB_WORKSPACE/files ./
if [ $DEVICE = 'r2s' -o $DEVICE = 'r2c' ]; then
mkdir -p files/usr/bin files/etc/init.d files/etc/rc.d
wget https://github.com/friendlyarm/friendlywrt/raw/master-v19.07.1/target/linux/rockchip-rk3328/base-files/usr/bin/start-rk3328-pwm-fan.sh -qNP files/usr/bin
chmod +x files/usr/bin/start-rk3328-pwm-fan.sh
wget https://github.com/friendlyarm/friendlywrt/raw/master-v19.07.1/target/linux/rockchip-rk3328/base-files/etc/init.d/fa-rk3328-pwmfan -qNP files/etc/init.d
chmod +x files/etc/init.d/fa-rk3328-pwmfan
ln -sf ../init.d/fa-rk3328-pwmfan files/etc/rc.d/S96fa-rk3328-pwmfan
fi
if [ $DEVICE = 'r4s' ]; then
mkdir -p files/usr/bin files/etc/init.d files/etc/rc.d
wget https://raw.githubusercontent.com/btyh17mxy/friendlywrt/fix/rk3399-fan-ctl/target/linux/rockchip-rk3399/base-files/usr/bin/start-rk3399-pwm-fan.sh -qNP files/usr/bin
chmod +x files/usr/bin/start-rk3399-pwm-fan.sh
wget https://raw.githubusercontent.com/friendlyarm/friendlywrt/master-v19.07.1/target/linux/rockchip-rk3399/base-files/etc/init.d/fa-rk3399-pwmfan -qNP files/etc/init.d
chmod +x files/etc/init.d/fa-rk3399-pwmfan
ln -sf ../init.d/fa-rk3399-pwmfan files/etc/rc.d/S96fa-rk3399-pwmfan
fi
chmod 600 files/etc/dropbear/*
eval `cat .config | grep \" | head -n 10`
. files/etc/opkg/distfeeds.conf | tee files/etc/opkg/distfeeds.conf
echo 'iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53' >> files/etc/firewall.user
echo 'iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53' >> files/etc/firewall.user
echo '[ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53' >> files/etc/firewall.user
echo '[ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53' >> files/etc/firewall.user

32
scripts/merge_packages.sh Normal file
View File

@@ -0,0 +1,32 @@
function merge_package(){
pn=`echo $1 | rev | cut -d'/' -f 1 | rev`
find package/ feeds/ \( -type l -o -type d \) -name $pn | xargs -r rm -r
if [ ! -z "$2" ]; then
find package/ feeds/ \( -type l -o -type d \) -name $2 | xargs -r rm -r
fi
if [[ $1 == *'/trunk/'* ]]; then
svn export $1
else
git clone $3 --depth=1 $1
rm -rf $pn/.git
fi
mv $pn package/
}
function merge_feed(){
if [ ! -d "feed/$1" ]; then
echo >> feeds.conf.default
echo "src-git $1 $2" >> feeds.conf.default
fi
./scripts/feeds update $1
./scripts/feeds install -a -p $1
}
merge_feed nas "https://github.com/linkease/nas-packages;master"
merge_feed nas_luci "https://github.com/linkease/nas-packages-luci;main"
merge_package https://github.com/project-lede/luci-app-godproxy
merge_package https://github.com/Beginner-Go/luci-app-tencentddns
merge_package https://github.com/sundaqiang/openwrt-packages/trunk/luci-app-services-wolplus
merge_package https://github.com/coolsnowwolf/lede/trunk/package/lean/ntfs3-mount
merge_package https://github.com/coolsnowwolf/lede/trunk/package/lean/ntfs3
merge_package https://github.com/coolsnowwolf/lede/trunk/package/lean/luci-app-uugamebooster

88
scripts/patches.sh Normal file
View File

@@ -0,0 +1,88 @@
config_file_turboacc=`find package/ -follow -type f -path '*/luci-app-turboacc/root/etc/config/turboacc'`
sed -i "s/option hw_flow '1'/option hw_flow '0'/" $config_file_turboacc
sed -i "s/option sfe_flow '1'/option sfe_flow '0'/" $config_file_turboacc
sed -i "s/option sfe_bridge '1'/option sfe_bridge '0'/" $config_file_turboacc
sed -i "/dep.*INCLUDE_.*=n/d" `find package/ -follow -type f -path '*/luci-app-turboacc/Makefile'`
sed -i "s/option limit_enable '1'/option limit_enable '0'/" `find package/ -follow -type f -path '*/nft-qos/files/nft-qos.config'`
sed -i "/\/etc\/coremark\.sh/d" `find package/ -follow -type f -path '*/coremark/coremark'`
sed -i 's/192.168.1.1/192.168.2.1/' package/base-files/files/bin/config_generate
sed -i 's/=1/=0/g' package/kernel/linux/files/sysctl-br-netfilter.conf
sed -i '/DEPENDS/ s/$/ +libcap-bin/' `find package/ -follow -type f -path '*/luci-app-openclash/Makefile'`
sed -i '/DEPENDS+/ s/$/ +wsdd2/' `find package/ -follow -type f -path '*/ksmbd-tools/Makefile'`
sed -i 's/ +ntfs-3g/ +ntfs3-mount/' `find package/ -follow -type f -path '*/automount/Makefile'`
sed -i '/skip\=/ a skip=`mount | grep -q /dev/$device; echo $?`' `find package/ -follow -type f -path */automount/files/15-automount`
mkdir `find package/ -follow -type d -path '*/pdnsd-alt'`/patches
mv patches/99-disallow-aaaa.patch `find package/ -follow -type d -path '*/pdnsd-alt'`/patches
if [ $DEVICE != 'r1s' ]; then
# remove non-exist package from x86 profile
sed -i 's/kmod-i40evf//' target/linux/x86/Makefile
# enable r2s oled plugin by default
sed -i "s/enable '0'/enable '1'/" `find package/ -follow -type f -path '*/luci-app-oled/root/etc/config/oled'`
# swap the network adapter driver to r8168 to gain better performance for r4s
sed -i 's/r8169/r8168/' target/linux/rockchip/image/armv8.mk
# change the voltage value for over-clock stablization
sed -i 's/1400000/1450000/' target/linux/rockchip/patches-5.4/991-arm64-dts-rockchip-add-more-cpu-operating-points-for.patch
config_file_cpufreq=`find package/ -follow -type f -path '*/luci-app-cpufreq/root/etc/config/cpufreq'`
truncate -s-1 $config_file_cpufreq
echo -e "\toption governor0 'schedutil'" >> $config_file_cpufreq
echo -e "\toption minfreq0 '816000'" >> $config_file_cpufreq
echo -e "\toption maxfreq0 '1512000'\n" >> $config_file_cpufreq
# enable the gpu for device 'r2s'|'r2c'|'r4s'|'r1p'
wget https://github.com/coolsnowwolf/lede/raw/757e42d70727fe6b937bb31794a9ad4f5ce98081/target/linux/rockchip/config-default -NP target/linux/rockchip/
wget https://github.com/coolsnowwolf/lede/commit/f341ef96fe4b509a728ba1281281da96bac23673.patch
git apply f341ef96fe4b509a728ba1281281da96bac23673.patch
rm f341ef96fe4b509a728ba1281281da96bac23673.patch
# bring the ethinfo back
cd package/emortal/autocore/files/x86
cp rpcd_luci rpcd_10_system.js rpcd_luci-mod-status.json ../arm
cd -
mf_autcore=`find package/ -path '*/autocore/Makefile'`
sed -i '/arm\/cpuinfo/a\\t$(INSTALL_DATA) ./files/x86/rpcd_21_ethinfo.js $(1)/www/luci-static/resources/view/status/include/21_ethinfo.js' $mf_autcore
sed -i '/arm\/cpuinfo/a\\t$(INSTALL_DIR) $(1)/www/luci-static/resources/view/status/include' $mf_autcore
sed -i '/arm\/cpuinfo/a\\t$(INSTALL_BIN) ./files/x86/ethinfo $(1)/sbin/ethinfo' $mf_autcore
# inject the firmware version
strDate=`TZ=UTC-8 date +%Y-%m-%d`
status_pages=`find package/ -follow -type f \( -path '*/autocore/files/arm/index.htm' -o -path '*/autocore/files/x86/index.htm' -o -path '*/autocore/files/arm/rpcd_10_system.js' -o -path '*/autocore/files/x86/rpcd_10_system.js' \)`
for status_page in $status_pages; do
case $status_page in
*htm)
line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d: -f 1`
sed -i '/ver\./d' $status_page
sed -i $line_number_FV' a <a href="https://github.com/klever1988/nanopi-openwrt" target="_blank">klever1988/nanopi-openwrt</a> '$strDate $status_page
;;
*js)
line_number_FV=`grep -m1 -n 'corelink' $status_page | cut -d: -f1`
sed -i $line_number_FV' i var pfv = document.createElement('\''placeholder'\'');pfv.innerHTML = '\''<a href="https://github.com/klever1988/nanopi-openwrt" target="_blank">klever1988/nanopi-openwrt</a> '$strDate"';" $status_page
line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d : -f 1`
sed -i '/Firmware Version/d' $status_page
sed -i $line_number_FV' a _('\''Firmware Version'\''), pfv,' $status_page
;;
esac
done
fi
# little optimization argon css
css_file=`find package/ -follow -type f -path '*/argon/css/cascade.css'`
line_number_h6=`grep -m1 -n 'h6 {' $css_file | cut -d: -f1`
if [[ ! -z "$line_number_h6" ]]; then
sed -i $line_number_h6',+10 s/font-weight: normal/font-weight: bold/' $css_file
fi
# set default theme to openwrt2020
sed -i '/uci commit luci/i\uci set luci.main.mediaurlbase="/luci-static/openwrt2020"' `find package -type f -path '*/default-settings/files/zzz-default-settings'`
# remove the mirros from cn
sed -i '/182.140.223.146/d;/\.cn\//d;/tencent/d' scripts/download.pl