Skip to content
Snippets Groups Projects
Verified Commit 30f22443 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

patches/openwrt: fix hotplug script patch

This is new version of patch pulled from v4.1 branch of turris-build.
parent 401d9c63
Branches
Tags
2 merge requests!123Turris OS 5.0 (HBK),!89WIP: Refactor/configs
From 3bd9f7fbae315820a88f173e6ab44c83e03837bf Mon Sep 17 00:00:00 2001
From 889000a0661b5e9fd40887e6d0060bf157cc1308 Mon Sep 17 00:00:00 2001
From: Jan Pavlinec <jan.pavlinec@nic.cz>
Date: Thu, 7 Mar 2019 16:27:22 +0100
Subject: [PATCH] base-files: add sh script detection to hotplug-call
Date: Thu, 7 Mar 2019 16:55:16 +0100
Subject: [PATCH] base-files: don't source script in hotplug-call if is
executable
Note: This should also fix the situation when hotplug-call
tries to source nonshell scripts and don't break case when
shell hotplug script is installed without executable permission
Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
---
package/base-files/files/sbin/hotplug-call | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
package/base-files/files/sbin/hotplug-call | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/package/base-files/files/sbin/hotplug-call b/package/base-files/files/sbin/hotplug-call
index 28e957c..f7a3767 100755
index 28e957c3982..dcbd39cb3b0 100755
--- a/package/base-files/files/sbin/hotplug-call
+++ b/package/base-files/files/sbin/hotplug-call
@@ -13,6 +13,12 @@ export DEVICENAME="${DEVPATH##*/}"
@@ -13,6 +13,8 @@ export DEVICENAME="${DEVPATH##*/}"
[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
- [ -f $script ] && . $script
+ if [ -f $script ]; then
+ if grep -q '#!/bin/sh' "$script"; then
+ . $script
+ else
+ $script
+ fi
+ if [ -f "$script" ]; then
+ [ -x $script ] && $script || . $script
+ fi
); done
}
--
2.7.4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment