Compare commits

...

2 Commits

Author SHA1 Message Date
action
c65bea94f4 update 2026-07-13 10:13:10 2026-07-13 10:13:10 +08:00
action
088f4a6b57 update 2026-07-13 04:38:37 2026-07-13 04:38:37 +08:00
2 changed files with 20 additions and 6 deletions

View File

@ -64,4 +64,15 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua $(1)/usr/lib/lua/internet-detector/modules/mod_regular_script.lua $(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua $(1)/usr/lib/lua/internet-detector/modules/mod_regular_script.lua
endef endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
ID_CONF="/etc/internet-detector"
SYSUP_CONF="/etc/sysupgrade.conf"
grep -e "^$${ID_CONF}" "$$SYSUP_CONF" > /dev/null || echo "$$ID_CONF" >> "$$SYSUP_CONF"
exit 0
endef
$(eval $(call BuildPackage,$(PKG_NAME))) $(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -160,25 +160,28 @@ insert_nftset() {
*) suffix=" timeout $timeout_argument" ;; *) suffix=" timeout $timeout_argument" ;;
esac esac
{ {
if [ $# -gt 0 ]; then if [ $# -gt 0 ] && [ $# -le 1000 ]; then
printf "%s\n" "$@" printf "%s\n" "$@"
elif [ $# -gt 1000 ]; then
printf "%s\n" "$*"
else else
cat cat
fi | awk -v s="$suffix" -v n="$nftset_name" -v t="$NFTABLE_NAME" ' fi | awk -v s="$suffix" -v n="$nftset_name" -v t="$NFTABLE_NAME" '
BEGIN { BEGIN {
RS = "[ \t\n\r]+" RS = "[ \t\n\r]+"
ORS = ""
} }
$0 != "" { $0 != "" {
if (first == 0) { if (!first) {
printf "add element %s %s { \n", t, n; printf "add element %s %s { \n", t, n
first = 1; first = 1;
} else { } else {
printf ",\n"; print ",\n"
} }
printf "%s%s", $0, s; print $0 s
} }
END { END {
if (first == 1) printf "\n }\n"; if (first) print "\n }\n"
} }
' '
} | nft -f - } | nft -f -