aboutsummaryrefslogtreecommitdiffstats
path: root/main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch')
-rw-r--r--main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch b/main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch
new file mode 100644
index 0000000000..394d91ddf5
--- /dev/null
+++ b/main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch
@@ -0,0 +1,50 @@
+Description: Some device nodes already exist, causing mknod to return an error
+--- a/templates/lxc-alpine.in
++++ b/templates/lxc-alpine.in
+@@ -273,24 +273,38 @@
+ --update-cache --initdb add $packages
+ }
+
++mkdev() {
++ while getopts "m:" opt; do
++ case $opt in
++ m) MODE="-m $OPTARG";;
++ \?) return 1;;
++ esac
++ done
++ shift $((OPTIND - 1))
++
++ test -c "$1" && return 0 # device exists
++ test -f "$1" && rm -f "$1" # device is a regular file
++ mknod $MODE $@
++}
++
+ make_dev_nodes() {
+ mkdir -p -m 755 dev/pts
+ mkdir -p -m 1777 dev/shm
+
+- mknod -m 666 dev/zero c 1 5
+- mknod -m 666 dev/full c 1 7
+- mknod -m 666 dev/random c 1 8
+- mknod -m 666 dev/urandom c 1 9
++ mkdev -m 666 dev/zero c 1 5
++ mkdev -m 666 dev/full c 1 7
++ mkdev -m 666 dev/random c 1 8
++ mkdev -m 666 dev/urandom c 1 9
+
+ local i; for i in $(seq 0 4); do
+- mknod -m 620 dev/tty$i c 4 $i
++ mkdev -m 620 dev/tty$i c 4 $i
+ chown 0:5 dev/tty$i # root:tty
+ done
+
+- mknod -m 666 dev/tty c 5 0
++ mkdev -m 666 dev/tty c 5 0
+ chown 0:5 dev/tty # root:tty
+- mknod -m 620 dev/console c 5 1
+- mknod -m 666 dev/ptmx c 5 2
++ mkdev -m 620 dev/console c 5 1
++ mkdev -m 666 dev/ptmx c 5 2
+ chown 0:5 dev/ptmx # root:tty
+ }
+