diy.sh 7.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. #=================================================
  3. svn co --force https://github.com/coolsnowwolf/lede/trunk/package/lean package/lean && svn revert -R package/lean
  4. rm -Rf package/lean/qBittorrent/patches
  5. sed -i 's/PKG_SOURCE_URL:=.*/PKG_SOURCE_URL:=https:\/\/github.com\/c0re100\/qBittorrent-Enhanced-Edition/g' package/lean/qBittorrent/Makefile
  6. sed -i 's/PKG_HASH.*/PKG_SOURCE_PROTO:=git\nPKG_SOURCE_VERSION:=latest/g' package/lean/qBittorrent/Makefile
  7. sed -i '/PKG_BUILD_DIR/d' package/lean/qBittorrent/Makefile
  8. sed -i 's/+python$/+python3/g' package/lean/luci-app-qbittorrent/Makefile
  9. rm -Rf package/feeds/packages/php7
  10. svn co https://github.com/openwrt/packages/branches/openwrt-19.07/lang/php7 package/feeds/packages/php7
  11. git clone https://github.com/MatteoRagni/AmuleWebUI-Reloaded files/usr/share/amule/webserver/AmuleWebUI-Reloaded
  12. git clone https://github.com/P3TERX/aria2.conf files/usr/share/aria2
  13. rm -Rf package/lean/antileech/src/*
  14. git clone https://github.com/persmule/amule-dlp.antiLeech package/lean/antileech/src
  15. cd package/feeds
  16. git clone https://github.com/rufengsuixing/luci-app-adguardhome
  17. git clone https://github.com/jerrykuku/luci-theme-argon
  18. git clone https://github.com/pymumu/luci-app-smartdns
  19. git clone https://github.com/lisaac/luci-app-diskman
  20. mkdir parted && cp luci-app-diskman/Parted.Makefile parted/Makefile
  21. git clone https://github.com/tty228/luci-app-serverchan
  22. git clone https://github.com/brvphoenix/luci-app-wrtbwmon
  23. git clone https://github.com/brvphoenix/wrtbwmon
  24. git clone https://github.com/destan19/OpenAppFilter
  25. svn co https://github.com/pymumu/smartdns/trunk/package/openwrt smartdns
  26. svn co https://github.com/jsda/packages2/trunk/ntlf9t/luci-app-advancedsetting
  27. git clone https://github.com/lisaac/luci-app-dockerman
  28. git clone https://github.com/garypang13/openwrt-adguardhome
  29. git clone https://github.com/garypang13/luci-app-php-kodexplorer
  30. git clone https://github.com/garypang13/luci-app-eqos
  31. cd -
  32. cp -Rf ../diy/* ./
  33. sed -i 's/root\/.aria2/usr\/share\/aria2/g' files/usr/share/aria2/aria2.conf
  34. sed -i 's/root\/Download/data\/download\/aria2/g' files/usr/share/aria2/*
  35. sed -i 's/+uhttpd //g' feeds/luci/collections/luci/Makefile
  36. sed -i '/_redirect2ssl/d' package/feeds/*/nginx/Makefile
  37. sed -i '/init_lan/d' package/feeds/*/nginx/files/nginx.init
  38. sed -i "s/sed '\/^$\/d' \"\$config_file_tmp\" >\"\$config_file\"/cd \/usr\/share\/aria2 \&\& .\/tracker.sh\ncat \/usr\/share\/aria2\/aria2.conf > \"\$config_file\"\n\
  39. echo '' >> \"\$config_file\"\nsed '\/^$\/d' \"\$config_file_tmp\" >> \"\$config_file\"/g" package/feeds/packages/aria2/files/aria2.init
  40. sed -i 's/runasuser "$config_dir"/runasuser "$config_dir"\nwget -P "$config_dir" -O "$config_dir\/nodes.dat" \
  41. http:\/\/upd.emule-security.org\/nodes.dat/g' package/*/luci-app-amule/root/etc/init.d/amule
  42. sed -i '$a /etc/smartdns' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  43. sed -i '$a /www/kod/config' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  44. sed -i '$a /etc/qBittorrent' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  45. sed -i '$a /root/amule' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  46. sed -i '$a /etc/amule' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  47. sed -i '$a /etc/aria2' package/base-files/files/lib/upgrade/keep.d/base-files-essential
  48. find target/linux/x86 -name "config*" | xargs -i sed -i '$a CONFIG_64BIT=y\n# CONFIG_WLAN is not set\n# CONFIG_WIRELESS is not set\
  49. \nCONFIG_NETFILTER=y\nCONFIG_NETFILTER_XTABLES=y\nCONFIG_NETFILTER_XT_MATCH_STRING=y\nCONFIG_HWMON=y\nCONFIG_SENSORS_CORETEMP=y' {}
  50. sed -i '/continue$/d' package/*/luci-app-ssr-plus/root/usr/bin/ssr-switch
  51. sed -i 's/if test_proxy/sleep 3600\nif test_proxy/g' package/*/luci-app-ssr-plus/root/usr/bin/ssr-switch
  52. sed -i 's/ uci.cursor/ luci.model.uci.cursor/g' package/*/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua
  53. sed -i 's/service_start $PROG/service_start $PROG -R/g' package/feeds/packages/php7/files/php7-fpm.init
  54. sed -i 's/ +kmod-fs-exfat//g' package/*/automount/Makefile
  55. sed -i 's/net.netfilter.nf_conntrack_max=16384/net.netfilter.nf_conntrack_max=105535/g' package/kernel/linux/files/sysctl-nf-conntrack.conf
  56. wget -P package/network/config/firewall/patches/ https://github.com/coolsnowwolf/lede/raw/master/package/network/config/firewall/patches/fullconenat.patch
  57. sed -i "s/('Drop invalid packets'));/('Drop invalid packets'));\n o = s.option(form.Flag, 'fullcone', _('Enable FullCone NAT'));/g" \
  58. package/feeds/*/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
  59. sed -i "s/option forward REJECT/option forward REJECT\n option fullcone 1/g" package/network/config/firewall/files/firewall.config
  60. sed -i "s/option bbr '0'/option bbr '1'/g" package/*/luci-app-flowoffload/root/etc/config/flowoffload
  61. sed -i 's/getElementById("cbid.amule.main/getElementById("widget.cbid.amule.main/g' package/lean/luci-app-amule/luasrc/view/amule/overview_status.htm
  62. getversion(){
  63. if !(basename $(curl -Ls -o /dev/null -w %{url_effective} https://github.com/$1/releases/latest) | grep -o -E "[0-9.]+")
  64. then
  65. git ls-remote --tags git://github.com/$1 | cut -d/ -f3- | sort -t. -nk1,2 -k3 | awk '/^[^{]*$/{version=$1}END{print version}' | grep -o -E "[0-9.]+"
  66. fi
  67. }
  68. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion v2ray/v2ray-core)/g" package/lean/v2ray/Makefile
  69. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion aria2/aria2)/g" package/feeds/*/aria2/Makefile
  70. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion Neilpang/acme.sh)/g" package/feeds/*/acme/Makefile
  71. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion netdata/netdata)/g" package/feeds/*/netdata/Makefile
  72. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion tsl0922/ttyd)/g" package/feeds/*/ttyd/Makefile
  73. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion docker/docker-ce)/g" package/feeds/*/docker-ce/Makefile
  74. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion cifsd-team/cifsd)/g" package/feeds/*/ksmbd/Makefile
  75. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$(getversion cifsd-team/cifsd-tools)/g" package/feeds/*/ksmbd-tools/Makefile
  76. sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=v$(getversion AdguardTeam/AdGuardHome)/g" package/feeds/openwrt-adguardhome/Makefile
  77. find package/feeds/*/aria2/ package/feeds/*/acme/ package/feeds/*/netdata/ package/feeds/*/ttyd/ package/feeds/*/docker-ce/ package/lean/v2ray/ \
  78. package/feeds/*/ksmbd/ package/feeds/*/ksmbd-tools/ -maxdepth 2 -name "Makefile" | xargs -i sed -i "s/PKG_HASH:=.*/PKG_HASH:=skip/g" {}
  79. sed -i 's/..\/..\/luci.mk/$(TOPDIR)\/feeds\/luci\/luci.mk/g' package/feeds/*/Makefile
  80. find package/feeds/*/ package/lean/ -maxdepth 3 ! -path "*shadowsocksr-libev*" -name "Makefile" ! -path "*rblibtorrent1*" -name "Makefile" \
  81. | xargs -i sed -i "s/PKG_SOURCE_VERSION:=[0-9a-z]\{15,\}/PKG_SOURCE_VERSION:=latest/g" {}
  82. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "s/SUBDIRS=/M=/g" {}
  83. sed -i 's/$(VERSION) &&/$(VERSION) ;/g' include/download.mk
  84. sed -i 's/PKG_BUILD_DIR:=/PKG_BUILD_DIR?=/g' feeds/luci/luci.mk
  85. find package/feeds/*/ package/lean/ -maxdepth 3 -path "*luci-app*" -name "Makefile" | xargs -i sed -i 's/$(INCLUDE_DIR)\/package.mk/$(TOPDIR)\/feeds\/luci\/luci.mk/g' {}
  86. find package/feeds/*/ package/lean/ -maxdepth 3 -d -name "zh-cn" | xargs -i rename -v 's/zh-cn/zh_Hans/' {}
  87. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "/bin\/upx/d" {}
  88. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "/po2lmo /d" {}
  89. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "/luci\/i18n/d" {}
  90. sed -i "/\.po/d" package/feeds/luci-app-diskman/Makefile
  91. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "s/+luci\( \|\$\)//g" {}
  92. find package/feeds/*/ package/lean/ -maxdepth 3 -name "Makefile" | xargs -i sed -i "s/+nginx\( \|\$\)/+nginx-ssl\1/g" {}