diy.sh 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/bash
  2. #=================================================
  3. shopt -s extglob
  4. [ ! -f feeds.conf ] && {
  5. sed -i '$a src-git kiddin9 https://github.com/kiddin9/openwrt-packages.git;master' feeds.conf.default
  6. sed -i "/telephony/d" feeds.conf.default
  7. }
  8. sed -i "s?targets/%S/packages?targets/%S/\$(LINUX_VERSION)?" include/feeds.mk
  9. sed -i '/ refresh_config();/d' scripts/feeds
  10. ./scripts/feeds update -a
  11. ./scripts/feeds install -a -p kiddin9 -f
  12. ./scripts/feeds install -a
  13. echo "$(date +"%s")" >version.date
  14. sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' package/Makefile
  15. sed -i 's/$(TARGET_DIR)) install/$(TARGET_DIR)) install --force-overwrite --force-depends/' package/Makefile
  16. sed -i "s/DEFAULT_PACKAGES:=/DEFAULT_PACKAGES:=luci-app-advanced luci-app-firewall luci-app-gpsysupgrade luci-app-opkg luci-app-upnp luci-app-autoreboot \
  17. luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs \
  18. 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 /" include/target.mk
  19. sed -i "s/procd-ujail//" include/target.mk
  20. sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-defaults.mk
  21. status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/openwrt-packages/actions/runs" | jq -r '.workflow_runs[0].status')
  22. echo "$status"
  23. while [[ "$status" == "in_progress" || "$status" == "queued" ]];do
  24. echo "wait 5s"
  25. sleep 5
  26. status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/openwrt-packages/actions/runs" | jq -r '.workflow_runs[0].status')
  27. done
  28. mv -f feeds/kiddin9/r81* tmp/
  29. sed -i "s/192.168.1/10.0.0/" package/feeds/kiddin9/base-files/files/bin/config_generate
  30. sed -i "s/192.168.1/10.0.0/" package/base-files/files/bin/config_generate
  31. (
  32. svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/generic/hack-5.10 target/linux/generic/hack-5.10
  33. rm -rf target/linux/generic/hack-5.10/{220-gc_sections*,781-dsa-register*,780-drivers-net*,996-fs-ntfs3*,100-update-mtk_wed_h.patch}
  34. svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/generic/hack-5.15 target/linux/generic/hack-5.15
  35. svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/generic/backport-5.15 target/linux/generic/backport-5.15
  36. find target/linux/generic/backport-5.15 -name "[0-9][0-9][0-9]-[a-z][a-z]*" -exec rm -f {} \;
  37. rm -rf target/linux/generic/backport-5.15/{799-v6.0-net-mii*,802-v6.1-nvmem*,803-v5.19-nvmem*,733-v6.2-02-net-mediatek-sgmii-ensure*,733-v6.2-03-net-mediatek*,733-v6.2-04-mtk_sgmii-enable*,730-11-v6.3-net-ethernet-mtk_eth*,775-v5.16-net-phylink*,776-v5.16-net-ethernet-*,612-v6.3-skbuff-Fix*}
  38. 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
  39. sed -i "s/CONFIG_WERROR=y/CONFIG_WERROR=n/" target/linux/generic/config-5.15
  40. ) &
  41. curl -sfL https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-5.10/613-netfilter_optional_tcp_window_check.patch -o target/linux/generic/pending-5.10/613-netfilter_optional_tcp_window_check.patch
  42. sed -i "/BuildPackage,miniupnpd-iptables/d" feeds/packages/net/miniupnpd/Makefile
  43. sed -i 's/Os/O2/g' include/target.mk
  44. sed -i "/mediaurlbase/d" package/feeds/*/luci-theme*/root/etc/uci-defaults/*
  45. sed -i 's/=bbr/=cubic/' package/kernel/linux/files/sysctl-tcp-bbr.conf
  46. # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \;
  47. sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/files/uhttpd.config
  48. #rm -rf ./feeds/packages/lang/{golang,node}
  49. sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab
  50. date=`date +%m.%d.%Y`
  51. sed -i -e "/\(# \)\?REVISION:=/c\REVISION:=$date" -e '/VERSION_CODE:=/c\VERSION_CODE:=$(REVISION)' include/version.mk
  52. sed -i \
  53. -e "s/+\(luci\|luci-ssl\|uhttpd\)\( \|$\)/\2/" \
  54. -e "s/+nginx\( \|$\)/+nginx-ssl\1/" \
  55. -e 's/+python\( \|$\)/+python3/' \
  56. -e 's?../../lang?$(TOPDIR)/feeds/packages/lang?' \
  57. package/feeds/kiddin9/*/Makefile
  58. (
  59. if [ -f sdk.tar.xz ]; then
  60. sed -i 's,$(STAGING_DIR_HOST)/bin/upx,upx,' package/feeds/kiddin9/*/Makefile
  61. mkdir sdk
  62. tar -xJf sdk.tar.xz -C sdk
  63. cp -rf sdk/*/staging_dir/* ./staging_dir/
  64. rm -rf sdk.tar.xz sdk
  65. sed -i '/\(tools\|toolchain\)\/Makefile/d' Makefile
  66. if [ -f /usr/bin/python ]; then
  67. ln -sf /usr/bin/python staging_dir/host/bin/python
  68. else
  69. ln -sf /usr/bin/python3 staging_dir/host/bin/python
  70. fi
  71. ln -sf /usr/bin/python3 staging_dir/host/bin/python3
  72. fi
  73. ) &