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.

84 lines
2.2 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.0
  8. PKG_RELEASE:=2
  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. echo "0 * * * * /bin/nice /usr/sbin/safe-search-maintenance>/dev/null 2>&1">>/etc/crontabs/root
  46. /etc/init.d/cron restart
  47. fi
  48. exit 0
  49. endef
  50. define Package/safe-search/prerm
  51. #!/bin/sh
  52. if [ -z "$${IPKG_INSTROOT}" ]; then
  53. uci del_list dhcp.@dnsmasq[0].addnhosts=/etc/safe-search/enabled
  54. uci commit dhcp
  55. /etc/init.d/dnsmasq reload
  56. crontab -l | grep -v "safe-search-maintenance" | sort | uniq | crontab -
  57. fi
  58. exit 0
  59. endef
  60. define Package/safe-search/postrm
  61. #!/bin/sh
  62. if [ -z "$${IPKG_INSTROOT}" ]; then
  63. rm -rf /etc/safe-search/enabled
  64. rmdir /etc/safe-search/available
  65. rmdir /etc/safe-search/
  66. fi
  67. exit 0
  68. endef
  69. $(eval $(call BuildPackage,safe-search))