mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-07-27 08:31:44 +08:00
Compare commits
2 Commits
dc61ff94d8
...
c65bea94f4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c65bea94f4 | ||
|
|
088f4a6b57 |
@ -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
|
||||
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)))
|
||||
|
||||
@ -160,25 +160,28 @@ insert_nftset() {
|
||||
*) suffix=" timeout $timeout_argument" ;;
|
||||
esac
|
||||
{
|
||||
if [ $# -gt 0 ]; then
|
||||
if [ $# -gt 0 ] && [ $# -le 1000 ]; then
|
||||
printf "%s\n" "$@"
|
||||
elif [ $# -gt 1000 ]; then
|
||||
printf "%s\n" "$*"
|
||||
else
|
||||
cat
|
||||
fi | awk -v s="$suffix" -v n="$nftset_name" -v t="$NFTABLE_NAME" '
|
||||
BEGIN {
|
||||
RS = "[ \t\n\r]+"
|
||||
ORS = ""
|
||||
}
|
||||
$0 != "" {
|
||||
if (first == 0) {
|
||||
printf "add element %s %s { \n", t, n;
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
first = 1;
|
||||
} else {
|
||||
printf ",\n";
|
||||
print ",\n"
|
||||
}
|
||||
printf "%s%s", $0, s;
|
||||
print $0 s
|
||||
}
|
||||
END {
|
||||
if (first == 1) printf "\n }\n";
|
||||
if (first) print "\n }\n"
|
||||
}
|
||||
'
|
||||
} | nft -f -
|
||||
|
||||
Loading…
Reference in New Issue
Block a user