-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm-command-debug.in
executable file
·81 lines (67 loc) · 1.26 KB
/
vm-command-debug.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh -efu
[ -z "@MKLOCAL@" ] ||
export PATH="@PREFIX@/libshell:${PATH#@PREFIX@/libshell:}"
case "${VM_HELP-}" in
USAGE)
printf 'debug <profile>\n'
;;
SUMMARY)
printf 'Shows the configuration and the command to be executed\n'
;;
DESCRIPTION)
;;
OPTIONS)
;;
esac
[ -z "${VM_HELP-}" ] ||
exit 0
[ "$#" -gt 0 ] ||
show_usage "Profile name required"
vm_profile="$1"
shift
export vm_profile
. "@PREFIX@/vm-sh-config"
vm_read_profile_config
vm_check_kernel_config
printf 'Profile: vm.%s\n' "$vm_profile"
printf 'Configuration:\n'
for n in $vm_params; do
eval "t=\"\${${n}_type-}\""
eval "v=\"\${${n}-}\""
if [ "$t" = one ]; then
printf -- '- %s: %s\n' "$n" "$v"
fi
if [ "$t" = list ]; then
s='(empty list)'
[ $v -eq 0 ] || s=
printf -- '- %s: %s\n' "$n" "$s"
i=0
while [ $i -lt "${v:-0}" ]; do
eval "vv=\"\${${n}_$i-}\""
printf -- ' + %s\n' "$vv"
i=$(($i+1))
done
fi
done
printf '\n'
set --
i=0
while [ "$i" -lt "$qemu_args" ]; do
eval "v=\"\$qemu_args_$i\""
i=$(($i + 1))
set -- "$@" "$v"
done
printf 'Command to execute:\n'
printf '%s \\\n' "$qemu_exec"
opt=
for a; do
if [ -z "${a##-*}" ]; then
[ -z "$opt" ] || printf '\\\n'
printf '\t%s ' "$a"
opt=1
else
printf '"%s" \\\n' "$a"
opt=
fi
done
printf '\t#\n'