From a34581f521b72f07e859e4514096fe8fe61cdd51 Mon Sep 17 00:00:00 2001 From: Carlos Hernandez Date: Sun, 14 May 2017 06:58:11 -0600 Subject: [PATCH] Fix opts, pass SUID option to wrapped binfmt script. --- .../root/usr/sbin/qemu-binfmt-register.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docker-containers/qemu-builder/register/root/usr/sbin/qemu-binfmt-register.sh b/docker-containers/qemu-builder/register/root/usr/sbin/qemu-binfmt-register.sh index c2ccafb..f8da9d4 100755 --- a/docker-containers/qemu-builder/register/root/usr/sbin/qemu-binfmt-register.sh +++ b/docker-containers/qemu-builder/register/root/usr/sbin/qemu-binfmt-register.sh @@ -33,16 +33,19 @@ fi if [[ $# -gt 0 ]]; then - while getopts ":r" opt; do - case $opt in - r) + options=$(getopt -o r -l remove -- "$@") + eval set -- "$options" + while true ; do + case "$1" in + -r|--remove) unregister ;; - \?) - echo "Invalid option: -$OPTARG" >&2 + *) + break ;; esac + shift done else - exec /usr/sbin/qemu-binfmt-conf.sh + exec /usr/sbin/qemu-binfmt-conf.sh -c yes fi