k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/third_party/multiarch/qemu-user-static/register/register.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  QEMU_BIN_DIR=${QEMU_BIN_DIR:-/usr/bin}
     4  
     5  
     6  if [ ! -d /proc/sys/fs/binfmt_misc ]; then
     7      echo "No binfmt support in the kernel."
     8      echo "  Try: '/sbin/modprobe binfmt_misc' from the host"
     9      exit 1
    10  fi
    11  
    12  
    13  if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
    14      mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
    15  fi
    16  
    17  
    18  if [ "${1}" = "--reset" ]; then
    19      shift
    20      find /proc/sys/fs/binfmt_misc -type f -name 'qemu-*' -exec sh -c 'echo -1 > {}' \;
    21  fi
    22  
    23  exec $(dirname "${BASH_SOURCE[0]}")/qemu-binfmt-conf.sh --qemu-suffix "-static" --qemu-path="${QEMU_BIN_DIR}" "$@"