Files
ruantiblock_openwrt/ruantiblock/Makefile
T

98 lines
3.1 KiB
Makefile
Raw Normal View History

2021-02-01 02:38:08 +03:00
#
2024-02-27 17:31:44 +03:00
# (с) 2024 gSpot (https://github.com/gSpotx2f/ruantiblock_openwrt)
2021-02-01 02:38:08 +03:00
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock
2023-12-10 17:02:06 +03:00
PKG_VERSION:=1.4
2023-12-24 16:13:41 +03:00
PKG_RELEASE:=1
2021-02-01 02:38:08 +03:00
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
2021-12-17 17:01:46 +03:00
SECTION:=net
CATEGORY:=Network
TITLE:=Ruantiblock
URL:=https://github.com/gSpotx2f/ruantiblock_openwrt
PKGARCH:=all
2023-02-09 20:53:20 +03:00
DEPENDS:=+dnsmasq-full
2021-02-01 02:38:08 +03:00
endef
define Package/$(PKG_NAME)/description
endef
define Package/$(PKG_NAME)/conffiles
2023-04-26 17:50:23 +03:00
/etc/config/ruantiblock
/etc/ruantiblock/ruantiblock.conf
/etc/ruantiblock/fqdn_filter
/etc/ruantiblock/ip_filter
/etc/ruantiblock/user_entries
2023-07-31 01:12:53 +03:00
/etc/ruantiblock/bypass_entries
2021-12-17 17:01:46 +03:00
endef
define Build/Configure
2021-02-01 02:38:08 +03:00
endef
2021-12-17 17:01:46 +03:00
define Build/Compile
2021-02-01 02:38:08 +03:00
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/config
2021-12-17 17:01:46 +03:00
$(INSTALL_CONF) ./files/etc/config/ruantiblock $(1)/etc/config/ruantiblock
2021-02-01 02:38:08 +03:00
$(INSTALL_DIR) $(1)/etc/init.d
2021-12-17 17:01:46 +03:00
$(INSTALL_BIN) ./files/etc/init.d/ruantiblock $(1)/etc/init.d/ruantiblock
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/40-ruantiblock $(1)/etc/hotplug.d/iface/40-ruantiblock
$(INSTALL_DIR) $(1)/etc/ruantiblock
$(INSTALL_CONF) ./files/etc/ruantiblock/ruantiblock.conf $(1)/etc/ruantiblock/ruantiblock.conf
2023-04-26 17:50:23 +03:00
$(INSTALL_DATA) ./files/etc/ruantiblock/fqdn_filter $(1)/etc/ruantiblock/fqdn_filter
$(INSTALL_DATA) ./files/etc/ruantiblock/ip_filter $(1)/etc/ruantiblock/ip_filter
$(INSTALL_DATA) ./files/etc/ruantiblock/user_entries $(1)/etc/ruantiblock/user_entries
2023-07-31 01:12:53 +03:00
$(INSTALL_DATA) ./files/etc/ruantiblock/bypass_entries $(1)/etc/ruantiblock/bypass_entries
2023-04-24 17:59:35 +03:00
$(INSTALL_DIR) $(1)/usr/share/ruantiblock
$(INSTALL_DATA) ./files/usr/share/ruantiblock/config_script $(1)/usr/share/ruantiblock/config_script
$(INSTALL_DATA) ./files/usr/share/ruantiblock/info_output $(1)/usr/share/ruantiblock/info_output
$(INSTALL_DATA) ./files/usr/share/ruantiblock/nft_functions $(1)/usr/share/ruantiblock/nft_functions
2023-12-10 17:02:06 +03:00
$(INSTALL_DIR) $(1)/usr/libexec/ruantiblock
$(INSTALL_BIN) ./files/usr/libexec/ruantiblock/ruab_route_check $(1)/usr/libexec/ruantiblock/ruab_route_check
2021-12-17 17:01:46 +03:00
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/ruantiblock $(1)/usr/bin/ruantiblock
2021-02-01 02:38:08 +03:00
endef
define Package/$(PKG_NAME)/preinst
#!/bin/sh
2022-05-10 01:22:25 +03:00
FILE_MAIN_SCRIPT="/usr/bin/ruantiblock"
2021-02-01 02:38:08 +03:00
test -e "$$FILE_MAIN_SCRIPT" && $$FILE_MAIN_SCRIPT destroy
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
FILE_INIT_SCRIPT="/etc/init.d/ruantiblock"
2022-05-10 01:22:25 +03:00
FILE_MAIN_SCRIPT="/usr/bin/ruantiblock"
2021-02-01 02:38:08 +03:00
CRONTAB_FILE="/etc/crontabs/root"
2023-07-31 01:12:53 +03:00
DNSMASQ_DATA_FILE="/tmp/dnsmasq.d/02-ruantiblock.dnsmasq"
DNSMASQ_DATA_FILE_BYPASS="/tmp/dnsmasq.d/01-ruantiblock_bypass.dnsmasq"
2021-02-01 02:38:08 +03:00
2023-07-31 01:12:53 +03:00
rm -f $$DNSMASQ_DATA_FILE $$DNSMASQ_DATA_FILE_BYPASS
2021-02-01 02:38:08 +03:00
test -e "$$FILE_MAIN_SCRIPT" && $$FILE_MAIN_SCRIPT destroy
test -e "$$FILE_INIT_SCRIPT" && $$FILE_INIT_SCRIPT disable
awk -v FILE_MAIN_SCRIPT="$$FILE_MAIN_SCRIPT" '$$0 !~ FILE_MAIN_SCRIPT {
print $$0;
}' "$$CRONTAB_FILE" > "$${CRONTAB_FILE}.tmp" && mv -f "$${CRONTAB_FILE}.tmp" "$$CRONTAB_FILE"
/etc/init.d/cron restart
exit 0
endef
$(eval $(call BuildPackage,$(PKG_NAME)))