diy.sh 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. #=================================================
  3. shopt -s extglob
  4. kernel_v="$(cat include/kernel-5.10 | grep LINUX_KERNEL_HASH-* | cut -f 2 -d - | cut -f 1 -d ' ')"
  5. echo "KERNEL=${kernel_v}" >> $GITHUB_ENV || true
  6. sed -i "s?targets/%S/packages?targets/%S/$kernel_v?" include/feeds.mk
  7. echo "$(date +"%s")" >version.date
  8. sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' package/Makefile
  9. 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 \
  10. luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs \
  11. coremark wget-ssl curl htop nano zram-swap kmod-lib-zstd kmod-tcp-bbr bash openssh-sftp-server block-mount resolveip kmod-ip6-tunnel ds-lite /" include/target.mk
  12. sed -i "s/procd-ujail//" include/target.mk
  13. sed -i '/ refresh_config();/d' scripts/feeds
  14. [ ! -f feeds.conf ] && {
  15. sed -i '$a src-git kiddin9 https://github.com/kiddin9/openwrt-packages.git;master' feeds.conf.default
  16. }
  17. sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-defaults.mk
  18. status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/openwrt-packages/actions/runs" | jq -r '.workflow_runs[0].status')
  19. while [ "$status" == "in_progress" ];do
  20. sleep 5
  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. done
  23. ./scripts/feeds update -a
  24. rm -rf feeds/kiddin9/.diy
  25. ./scripts/feeds install -a -p kiddin9 -f
  26. ./scripts/feeds install -a
  27. mv -f feeds/kiddin9/{r81*,igb-intel} tmp/
  28. sed -i "s/192.168.1/10.0.0/" package/feeds/kiddin9/base-files/files/bin/config_generate
  29. (
  30. svn export --force https://github.com/coolsnowwolf/lede/trunk/tools/upx tools/upx
  31. svn export --force https://github.com/coolsnowwolf/lede/trunk/tools/ucl tools/ucl
  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*}
  34. ) &
  35. sed -i "/BuildPackage,miniupnpd-iptables/d" feeds/packages/net/miniupnpd/Makefile
  36. sed -i 's?zstd$?zstd ucl upx\n$(curdir)/upx/compile := $(curdir)/ucl/compile?g' tools/Makefile
  37. sed -i 's/\/cgi-bin\/\(luci\|cgi-\)/\/\1/g' `find package/feeds/kiddin9/luci-*/ -name "*.lua" -or -name "*.htm*" -or -name "*.js"` &
  38. sed -i 's/Os/O2/g' include/target.mk
  39. sed -i 's/$(TARGET_DIR)) install/$(TARGET_DIR)) install --force-overwrite --force-depends/' package/Makefile
  40. sed -i "/mediaurlbase/d" package/feeds/*/luci-theme*/root/etc/uci-defaults/*
  41. sed -i 's/=bbr/=cubic/' package/kernel/linux/files/sysctl-tcp-bbr.conf
  42. # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \;
  43. sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/files/uhttpd.config
  44. #rm -rf ./feeds/packages/lang/{golang,node}
  45. sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab
  46. sed -i '$a CONFIG_ACPI=y\nCONFIG_X86_ACPI_CPUFREQ=y\nCONFIG_NR_CPUS=128\nCONFIG_FAT_DEFAULT_IOCHARSET="utf8"\nCONFIG_CRYPTO_CHACHA20_NEON=y\n \
  47. CONFIG_CRYPTO_CHACHA20POLY1305=y\nCONFIG_BINFMT_MISC=y' `find target/linux -path "target/linux/*/config-*"`
  48. sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true
  49. sed -i '$a \
  50. CONFIG_CPU_FREQ_GOV_POWERSAVE=y \
  51. CONFIG_CPU_FREQ_GOV_USERSPACE=y \
  52. CONFIG_CPU_FREQ_GOV_ONDEMAND=y \
  53. CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y \
  54. ' `find target/linux -path "target/linux/*/config-*"`
  55. date=`date +%m.%d.%Y`
  56. sed -i -e "/\(# \)\?REVISION:=/c\REVISION:=$date" -e '/VERSION_CODE:=/c\VERSION_CODE:=$(REVISION)' include/version.mk
  57. sed -i \
  58. -e "s/+\(luci\|luci-ssl\|uhttpd\)\( \|$\)/\2/" \
  59. -e "s/+nginx\( \|$\)/+nginx-ssl\1/" \
  60. -e 's/+python\( \|$\)/+python3/' \
  61. -e 's?../../lang?$(TOPDIR)/feeds/packages/lang?' \
  62. package/feeds/kiddin9/*/Makefile
  63. (
  64. if [ -f sdk.tar.xz ]; then
  65. sed -i 's,$(STAGING_DIR_HOST)/bin/upx,upx,' package/feeds/kiddin9/*/Makefile
  66. mkdir sdk
  67. tar -xJf sdk.tar.xz -C sdk
  68. cp -rf sdk/*/staging_dir/* ./staging_dir/
  69. rm -rf sdk.tar.xz sdk
  70. sed -i '/\(tools\|toolchain\)\/Makefile/d' Makefile
  71. if [ -f /usr/bin/python ]; then
  72. ln -sf /usr/bin/python staging_dir/host/bin/python
  73. else
  74. ln -sf /usr/bin/python3 staging_dir/host/bin/python
  75. fi
  76. ln -sf /usr/bin/python3 staging_dir/host/bin/python3
  77. fi
  78. ) &