procd: setup /dev/stdin, /dev/stdout and /dev/stderr symlinks
authorJo-Philipp Wich <jo@mein.io>
Thu, 18 Nov 2021 12:00:09 +0000 (13:00 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 23 Nov 2021 14:03:39 +0000 (14:03 +0000)
Extend the hotplug.json ruleset to setup the common /dev/std{in,out,err}
symbolic links which are needed by some applications, e.g. nftables when
applying rulesets from stdin.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/system/procd/files/hotplug.json

index 7e0f129d356515c15fd43cd0c540d5cdc6ecf259..b930b307a4f3cb34bc3346192987f95ff3f27e31 100644 (file)
@@ -7,9 +7,19 @@
                                        [ "has", "MINOR" ]
                                ],
                                [
+                                       [ "if",
+                                               [ "eq", "DEVNAME", "null" ],
+                                               [
+                                                       [ "makedev", "/dev/%DEVNAME%", "0666" ],
+                                                       [ "exec", "/bin/ln", "-s", "/proc/self/fd/0", "/dev/stdin" ],
+                                                       [ "exec", "/bin/ln", "-s", "/proc/self/fd/1", "/dev/stdout" ],
+                                                       [ "exec", "/bin/ln", "-s", "/proc/self/fd/2", "/dev/stderr" ],
+                                                       [ "return" ]
+                                               ]
+                                       ],
                                        [ "if",
                                                [ "eq", "DEVNAME",
-                                                       [ "null", "full", "ptmx", "zero", "tty", "net", "random", "urandom" ]
+                                                       [ "full", "ptmx", "zero", "tty", "net", "random", "urandom" ]
                                                ],
                                                [
                                                        [ "makedev", "/dev/%DEVNAME%", "0666" ],