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:=10
  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. URL:=https://docs.openwrt.melmac.net/simple-adblock/
  16. DEPENDS:=+jshn
  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_BIN) ./files/simple-adblock.init $(1)/etc/init.d/simple-adblock
  34. sed -i "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/simple-adblock
  35. $(INSTALL_DIR) $(1)/etc/config
  36. $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
  37. $(INSTALL_DIR) $(1)/tmp
  38. $(INSTALL_CONF) ./files/simple-adblock.conf.update $(1)/tmp/simple-adblock.conf.update
  39. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  40. $(INSTALL_BIN) ./files/simple-adblock.hotplug $(1)/etc/hotplug.d/iface/80-simple-adblock
  41. endef
  42. define Package/simple-adblock/postinst
  43. #!/bin/sh
  44. # check if we are on real system
  45. if [ -z "$${IPKG_INSTROOT}" ]; then
  46. sed -f /tmp/simple-adblock.conf.update -i /etc/config/simple-adblock || true
  47. /etc/init.d/simple-adblock enable
  48. fi
  49. exit 0
  50. endef
  51. define Package/simple-adblock/prerm
  52. #!/bin/sh
  53. # check if we are on real system
  54. if [ -z "$${IPKG_INSTROOT}" ]; then
  55. echo "Stopping service and removing rc.d symlink for simple-adblock"
  56. /etc/init.d/simple-adblock stop || true
  57. /etc/init.d/simple-adblock killcache || true
  58. /etc/init.d/simple-adblock disable || true
  59. fi
  60. exit 0
  61. endef
  62. $(eval $(call BuildPackage,simple-adblock))