]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-binfmt-conf.sh: cleanup --credential
authorLaurent Vivier <laurent@vivier.eu>
Wed, 27 Jun 2018 20:53:15 +0000 (22:53 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Mon, 2 Jul 2018 18:16:35 +0000 (20:16 +0200)
move credential value to its own variable to be able to manage
more flags

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180627205317.10343-2-laurent@vivier.eu>

scripts/qemu-binfmt-conf.sh

index d7eefda0b8c290320de01e289c1370c077128b9f..9900554608c45e35f004483d9f6742a70ff35690 100755 (executable)
@@ -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