diy.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/bash
  2. #=================================================
  3. shopt -s extglob
  4. sed -i '$a src-git kiddin9 https://github.com/kiddin9/openwrt-packages.git;master' feeds.conf.default
  5. sed -i "/telephony/d" feeds.conf.default
  6. sed -i "s?targets/%S/packages?targets/%S/\$(LINUX_VERSION)?" include/feeds.mk
  7. sed -i '/ refresh_config();/d' scripts/feeds
  8. ./scripts/feeds update -a
  9. ./scripts/feeds install -a -p kiddin9 -f
  10. ./scripts/feeds install -a
  11. echo "$(date +"%s")" >version.date
  12. sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' package/Makefile
  13. sed -i 's/$(TARGET_DIR)) install/$(TARGET_DIR)) install --force-overwrite --force-depends/' package/Makefile
  14. sed -i "s/DEFAULT_PACKAGES:=/DEFAULT_PACKAGES:=luci-app-advancedplus luci-app-firewall luci-app-opkg luci-app-upnp luci-app-autoreboot \
  15. luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs \
  16. coremark wget-ssl curl autocore htop nano zram-swap kmod-lib-zstd kmod-tcp-bbr bash openssh-sftp-server block-mount resolveip ds-lite swconfig luci-app-fan /" include/target.mk
  17. sed -i "s/procd-ujail//" include/target.mk
  18. sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-defaults.mk
  19. status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/openwrt-packages/actions/runs" | jq -r '.workflow_runs[0].status')
  20. echo "$status"
  21. while [[ "$status" == "in_progress" || "$status" == "queued" ]];do
  22. echo "wait 5s"
  23. sleep 5
  24. status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/openwrt-packages/actions/runs" | jq -r '.workflow_runs[0].status')
  25. done
  26. mv -f feeds/kiddin9/r81* tmp/
  27. sed -i "s/192.168.1/10.0.0/" package/feeds/kiddin9/base-files/files/bin/config_generate
  28. sed -i "s/192.168.1/10.0.0/" package/base-files/files/bin/config_generate
  29. #sed -i "/call Build\/check-size,\$\$(KERNEL_SIZE)/d" include/image.mk
  30. git_clone_path master https://github.com/coolsnowwolf/lede target/linux/generic/hack-5.15
  31. curl -sfL https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-5.15/613-netfilter_optional_tcp_window_check.patch -o target/linux/generic/pending-5.15/613-netfilter_optional_tcp_window_check.patch
  32. sed -i "s/CONFIG_WERROR=y/CONFIG_WERROR=n/" target/linux/generic/config-5.15
  33. sed -i "s/no-lto,$/no-lto no-mold,$/" include/package.mk
  34. [ -d package/kernel/mt76 ] && {
  35. mkdir package/kernel/mt76/patches
  36. curl -sfL https://raw.githubusercontent.com/immortalwrt/immortalwrt/master/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch -o package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch
  37. }
  38. rm -rf feeds/packages/libs/libpfring
  39. cd feeds/packages
  40. git_clone_path master https://github.com/openwrt/packages libs/libpfring
  41. cd -
  42. rm -rf package/network/utils/xdp-tools
  43. grep -q "1.8.8" package/network/utils/iptables/Makefile && {
  44. rm -rf package/network/utils/iptables
  45. git_clone_path openwrt-22.03 https://github.com/openwrt/openwrt package/network/utils/iptables
  46. }
  47. grep -q 'PKG_RELEASE:=9' package/libs/openssl/Makefile && {
  48. sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/a48d0bdb77eb93f7fba6e055dace125c72755b6a.patch | patch -d './' -p1 --forward"
  49. }
  50. sed -i "/wireless.\${name}.disabled/d" package/kernel/mac80211/files/lib/wifi/mac80211.sh || sed -i "/wireless.\${name}.disabled/d" package/network/config/wifi-scripts/files/lib/wifi/mac80211.sh
  51. sed -i "/BuildPackage,miniupnpd-iptables/d" feeds/packages/net/miniupnpd/Makefile
  52. sed -i 's/Os/O2/g' include/target.mk
  53. sed -i "/mediaurlbase/d" package/feeds/*/luci-theme*/root/etc/uci-defaults/*
  54. sed -i 's/=bbr/=cubic/' package/kernel/linux/files/sysctl-tcp-bbr.conf
  55. # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \;
  56. sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/files/uhttpd.config
  57. #rm -rf ./feeds/packages/lang/{golang,node}
  58. sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab
  59. date=`date +%m.%d.%Y`
  60. sed -i -e "/\(# \)\?REVISION:=/c\REVISION:=$date" -e '/VERSION_CODE:=/c\VERSION_CODE:=$(REVISION)' include/version.mk
  61. sed -i \
  62. -e "s/+\(luci\|luci-ssl\|uhttpd\)\( \|$\)/\2/" \
  63. -e "s/+nginx\( \|$\)/+nginx-ssl\1/" \
  64. -e 's/+python\( \|$\)/+python3/' \
  65. -e 's?../../lang?$(TOPDIR)/feeds/packages/lang?' \
  66. package/feeds/kiddin9/*/Makefile
  67. (
  68. if [ -f sdk.tar.xz ]; then
  69. sed -i 's,$(STAGING_DIR_HOST)/bin/upx,upx,' package/feeds/kiddin9/*/Makefile
  70. mkdir sdk
  71. tar -xJf sdk.tar.xz -C sdk
  72. cp -rf sdk/*/staging_dir/* ./staging_dir/
  73. rm -rf sdk.tar.xz sdk
  74. sed -i '/\(tools\|toolchain\)\/Makefile/d' Makefile
  75. if [ -f /usr/bin/python ]; then
  76. ln -sf /usr/bin/python staging_dir/host/bin/python
  77. else
  78. ln -sf /usr/bin/python3 staging_dir/host/bin/python
  79. fi
  80. ln -sf /usr/bin/python3 staging_dir/host/bin/python3
  81. fi
  82. ) &