6cc7cf504bc22c4a943ce582439cf48110cf7ac8
[feed/packages.git] / net / simple-adblock / Makefile
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
5 include $(TOPDIR)/rules.mk
6
7 PKG_NAME:=simple-adblock
8 PKG_VERSION:=1.8.3
9 PKG_RELEASE:=13
10 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
11 PKG_LICENSE:=GPL-3.0-or-later
12
13 include $(INCLUDE_DIR)/package.mk
14
15 define Package/simple-adblock
16 SECTION:=net
17 CATEGORY:=Network
18 TITLE:=Simple AdBlock Service
19 DEPENDS:=+jshn +jsonfilter
20 PKGARCH:=all
21 endef
22
23 define Package/simple-adblock/description
24 Simple adblock script to block ad or abuse/malware domains with DNSMASQ or Unbound.
25 Script supports local/remote list of domains and hosts-files for both black- and white-listing.
26 Please see https://github.com/openwrt/packages/blob/master/net/simple-adblock/files/README.md for more information.
27
28 endef
29
30 define Package/simple-adblock/conffiles
31 /etc/config/simple-adblock
32 endef
33
34 define Build/Prepare
35 mkdir -p $(PKG_BUILD_DIR)/files/
36 $(CP) ./files/simple-adblock.init $(PKG_BUILD_DIR)/files/simple-adblock.init
37 sed -i "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(PKG_BUILD_DIR)/files/simple-adblock.init
38 endef
39
40 define Build/Configure
41 endef
42
43 define Build/Compile
44 endef
45
46 define Package/simple-adblock/install
47 $(INSTALL_DIR) $(1)/etc/init.d
48 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/simple-adblock.init $(1)/etc/init.d/simple-adblock
49 $(INSTALL_DIR) $(1)/etc/config
50 $(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
51 $(INSTALL_DIR) $(1)/tmp
52 $(INSTALL_CONF) ./files/simple-adblock.conf.update $(1)/tmp/simple-adblock.conf.update
53 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
54 $(INSTALL_BIN) ./files/simple-adblock.hotplug $(1)/etc/hotplug.d/iface/80-simple-adblock
55 endef
56
57 define Package/simple-adblock/postinst
58 #!/bin/sh
59 # check if we are on real system
60 if [ -z "$${IPKG_INSTROOT}" ]; then
61 sed -f /tmp/simple-adblock.conf.update -i /etc/config/simple-adblock || true
62 /etc/init.d/simple-adblock enable
63 fi
64 exit 0
65 endef
66
67 define Package/simple-adblock/prerm
68 #!/bin/sh
69 # check if we are on real system
70 if [ -z "$${IPKG_INSTROOT}" ]; then
71 echo "Stopping service and removing rc.d symlink for simple-adblock"
72 /etc/init.d/simple-adblock stop || true
73 /etc/init.d/simple-adblock killcache || true
74 /etc/init.d/simple-adblock disable || true
75 fi
76 exit 0
77 endef
78
79 $(eval $(call BuildPackage,simple-adblock))