You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

  1. # Copyright 2017-2022 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:=simple-adblock
  6. PKG_VERSION:=1.9.1
  7. PKG_RELEASE:=2
  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/simple-adblock
  12. SECTION:=net
  13. CATEGORY:=Network
  14. TITLE:=Simple AdBlock Service
  15. URL:=https://docs.openwrt.melmac.net/simple-adblock/
  16. DEPENDS:=+jshn +wget
  17. PKGARCH:=all
  18. endef
  19. define Package/simple-adblock/description
  20. Simple adblock script to block ad or abuse/malware domains with DNSMASQ or Unbound.
  21. Script supports local/remote list of domains and hosts-files for both block-listing and allow-listing.
  22. Please see https://docs.openwrt.melmac.net/simple-adblock/ for more information.
  23. endef
  24. define Package/simple-adblock/conffiles
  25. /etc/config/simple-adblock
  26. endef
  27. define Build/Configure
  28. endef
  29. define Build/Compile
  30. endef
  31. define Package/simple-adblock/install
  32. $(INSTALL_DIR) $(1)/etc/init.d
  33. $(INSTALL_DIR) $(1)/etc/config
  34. $(INSTALL_DIR) $(1)/tmp
  35. $(INSTALL_BIN) ./files/simple-adblock.init $(1)/etc/init.d/simple-adblock
  36. $(SED) "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/simple-adblock
  37. $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
  38. $(INSTALL_DATA) ./files/simple-adblock.conf.update $(1)/tmp/simple-adblock.conf.update
  39. endef
  40. define Package/simple-adblock/postinst
  41. #!/bin/sh
  42. # check if we are on real system
  43. if [ -z "$${IPKG_INSTROOT}" ]; then
  44. sed -f /tmp/simple-adblock.conf.update -i /etc/config/simple-adblock || true
  45. /etc/init.d/simple-adblock enable
  46. fi
  47. exit 0
  48. endef
  49. define Package/simple-adblock/prerm
  50. #!/bin/sh
  51. # check if we are on real system
  52. if [ -z "$${IPKG_INSTROOT}" ]; then
  53. echo "Stopping service and removing rc.d symlink for simple-adblock"
  54. /etc/init.d/simple-adblock stop || true
  55. /etc/init.d/simple-adblock killcache || true
  56. /etc/init.d/simple-adblock disable || true
  57. fi
  58. exit 0
  59. endef
  60. $(eval $(call BuildPackage,simple-adblock))