qusal/salt/dom0/files/bin/qvm-shell
2025-05-07 10:58:51 +02:00

27 lines
518 B
Bash
Executable file

#!/bin/sh
# SPDX-FileCopyrightText: 2017 - 2023 Rusty Bird <rustybird@net-c.com>
#
# SPDX-License-Identifier: 0BSD
set -eu
usage(){
eof="$(stty -a | sed -n 's/.*eof = \([^;]*\);.*/\1/p')"
printf '%s\n' "Usage: ${0##*/} [QVM-RUN_OPTIONS] <QUBE>
Quit: ${eof}" >&2
exit 1
}
case "${1-}" in
""|-h|-?-help) usage;;
*) ;;
esac
if test -t 0; then
stty_bak="$(stty -g)"
trap 'stty ${stty_bak}' EXIT
stty -echo -icanon intr ""
fi
qvm-run --pass-io "${@}" -- 'LC_CTYPE=C script --quiet --return /dev/null'