🤞 Sync 2026-04-23 06:19:46

This commit is contained in:
github-actions[bot]
2026-04-23 06:19:46 +08:00
parent a1df15cd3d
commit b86d032e91
250 changed files with 41507 additions and 188 deletions
+38
View File
@@ -0,0 +1,38 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hotplug-generator
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/hotplug-generator
include $(INCLUDE_DIR)/package.mk
define Package/hotplug-generator
TITLE:=generator of hotplug scripts
SECTION:=utils
CATEGORY:=Utilities
PKGARCH:=all
endef
define Package/hotplug-generator/description
This package contains additional scripts and configuration files for generation hotplug scripts
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/hotplug-generator/install
$(INSTALL_DIR) $(1)/etc/config
$(CP) ./files/hotplug.config $(1)/etc/config/hotplug
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/hotplug.init $(1)/etc/init.d/hotplug
endef
$(eval $(call BuildPackage,hotplug-generator))
+8
View File
@@ -0,0 +1,8 @@
config iface 'gre'
option action 'ifup'
option enabled '0'
list command 'sleep 5'
list command 'ip route add 10.10.1.1 dev $DEVICE'
list command 'ip route add 192.168.13.1 dev $DEVICE'
option description 'GRE: +routes via $DEVICE after 5s'
option interface 'gre_tun2'
+50
View File
@@ -0,0 +1,50 @@
#!/bin/sh /etc/rc.common
START=10
USE_PROCD=1
IFACE_PATH="/etc/hotplug.d/iface/90-hp-generator"
add_iface_rule() {
local enabled action command description interface
config_get enabled "$1" enabled
[ "$enabled" = "0" ] && continue
config_get action "$1" action
config_get description "$1" description
config_get interface "$1" interface
echo "#!/bin/sh" >> "$IFACE_PATH-$1"
echo "# Generated automatically, to change it use /etc/config/hotplug" >> "$IFACE_PATH-$1"
description=$(echo $description | tr '\n' ' ')
echo "# Description: $description" >> "$IFACE_PATH-$1"
echo "" >> "$IFACE_PATH-$1"
echo "if [ \"\$ACTION\" = \"$action\" ]; then" >> "$IFACE_PATH-$1"
echo " if [ \"\$INTERFACE\" = \"$interface\" ]; then" >> "$IFACE_PATH-$1"
command_list=$(uci -q get hotplug."$1".command)
[ "${command_list:0:1}" = "'" ] && command_list=$(echo ${command_list:1})
[ "${command_list: -1}" = "'" ] && command_list=$(echo ${command_list:0:-1})
i=0
while true ; do
i=$((i+1))
command=$(echo $command_list | awk -v i=$i -F "' '" '{print $i}')
[ -z "$command" ] && break
echo " $command" >> "$IFACE_PATH-$1"
done
echo " fi" >> "$IFACE_PATH-$1"
echo "fi" >> "$IFACE_PATH-$1"
echo "exit 0" >> "$IFACE_PATH-$1"
}
start_service() {
rm "$IFACE_PATH-"* 2>/dev/null
config_load hotplug
config_foreach add_iface_rule iface
}
service_triggers() {
procd_add_reload_trigger "hotplug"
}