[CRIU] [PATCH 1/3] Dockerfile: don't fail if a binfmt-misc rule already exists

Andrey Vagin avagin at openvz.org
Thu Feb 18 09:41:06 PST 2016


From: Andrei Vagin <avagin at openvz.org>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 scripts/build/Makefile    | 14 +++++++-------
 scripts/build/binfmt_misc | 10 ++++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)
 create mode 100755 scripts/build/binfmt_misc

diff --git a/scripts/build/Makefile b/scripts/build/Makefile
index aa49e53..d2e5f94 100644
--- a/scripts/build/Makefile
+++ b/scripts/build/Makefile
@@ -1,20 +1,20 @@
 all: armv7hf aarch64 ppc64le
 
+.FORCE:
+
 qemu-user-static:
 	./extract-deb-pkg qemu-user-static
 
-binfmt_misc:
-	echo ':armv7hf:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register;
-	echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
-	echo ':ppc64le:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00:/usr/bin/qemu-ppc64le-static:' > /proc/sys/fs/binfmt_misc/register
+binfmt_misc: .FORCE
+	./binfmt_misc
 
-armv7hf: qemu-user-static
+armv7hf: qemu-user-static binfmt_misc
 	docker build  -t criu-armv7hf -f Dockerfile.armv7hf ../..
 
-aarch64: qemu-user-static
+aarch64: qemu-user-static binfmt_misc
 	docker build  -t criu-aarch64 -f Dockerfile.aarch64 ../..
 
-ppc64le: qemu-user-static
+ppc64le: qemu-user-static binfmt_misc
 	docker build  -t criu-aarch64 -f Dockerfile.ppc64le ../..
 
 clean:
diff --git a/scripts/build/binfmt_misc b/scripts/build/binfmt_misc
new file mode 100755
index 0000000..a5c922e
--- /dev/null
+++ b/scripts/build/binfmt_misc
@@ -0,0 +1,10 @@
+set -e -x
+
+test -f /proc/sys/fs/binfmt_misc/armv7hf ||
+	echo ':armv7hf:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register;
+
+test -f /proc/sys/fs/binfmt_misc/aarch64 ||
+	echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
+
+test -f /proc/sys/fs/binfmt_misc/ppc64le ||
+	echo ':ppc64le:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00:/usr/bin/qemu-ppc64le-static:' > /proc/sys/fs/binfmt_misc/register
-- 
2.5.0



More information about the CRIU mailing list