1 # Copyright 2024 friendly-bits, antonk (antonk.d3v@gmail.com)
2 # This is free software, licensed under the GNU General Public License v3.
4 include $(TOPDIR
)/rules.mk
9 PKG_LICENSE
:=GPL-3.0
-or-later
10 PKG_MAINTAINER
:=antonk
<antonk.d3v@gmail.com
>
12 PKG_SOURCE_VERSION
:=db8bbf4ce04094843beea1b1aa4fbceb0d35688d
13 PKG_SOURCE_URL
:=https
://github.com
/friendly-bits
/geoip-shell-openwrt.git
14 PKG_MIRROR_HASH
:=4b0b90a936b8e9b476a0b85bd2100fcc4d1da25cd6929c0bcc282ae7ff137e9f
16 include $(INCLUDE_DIR
)/package.mk
18 define Package
/geoip-shell
/Default
20 TITLE
:=Flexible geoip blocker
21 URL
:=https
://github.com
/friendly-bits
/geoip-shell
22 MAINTAINER
:=antonk
<antonk.d3v@gmail.com
>
28 define Package
/geoip-shell
29 $(call Package
/geoip-shell
/Default
)
30 TITLE
+= with nftables support
31 DEPENDS
+= +kmod-nft-core
+nftables
+firewall4
36 define Package
/geoip-shell-iptables
37 $(call Package
/geoip-shell
/Default
)
38 TITLE
+= with iptables support
39 DEPENDS
+= +kmod-ipt-ipset
+IPV6
:ip6tables
+iptables
+ipset
41 CONFLICTS
:=geoip-shell firewall4
44 define Package
/geoip-shell
/description
/Default
45 Flexible geoip blocker with a user-friendly command line interface
(currently no LuCi interface
).
46 For readme
, please see
47 https
://github.com
/openwrt
/packages
/blob
/master
/net
/geoip-shell
/OpenWrt-README.md
50 define Package
/geoip-shell
/description
51 $(call Package
/geoip-shell
/description
/Default
)
54 define Package
/geoip-shell-iptables
/description
55 $(call Package
/geoip-shell
/description
/Default
)
58 define Package
/geoip-shell
/postinst
/Default
60 rm "/usr/bin/geoip-shell" 2>/dev
/null
61 ln
-s
"/usr/bin/geoip-shell-manage.sh" "/usr/bin/geoip-shell"
62 [ -s
"/etc/geoip-shell/geoip-shell.conf" ] && /usr
/bin
/geoip-shell configure
-z
&& exit
0
63 logger
-s
-t
"geoip-shell" "Please run 'geoip-shell configure' to complete the setup."
67 define Package
/geoip-shell
/postinst
68 $(call Package
/geoip-shell
/postinst
/Default
)
71 define Package
/geoip-shell-iptables
/postinst
72 $(call Package
/geoip-shell
/postinst
/Default
)
75 define Package
/geoip-shell
/prerm
/Default
77 sh
/usr
/lib
/geoip-shell
/geoip-shell-owrt-uninstall.sh
81 define Package
/geoip-shell
/prerm
82 $(call Package
/geoip-shell
/prerm
/Default
)
85 define Package
/geoip-shell-iptables
/prerm
86 $(call Package
/geoip-shell
/prerm
/Default
)
89 define Package
/geoip-shell
/postrm
92 echo
"Reloading the firewall..."
97 define Package
/geoip-shell-iptables
/postrm
100 echo
"Reloading the firewall..."
105 define Build
/Configure
111 define Package
/geoip-shell
/install/Default
113 $(INSTALL_DIR
) $(1)/etc
/init.d
114 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/etc
/init.d
/geoip-shell-init
$(1)/etc
/init.d
116 $(INSTALL_DIR
) $(1)/etc
/geoip-shell
117 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/etc
/geoip-shell
/cca2.list
$(1)/etc
/geoip-shell
118 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/etc
/geoip-shell
/geoip-shell.const
$(1)/etc
/geoip-shell
120 $(INSTALL_DIR
) $(1)/usr
/bin
121 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-fetch.sh
$(1)/usr
/bin
122 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-fw-include.sh
$(1)/usr
/bin
123 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-backup.sh
$(1)/usr
/bin
124 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-geoinit.sh
$(1)/usr
/bin
125 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-run.sh
$(1)/usr
/bin
126 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-mk-fw-include.sh
$(1)/usr
/bin
127 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-manage.sh
$(1)/usr
/bin
128 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-apply.sh
$(1)/usr
/bin
129 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-detect-lan.sh
$(1)/usr
/bin
130 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/usr
/bin
/geoip-shell-cronsetup.sh
$(1)/usr
/bin
132 $(INSTALL_DIR
) $(1)/usr
/lib
/geoip-shell
133 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-status.sh
$(1)/usr
/lib
/geoip-shell
134 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-owrt-common.sh
$(1)/usr
/lib
/geoip-shell
135 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-common.sh
$(1)/usr
/lib
/geoip-shell
136 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-owrt-uninstall.sh
$(1)/usr
/lib
/geoip-shell
137 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-arrays.sh
$(1)/usr
/lib
/geoip-shell
138 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-setup.sh
$(1)/usr
/lib
/geoip-shell
139 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-uninstall.sh
$(1)/usr
/lib
/geoip-shell
144 define Package
/geoip-shell
/install
145 $(call Package
/geoip-shell
/install/Default
,$(1))
146 $(INSTALL_DIR
) $(1)/usr
/lib
/geoip-shell
147 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-nft.sh
$(1)/usr
/lib
/geoip-shell
152 define Package
/geoip-shell-iptables
/install
153 $(call Package
/geoip-shell
/install/Default
,$(1))
154 $(INSTALL_DIR
) $(1)/usr
/lib
/geoip-shell
155 $(INSTALL_CONF
) $(PKG_BUILD_DIR
)/usr
/lib
/geoip-shell
/geoip-shell-lib-ipt.sh
$(1)/usr
/lib
/geoip-shell
159 $(eval
$(call BuildPackage
,geoip-shell
))
160 $(eval
$(call BuildPackage
,geoip-shell-iptables
))