From 70a77984b3ecc8adc7be42cd22fa3fd103874e49 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 27 Jun 2018 22:53:15 +0200 Subject: qemu-binfmt-conf.sh: cleanup --credential move credential value to its own variable to be able to manage more flags Signed-off-by: Laurent Vivier Message-Id: <20180627205317.10343-2-laurent@vivier.eu> --- scripts/qemu-binfmt-conf.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index d7eefda0b8..9900554608 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -241,7 +241,12 @@ qemu_check_systemd() { } qemu_generate_register() { - echo ":qemu-$cpu:M::$magic:$mask:$qemu:$FLAGS" + flags="" + if [ "$CREDENTIAL" = "yes" ] ; then + flags="OC" + fi + + echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags" } qemu_register_interpreter() { @@ -260,10 +265,8 @@ package qemu-$cpu interpreter $qemu magic $magic mask $mask +credential $CREDENTIAL EOF - if [ "$FLAGS" = "OC" ] ; then - echo "credentials yes" >> "$EXPORTDIR/qemu-$cpu" - fi } qemu_set_binfmts() { @@ -300,7 +303,7 @@ SYSTEMDDIR="/etc/binfmt.d" DEBIANDIR="/usr/share/binfmts" QEMU_PATH=/usr/local/bin -FLAGS="" +CREDENTIAL=no options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@") eval set -- "$options" @@ -348,11 +351,7 @@ while true ; do ;; -c|--credential) shift - if [ "$1" = "yes" ] ; then - FLAGS="OC" - else - FLAGS="" - fi + CREDENTIAL="$1" ;; *) break -- cgit v1.2.3-55-g7522 From 01ecd22a29173168950a27551d0f3490b493467c Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 27 Jun 2018 22:53:16 +0200 Subject: qemu-binfmt-conf.sh: add persistent (F) flags Since kernel commit 948b701a607f (binfmt_misc: add persistent opened binary handler for containers) kernel allows to load the interpreter at the configuration time. In case of chroot, it allows to have the interpreter in the host root filesystem and not to copy it to the chroot filesystem. Signed-off-by: Laurent Vivier Message-Id: <20180627205317.10343-3-laurent@vivier.eu> --- scripts/qemu-binfmt-conf.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 9900554608..00c9c3aa16 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -161,6 +161,7 @@ usage() { cat < Message-Id: <20180627205317.10343-4-laurent@vivier.eu> --- scripts/qemu-binfmt-conf.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'scripts') diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 00c9c3aa16..23df00ae30 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -161,25 +161,26 @@ usage() { cat <