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.

79 lines
2.3 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:=2
  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/Prepare
  27. mkdir -p $(PKG_BUILD_DIR)/files/
  28. $(CP) ./files/simple-adblock.init $(PKG_BUILD_DIR)/files/simple-adblock.init
  29. sed -i "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(PKG_BUILD_DIR)/files/simple-adblock.init
  30. endef
  31. define Build/Configure
  32. endef
  33. define Build/Compile
  34. endef
  35. define Package/simple-adblock/install
  36. $(INSTALL_DIR) $(1)/etc/init.d
  37. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/simple-adblock.init $(1)/etc/init.d/simple-adblock
  38. $(INSTALL_DIR) $(1)/etc/config
  39. $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
  40. $(INSTALL_DIR) $(1)/tmp
  41. $(INSTALL_CONF) ./files/simple-adblock.conf.update $(1)/tmp/simple-adblock.conf.update
  42. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  43. $(INSTALL_BIN) ./files/simple-adblock.hotplug $(1)/etc/hotplug.d/iface/80-simple-adblock
  44. endef
  45. define Package/simple-adblock/postinst
  46. #!/bin/sh
  47. # check if we are on real system
  48. if [ -z "$${IPKG_INSTROOT}" ]; then
  49. sed -f /tmp/simple-adblock.conf.update -i /etc/config/simple-adblock || true
  50. /etc/init.d/simple-adblock enable
  51. fi
  52. exit 0
  53. endef
  54. define Package/simple-adblock/prerm
  55. #!/bin/sh
  56. # check if we are on real system
  57. if [ -z "$${IPKG_INSTROOT}" ]; then
  58. echo "Stopping service and removing rc.d symlink for simple-adblock"
  59. /etc/init.d/simple-adblock stop || true
  60. /etc/init.d/simple-adblock killcache || true
  61. /etc/init.d/simple-adblock disable || true
  62. fi
  63. exit 0
  64. endef
  65. $(eval $(call BuildPackage,simple-adblock))