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.

85 lines
2.5 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.1
  7. PKG_RELEASE:=7
  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. PKGARCH:=all
  16. endef
  17. define Package/simple-adblock/description
  18. This service provides DNSMASQ or Unbound based ad blocking.
  19. Please see the project's README at github for further information.
  20. endef
  21. define Package/simple-adblock/conffiles
  22. /etc/config/simple-adblock
  23. endef
  24. define Build/Prepare
  25. mkdir -p $(PKG_BUILD_DIR)/files/
  26. $(CP) ./files/simple-adblock.init $(PKG_BUILD_DIR)/files/simple-adblock.init
  27. sed -i "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(PKG_BUILD_DIR)/files/simple-adblock.init
  28. endef
  29. define Build/Configure
  30. endef
  31. define Build/Compile
  32. endef
  33. define Package/simple-adblock/install
  34. $(INSTALL_DIR) $(1)/etc/init.d
  35. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/simple-adblock.init $(1)/etc/init.d/simple-adblock
  36. $(INSTALL_DIR) $(1)/etc/config
  37. $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
  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. /etc/init.d/simple-adblock enable
  46. while uci -q del ucitrack.@simple-adblock[-1]; do :; done
  47. uci -q batch <<-EOF >/dev/null
  48. add ucitrack simple-adblock
  49. set ucitrack.@simple-adblock[0].init='simple-adblock'
  50. commit ucitrack
  51. EOF
  52. fi
  53. exit 0
  54. endef
  55. define Package/simple-adblock/prerm
  56. #!/bin/sh
  57. # check if we are on real system
  58. if [ -z "$${IPKG_INSTROOT}" ]; then
  59. while uci -q del ucitrack.@simple-adblock[-1]; do :; done
  60. echo "Stopping service and removing rc.d symlink for simple-adblock"
  61. uci -q del_list dhcp.@dnsmasq[0].addnhosts="/var/run/simple-adblock.addnhosts" || true
  62. if [ "$$(uci -q get dhcp.@dnsmasq[0].serversfile)" == "/var/run/simple-adblock.servers" ]; then
  63. uci -q del dhcp.@dnsmasq[0].serversfile || true
  64. fi
  65. /etc/init.d/simple-adblock stop || true
  66. /etc/init.d/simple-adblock killcache || true
  67. /etc/init.d/simple-adblock disable || true
  68. fi
  69. exit 0
  70. endef
  71. $(eval $(call BuildPackage,simple-adblock))