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.3 KiB

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