2014-07-26 14:11:27 +00:00
|
|
|
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
|
|
Date: Wed, 6 Aug 2014 19:12:00 +0200
|
|
|
|
Subject: procd: add support for alternative rc.d directories
|
|
|
|
|
|
|
|
diff --git a/package/system/procd/patches/0001-Add-support-for-alternative-rc.d-directories.patch b/package/system/procd/patches/0001-Add-support-for-alternative-rc.d-directories.patch
|
|
|
|
new file mode 100644
|
2019-11-23 14:10:46 +00:00
|
|
|
index 0000000000000000000000000000000000000000..16d3179f05c64b7178f883745294c64a27127775
|
2014-07-26 14:11:27 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/package/system/procd/patches/0001-Add-support-for-alternative-rc.d-directories.patch
|
2019-11-23 14:10:46 +00:00
|
|
|
@@ -0,0 +1,80 @@
|
2014-07-26 14:11:27 +00:00
|
|
|
+From 03a2bc70e4260ec9f669391c47b9a7a9ecd0b75d Mon Sep 17 00:00:00 2001
|
|
|
|
+Message-Id: <03a2bc70e4260ec9f669391c47b9a7a9ecd0b75d.1407329621.git.mschiffer@universe-factory.net>
|
|
|
|
+From: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
|
|
+Date: Wed, 6 Aug 2014 14:51:49 +0200
|
|
|
|
+Subject: [PATCH] Add support for alternative rc.d directories
|
|
|
|
+
|
|
|
|
+---
|
|
|
|
+ initd/preinit.c | 38 ++++++++++++++++++++++++++++++++++++++
|
|
|
|
+ rcS.c | 2 +-
|
|
|
|
+ 2 files changed, 39 insertions(+), 1 deletion(-)
|
|
|
|
+
|
|
|
|
+--- a/initd/preinit.c
|
|
|
|
++++ b/initd/preinit.c
|
2019-11-23 14:10:46 +00:00
|
|
|
+@@ -87,12 +87,42 @@ fail:
|
|
|
|
+ free(command);
|
2014-07-26 14:11:27 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
++static char*
|
|
|
|
++get_rc_d(void)
|
|
|
|
++{
|
|
|
|
++ size_t n = 0;
|
|
|
|
++ ssize_t len;
|
|
|
|
++ char *ret = NULL;
|
|
|
|
++
|
|
|
|
++ FILE *fp = fopen("/tmp/rc_d_path", "r");
|
|
|
|
++
|
|
|
|
++ if (!fp)
|
|
|
|
++ return NULL;
|
|
|
|
++
|
|
|
|
++ len = getline(&ret, &n, fp);
|
|
|
|
++
|
|
|
|
++ fclose(fp);
|
|
|
|
++
|
|
|
|
++ unlink("/tmp/rc_d_path");
|
|
|
|
++
|
|
|
|
++ if (len <= 0) {
|
|
|
|
++ free(ret);
|
|
|
|
++ return NULL;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ if (ret[len-1] == '\n')
|
|
|
|
++ ret[len-1] = 0;
|
|
|
|
++
|
|
|
|
++ return ret;
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
+ static void
|
|
|
|
+ spawn_procd(struct uloop_process *proc, int ret)
|
|
|
|
+ {
|
2019-11-23 14:10:46 +00:00
|
|
|
+ char *wdt_fd = watchdog_fd();
|
2014-07-26 14:11:27 +00:00
|
|
|
+ char *argv[] = { "/sbin/procd", NULL};
|
|
|
|
+ char dbg[2];
|
|
|
|
++ char *rc_d_path;
|
|
|
|
+
|
|
|
|
+ if (plugd_proc.pid > 0)
|
|
|
|
+ kill(plugd_proc.pid, SIGKILL);
|
2019-11-23 14:10:46 +00:00
|
|
|
+@@ -112,6 +142,12 @@ spawn_procd(struct uloop_process *proc,
|
2014-07-26 14:11:27 +00:00
|
|
|
+ setenv("DBGLVL", dbg, 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
++ rc_d_path = get_rc_d();
|
|
|
|
++ if (rc_d_path) {
|
|
|
|
++ setenv("RC_D_PATH", rc_d_path, 1);
|
|
|
|
++ free(rc_d_path);
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ execvp(argv[0], argv);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+--- a/rcS.c
|
|
|
|
++++ b/rcS.c
|
2019-11-23 14:10:46 +00:00
|
|
|
+@@ -184,7 +184,7 @@ int rcS(char *pattern, char *param, void
|
2014-07-26 14:11:27 +00:00
|
|
|
+ q.empty_cb = q_empty;
|
|
|
|
+ q.max_running_tasks = 1;
|
|
|
|
+
|
|
|
|
+- return _rc(&q, "/etc/rc.d", pattern, "*", param);
|
|
|
|
++ return _rc(&q, getenv("RC_D_PATH") ?: "/etc/rc.d", pattern, "*", param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int rc(const char *file, char *param)
|