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.

74 lines
2.2 KiB

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