mirror of
https://github.com/openwrt/packages.git
synced 2025-02-07 03:29:52 +00:00
Changes since v0.5: Bugfixes: - bugfix: 'geoip-shell on' command errors out on iptables-based systems - bugfix: when changing the update cron schedule, old cron job does not get removed - bugfix: in some edge cases, the update cron job may not be created - bugfix: incorrect mask bits used when creating a rule allowing ipv6 link-local connections (/8 instead of /10) - bugfix: geoip-shell-fetch.sh: fix running without root permissions Improvements: - nftables variant: attach the base chain to the prerouting netfilter hook with priority -141 (rather than -150) to make rules processing deterministic when other rules exist which have priority 'mangle' (-150), making it easier to create custom rules which will be processed before geoip-shell rules - include information on currently used firewall backend utility (nftables or iptables) in the status report - avoid unnecessary re-fetching of ip lists when running 'geoip-shell configure' - randomize the default update schedule's minute between 10 and 20 (previously was always 15) - randomize the automatic update second between 0 and 59 - improve console messages and the status report - update and improve the general documentation - improve OpenWrt-specific documentation Signed-off-by: Anton Khazan <antonk.d3v@gmail.com>
163 lines
5.2 KiB
Makefile
163 lines
5.2 KiB
Makefile
# Copyright 2024 friendly-bits, antonk (antonk.d3v@gmail.com)
|
|
# This is free software, licensed under the GNU General Public License v3.
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=geoip-shell
|
|
PKG_VERSION:=0.5.2
|
|
PKG_RELEASE:=1
|
|
PKG_LICENSE:=GPL-3.0-or-later
|
|
PKG_MAINTAINER:=antonk <antonk.d3v@gmail.com>
|
|
PKG_SOURCE_PROTO:=git
|
|
PKG_SOURCE_VERSION:=db8bbf4ce04094843beea1b1aa4fbceb0d35688d
|
|
PKG_SOURCE_URL:=https://github.com/friendly-bits/geoip-shell-openwrt.git
|
|
PKG_MIRROR_HASH:=4b0b90a936b8e9b476a0b85bd2100fcc4d1da25cd6929c0bcc282ae7ff137e9f
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/geoip-shell/Default
|
|
CATEGORY:=Network
|
|
TITLE:=Flexible geoip blocker
|
|
URL:=https://github.com/friendly-bits/geoip-shell
|
|
MAINTAINER:=antonk <antonk.d3v@gmail.com>
|
|
DEPENDS:=+ca-bundle
|
|
PROVIDES:=geoip-shell
|
|
PKGARCH:=all
|
|
endef
|
|
|
|
define Package/geoip-shell
|
|
$(call Package/geoip-shell/Default)
|
|
TITLE+= with nftables support
|
|
DEPENDS+= +kmod-nft-core +nftables +firewall4
|
|
DEFAULT_VARIANT:=1
|
|
VARIANT:=nftables
|
|
endef
|
|
|
|
define Package/geoip-shell-iptables
|
|
$(call Package/geoip-shell/Default)
|
|
TITLE+= with iptables support
|
|
DEPENDS+= +kmod-ipt-ipset +IPV6:ip6tables +iptables +ipset
|
|
VARIANT:=iptables
|
|
CONFLICTS:=geoip-shell firewall4
|
|
endef
|
|
|
|
define Package/geoip-shell/description/Default
|
|
Flexible geoip blocker with a user-friendly command line interface (currently no LuCi interface).
|
|
For readme, please see
|
|
https://github.com/openwrt/packages/blob/master/net/geoip-shell/OpenWrt-README.md
|
|
endef
|
|
|
|
define Package/geoip-shell/description
|
|
$(call Package/geoip-shell/description/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell-iptables/description
|
|
$(call Package/geoip-shell/description/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell/postinst/Default
|
|
#!/bin/sh
|
|
rm "/usr/bin/geoip-shell" 2>/dev/null
|
|
ln -s "/usr/bin/geoip-shell-manage.sh" "/usr/bin/geoip-shell"
|
|
[ -s "/etc/geoip-shell/geoip-shell.conf" ] && /usr/bin/geoip-shell configure -z && exit 0
|
|
logger -s -t "geoip-shell" "Please run 'geoip-shell configure' to complete the setup."
|
|
exit 0
|
|
endef
|
|
|
|
define Package/geoip-shell/postinst
|
|
$(call Package/geoip-shell/postinst/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell-iptables/postinst
|
|
$(call Package/geoip-shell/postinst/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell/prerm/Default
|
|
#!/bin/sh
|
|
sh /usr/lib/geoip-shell/geoip-shell-owrt-uninstall.sh
|
|
exit 0
|
|
endef
|
|
|
|
define Package/geoip-shell/prerm
|
|
$(call Package/geoip-shell/prerm/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell-iptables/prerm
|
|
$(call Package/geoip-shell/prerm/Default)
|
|
endef
|
|
|
|
define Package/geoip-shell/postrm
|
|
#!/bin/sh
|
|
sleep 1
|
|
echo "Reloading the firewall..."
|
|
fw4 -q reload
|
|
exit 0
|
|
endef
|
|
|
|
define Package/geoip-shell-iptables/postrm
|
|
#!/bin/sh
|
|
sleep 1
|
|
echo "Reloading the firewall..."
|
|
fw3 -q reload
|
|
exit 0
|
|
endef
|
|
|
|
define Build/Configure
|
|
endef
|
|
|
|
define Build/Compile
|
|
endef
|
|
|
|
define Package/geoip-shell/install/Default
|
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/etc/init.d/geoip-shell-init $(1)/etc/init.d
|
|
|
|
$(INSTALL_DIR) $(1)/etc/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/etc/geoip-shell/cca2.list $(1)/etc/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/etc/geoip-shell/geoip-shell.const $(1)/etc/geoip-shell
|
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-fetch.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-fw-include.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-backup.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-geoinit.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-run.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-mk-fw-include.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-manage.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-apply.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-detect-lan.sh $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/bin/geoip-shell-cronsetup.sh $(1)/usr/bin
|
|
|
|
$(INSTALL_DIR) $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-status.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-owrt-common.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-common.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-owrt-uninstall.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-arrays.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-setup.sh $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-uninstall.sh $(1)/usr/lib/geoip-shell
|
|
|
|
endef
|
|
|
|
|
|
define Package/geoip-shell/install
|
|
$(call Package/geoip-shell/install/Default,$(1))
|
|
$(INSTALL_DIR) $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-nft.sh $(1)/usr/lib/geoip-shell
|
|
|
|
endef
|
|
|
|
|
|
define Package/geoip-shell-iptables/install
|
|
$(call Package/geoip-shell/install/Default,$(1))
|
|
$(INSTALL_DIR) $(1)/usr/lib/geoip-shell
|
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/usr/lib/geoip-shell/geoip-shell-lib-ipt.sh $(1)/usr/lib/geoip-shell
|
|
|
|
endef
|
|
|
|
$(eval $(call BuildPackage,geoip-shell))
|
|
$(eval $(call BuildPackage,geoip-shell-iptables))
|
|
|
|
|