aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Daudt <kdaudt@alpinelinux.org>2021-04-10 12:19:20 +0000
committerKevin Daudt <kdaudt@alpinelinux.org>2021-04-10 12:24:03 +0000
commitbc220ed7a8797fd940cc3869be3c8f682296f73a (patch)
tree1ee360f0e4ab1db790ba9721b221e595a7136890
parentdfedf2e4dc1a591ae6b0801827c0ea03e8386983 (diff)
downloadaports-bc220ed7a8797fd940cc3869be3c8f682296f73a.tar.gz
aports-bc220ed7a8797fd940cc3869be3c8f682296f73a.tar.bz2
aports-bc220ed7a8797fd940cc3869be3c8f682296f73a.tar.xz
main/lxc-templates-legacy: account of existing nodes in alpine template
Creating an alpine-linux container errors out with the error: > 'mknod: dev/zero: File exists' (cherry picked from commit 0b9c3720de96ad950e9861bac79cd5dacc6e930a)
-rw-r--r--main/lxc-templates-legacy/APKBUILD6
-rw-r--r--main/lxc-templates-legacy/alpine-skip-mknod-when-existing.patch50
2 files changed, 54 insertions, 2 deletions
diff --git a/main/lxc-templates-legacy/APKBUILD b/main/lxc-templates-legacy/APKBUILD
index 67f349fb0c..fe0c7592f4 100644
--- a/main/lxc-templates-legacy/APKBUILD
+++ b/main/lxc-templates-legacy/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=lxc-templates-legacy
pkgver=3.0.3
-pkgrel=1
+pkgrel=2
pkgdesc="Legacy LXC container templates"
url="https://linuxcontainers.org"
arch="noarch"
@@ -11,6 +11,7 @@ depends="bash tar"
subpackages="$pkgname-alpine"
source="https://linuxcontainers.org/downloads/lxc/lxc-templates-$pkgver.tar.gz
add-mips64-s390x.patch
+ alpine-skip-mknod-when-existing.patch
"
builddir="$srcdir/lxc-templates-$pkgver"
@@ -48,4 +49,5 @@ alpine() {
}
sha512sums="3e9d5304f5e06580eeb766570ddfebb0c80061c2d7e47c9ea37d834fe0cf4fabe7eedd667e4937df3f2451bc3e7aa1e98a1b386f3b19964dc218ff0e21011632 lxc-templates-3.0.3.tar.gz
-e450bbf3219971955dbc6ac4388d7fea84288a55214ed47dcca93df31eb0ce119321072c5d01423709e3437e2148096947a05c2f4afa28ff8eb1277ebf40646a add-mips64-s390x.patch"
+e450bbf3219971955dbc6ac4388d7fea84288a55214ed47dcca93df31eb0ce119321072c5d01423709e3437e2148096947a05c2f4afa28ff8eb1277ebf40646a add-mips64-s390x.patch
+10218eb23e70af82c3e059e462b3decd7af47bf7bc26324ed30848d18e33a317489cc2b92bb91f3a82c5fac6b3d3649cec452df80f2cca2bd2ce0e8eb2b4fd0f alpine-skip-mknod-when-existing.patch"
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
+ }
+