Merge pull request #14510 from zhanhb/ddns-scripts
[feed/packages.git] / net / safe-search / Makefile
1 #
2 # Copyright (c) 2021 Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
3 # This is free software, licensed under the MIT License
4 #
5
6 include $(TOPDIR)/rules.mk
7
8 PKG_NAME:=safe-search
9 PKG_VERSION:=2.0.0
10 PKG_RELEASE:=1
11 PKG_LICENSE:=MIT
12 PKG_MAINTAINER:=Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
13
14 include $(INCLUDE_DIR)/package.mk
15
16 define Package/safe-search
17 SECTION:=net
18 CATEGORY:=Network
19 TITLE:=Safe Search
20 PKGARCH:=all
21 endef
22
23 define Package/safe-search/description
24 This package prevents adult content from appearing in search results by
25 configuring dnsmasq to force all devices on your network to use Google and
26 Bing's Safe Search IP addresses. This is designed to be approperiate for most
27 businesses and families. The default filtering rules do not interfere with
28 normal web browsing.
29 endef
30
31 define Package/safe-search/conffiles
32 /etc/config/safe-search
33 endef
34
35 define Build/Compile
36 endef
37
38 define Package/safe-search/install
39 $(INSTALL_DIR) $(1)/etc/uci-defaults
40 $(CP) ./files/safe-search.defaults $(1)/etc/uci-defaults/safe-search
41
42 $(INSTALL_DIR) $(1)/etc/config
43 $(INSTALL_CONF) ./files/safe-search.conf $(1)/etc/config/safe-search
44
45 $(INSTALL_DIR) $(1)/usr/sbin
46 $(INSTALL_BIN) ./files/safe-search-update $(1)/usr/sbin/safe-search-update
47 $(INSTALL_BIN) ./files/safe-search-maintenance $(1)/usr/sbin/safe-search-maintenance
48
49 $(INSTALL_DIR) $(1)/etc/safe-search/enabled
50 $(INSTALL_DIR) $(1)/etc/safe-search/available
51 $(INSTALL_DATA) ./files/hosts/* $(1)/etc/safe-search/available/
52 endef
53
54 define Package/safe-search/postinst
55 #!/bin/sh
56 if [ -z "$${IPGK_INSTROOT}" ]; then
57 echo "0 * * * * /bin/nice /usr/sbin/safe-search-maintenance>/dev/null 2>&1">>/etc/crontabs/root
58 /etc/init.d/cron restart
59 fi
60 exit 0
61 endef
62
63 define Package/safe-search/prerm
64 #!/bin/sh
65 if [ -z "$${IPGK_INSTROOT}" ]; then
66 uci del_list dhcp.@dnsmasq[0].addnhosts=/etc/safe-search/enabled
67 uci commit dhcp
68 /etc/init.d/dnsmasq reload
69 crontab -l | grep -v "safe-search-maintenance" | sort | uniq | crontab -
70 fi
71 exit 0
72 endef
73
74 define Package/safe-search/postrm
75 #!/bin/sh
76 if [ -z "$${IPGK_INSTROOT}" ]; then
77 rm -rf /etc/safe-search/enabled
78 rmdir /etc/safe-search/available
79 rmdir /etc/safe-search/
80 fi
81 exit 0
82 endef
83
84 $(eval $(call BuildPackage,safe-search))