Makefile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
  2. # TLD optimization written by Dirk Brenken (dev@brenken.org)
  3. # This is free software, licensed under the GNU General Public License v3.
  4. include $(TOPDIR)/rules.mk
  5. PKG_NAME:=adblock-fast
  6. PKG_VERSION:=1.1.1
  7. PKG_RELEASE:=1
  8. PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
  9. PKG_LICENSE:=GPL-3.0-or-later
  10. include $(INCLUDE_DIR)/package.mk
  11. define Package/adblock-fast
  12. SECTION:=net
  13. CATEGORY:=Network
  14. TITLE:=AdBlock Fast Service
  15. URL:=https://docs.openwrt.melmac.net/adblock-fast/
  16. DEPENDS:=+jshn +curl
  17. DEPENDS+=+!BUSYBOX_DEFAULT_AWK:gawk
  18. DEPENDS+=+!BUSYBOX_DEFAULT_GREP:grep
  19. DEPENDS+=+!BUSYBOX_DEFAULT_SED:sed
  20. DEPENDS+=+!BUSYBOX_DEFAULT_SORT:coreutils-sort
  21. CONFLICTS:=simple-adblock
  22. PROVIDES:=simple-adblock
  23. PKGARCH:=all
  24. endef
  25. define Package/adblock-fast/description
  26. Fast AdBlocking script to block ad or abuse/malware domains with DNSMASQ or Unbound.
  27. Script supports local/remote list of domains and hosts-files for both block-listing and allow-listing.
  28. Please see https://docs.openwrt.melmac.net/adblock-fast/ for more information.
  29. endef
  30. define Package/adblock-fast/conffiles
  31. /etc/config/adblock-fast
  32. endef
  33. define Build/Configure
  34. endef
  35. define Build/Compile
  36. endef
  37. define Package/adblock-fast/install
  38. $(INSTALL_DIR) $(1)/etc/init.d
  39. $(INSTALL_BIN) ./files/etc/init.d/adblock-fast $(1)/etc/init.d/adblock-fast
  40. $(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/adblock-fast
  41. $(INSTALL_DIR) $(1)/etc/config
  42. $(INSTALL_CONF) ./files/etc/config/adblock-fast $(1)/etc/config/adblock-fast
  43. $(INSTALL_DIR) $(1)/tmp
  44. $(INSTALL_DATA) ./files/adblock-fast.config.update $(1)/tmp/adblock-fast.config.update
  45. $(INSTALL_DIR) $(1)/etc/uci-defaults
  46. $(INSTALL_BIN) ./files/etc/uci-defaults/90-adblock-fast $(1)/etc/uci-defaults/90-adblock-fast
  47. endef
  48. define Package/adblock-fast/postinst
  49. #!/bin/sh
  50. # check if we are on real system
  51. if [ -z "$${IPKG_INSTROOT}" ]; then
  52. sed -f /tmp/adblock-fast.config.update -i /etc/config/adblock-fast || true
  53. /etc/init.d/adblock-fast enable
  54. fi
  55. exit 0
  56. endef
  57. define Package/adblock-fast/prerm
  58. #!/bin/sh
  59. # check if we are on real system
  60. if [ -z "$${IPKG_INSTROOT}" ]; then
  61. echo "Stopping service and removing rc.d symlink for adblock-fast"
  62. /etc/init.d/adblock-fast stop || true
  63. /etc/init.d/adblock-fast killcache || true
  64. /etc/init.d/adblock-fast disable || true
  65. fi
  66. exit 0
  67. endef
  68. $(eval $(call BuildPackage,adblock-fast))