diy.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. #=================================================
  3. rm -Rf feeds/custom/diy
  4. rm -Rf feeds/packages/net/{smartdns,mwan3,miniupnpd,aria2,https-dns-proxy,shadowsocks-libev,frp,openvpn} feeds/luci/applications/luci-app-{dockerman,smartdns,frpc,frps,https-dns-proxy}
  5. rm -Rf feeds/packages/utils/cgroupfs-mount
  6. ./scripts/feeds update luci packages custom
  7. ./scripts/feeds install -a
  8. sed -i 's/Os/O2/g' include/target.mk
  9. rm -Rf tools/upx && svn co https://github.com/coolsnowwolf/lede/trunk/tools/upx tools/upx
  10. rm -Rf tools/ucl && svn co https://github.com/coolsnowwolf/lede/trunk/tools/ucl tools/ucl
  11. sed -i 's?zstd$?zstd ucl upx\n$(curdir)/upx/compile := $(curdir)/ucl/compile?g' tools/Makefile
  12. echo -e "\q" | svn co https://github.com/immortalwrt/immortalwrt/branches/master/target/linux/generic/hack-5.4 target/linux/generic/hack-5.4
  13. wget -O target/linux/generic/pending-5.4/601-add-kernel-imq-support.patch https://raw.githubusercontent.com/immortalwrt/immortalwrt/master/target/linux/generic/pending-5.4/601-add-kernel-imq-support.patch
  14. rm -rf package/network/services/ppp
  15. svn co https://github.com/openwrt/openwrt/trunk/package/network/services/ppp package/network/services/ppp
  16. sed -i "s/'class': 'table'/'class': 'table memory'/g" package/*/*/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
  17. sed -i 's/+acme\( \|$\)/+acme +acme-dnsapi\1/g' package/*/*/luci-app-acme/Makefile
  18. sed -i '$a /etc/sysupgrade.conf' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  19. sed -i '$a /etc/amule' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  20. sed -i '$a /etc/acme' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  21. sed -i '$a /etc/bench.log' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  22. sed -i '$a /etc/acme' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  23. sed -i '/\/etc\/profile/d' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  24. sed -i '/^\/etc\/profile/d' package/base-files/Makefile
  25. # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \;
  26. find target/linux -path "target/linux/*/config-*" | xargs -i sed -i '$a CONFIG_ACPI=y\nCONFIG_X86_ACPI_CPUFREQ=y\n \
  27. CONFIG_NR_CPUS=128\nCONFIG_FAT_DEFAULT_IOCHARSET="utf8"\nCONFIG_CRYPTO_CHACHA20_NEON=y\nCONFIG_CRYPTO_CHACHA20POLY1305=y\nCONFIG_BINFMT_MISC=y' {}
  28. sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/files/uhttpd.config
  29. rm -rf ./feeds/packages/lang/{golang,node}
  30. svn co https://github.com/immortalwrt/packages/trunk/lang/golang feeds/packages/lang/golang
  31. svn co https://github.com/immortalwrt/packages/trunk/lang/node feeds/packages/lang/node
  32. mkdir package/network/config/firewall/patches
  33. wget -O package/network/config/firewall/patches/fullconenat.patch https://github.com/coolsnowwolf/lede/raw/master/package/network/config/firewall/patches/fullconenat.patch
  34. sed -i "s/+nginx\( \|$\)/+nginx-ssl\1/g" package/*/*/*/Makefile
  35. sed -i 's/+python\( \|$\)/+python3/g' package/*/*/*/Makefile
  36. sed -i 's?../../lang?$(TOPDIR)/feeds/packages/lang?g' package/feeds/custom/*/Makefile
  37. sed -i 's/PKG_BUILD_DIR:=/PKG_BUILD_DIR?=/g' feeds/luci/luci.mk
  38. sed -i 's?admin/status/channel_analysis??' package/feeds/luci/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
  39. sed -i '/killall -HUP/d' feeds/luci/luci.mk
  40. find package target -name inittab | xargs -i sed -i "s/askfirst/respawn/g" {}
  41. for ipk in $(find package/feeds/custom/* -maxdepth 0); do
  42. if [[ ! -d "$ipk/patches" && ! "$(grep "codeload.github.com" $ipk/Makefile)" ]]; then
  43. find $ipk/ -maxdepth 1 ! -path *tcping* -name "Makefile" \
  44. | xargs -i sed -i "s/PKG_SOURCE_VERSION:=[0-9a-z]\{15,\}/PKG_SOURCE_VERSION:=HEAD/g" {}
  45. fi
  46. done
  47. sed -i 's/$(VERSION) &&/$(VERSION) ;/g' include/download.mk
  48. date=`date +%m.%d.%Y`
  49. sed -i "s/DISTRIB_DESCRIPTION.*/DISTRIB_DESCRIPTION='%D %V %C by GaryPang'/g" package/base-files/files/etc/openwrt_release
  50. sed -i "s/# REVISION:=x/REVISION:= $date/g" include/version.mk
  51. sed -i '$a cgi-timeout = 300' package/feeds/packages/uwsgi/files-luci-support/luci-webui.ini
  52. if [ -f sdk.tar.xz ]; then
  53. sed -i 's,$(STAGING_DIR_HOST)/bin/upx,upx,' package/feeds/custom/*/Makefile
  54. mkdir sdk
  55. tar -xJf sdk.tar.xz -C sdk
  56. cp -rf sdk/*/staging_dir/* ./staging_dir/
  57. rm -rf sdk.tar.xz sdk
  58. sed -i '/\(tools\|toolchain\)\/Makefile/d' Makefile
  59. if [ -f /usr/bin/python ]; then
  60. ln -sf /usr/bin/python staging_dir/host/bin/python
  61. else
  62. ln -sf /usr/bin/python3 staging_dir/host/bin/python
  63. fi
  64. ln -sf /usr/bin/python3 staging_dir/host/bin/python3
  65. fi