Update openwrt-vm.sh

shfmt
This commit is contained in:
tteckster 2023-05-22 07:40:19 -04:00 committed by GitHub
parent c5ee4993c8
commit 6a7cd6b956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,68 +66,68 @@ function cleanup() {
} }
function send_line_to_vm() { function send_line_to_vm() {
echo -e "${DGN}Sending line: ${YW}$1${CL}" echo -e "${DGN}Sending line: ${YW}$1${CL}"
for ((i=0; i<${#1}; i++)); do for ((i = 0; i < ${#1}; i++)); do
character=${1:i:1} character=${1:i:1}
case $character in case $character in
" ") character="spc";; " ") character="spc" ;;
"-") character="minus";; "-") character="minus" ;;
"=") character="equal";; "=") character="equal" ;;
",") character="comma";; ",") character="comma" ;;
".") character="dot";; ".") character="dot" ;;
"/") character="slash";; "/") character="slash" ;;
"'") character="apostrophe";; "'") character="apostrophe" ;;
";") character="semicolon";; ";") character="semicolon" ;;
'\') character="backslash";; '\') character="backslash" ;;
'`') character="grave_accent";; '`') character="grave_accent" ;;
"[") character="bracket_left";; "[") character="bracket_left" ;;
"]") character="bracket_right";; "]") character="bracket_right" ;;
"_") character="shift-minus";; "_") character="shift-minus" ;;
"+") character="shift-equal";; "+") character="shift-equal" ;;
"?") character="shift-slash";; "?") character="shift-slash" ;;
"<") character="shift-comma";; "<") character="shift-comma" ;;
">") character="shift-dot";; ">") character="shift-dot" ;;
'"') character="shift-apostrophe";; '"') character="shift-apostrophe" ;;
":") character="shift-semicolon";; ":") character="shift-semicolon" ;;
"|") character="shift-backslash";; "|") character="shift-backslash" ;;
"~") character="shift-grave_accent";; "~") character="shift-grave_accent" ;;
"{") character="shift-bracket_left";; "{") character="shift-bracket_left" ;;
"}") character="shift-bracket_right";; "}") character="shift-bracket_right" ;;
"A") character="shift-a";; "A") character="shift-a" ;;
"B") character="shift-b";; "B") character="shift-b" ;;
"C") character="shift-c";; "C") character="shift-c" ;;
"D") character="shift-d";; "D") character="shift-d" ;;
"E") character="shift-e";; "E") character="shift-e" ;;
"F") character="shift-f";; "F") character="shift-f" ;;
"G") character="shift-g";; "G") character="shift-g" ;;
"H") character="shift-h";; "H") character="shift-h" ;;
"I") character="shift-i";; "I") character="shift-i" ;;
"J") character="shift-j";; "J") character="shift-j" ;;
"K") character="shift-k";; "K") character="shift-k" ;;
"L") character="shift-l";; "L") character="shift-l" ;;
"M") character="shift-m";; "M") character="shift-m" ;;
"N") character="shift-n";; "N") character="shift-n" ;;
"O") character="shift-o";; "O") character="shift-o" ;;
"P") character="shift-p";; "P") character="shift-p" ;;
"Q") character="shift-q";; "Q") character="shift-q" ;;
"R") character="shift-r";; "R") character="shift-r" ;;
"S") character="shift-s";; "S") character="shift-s" ;;
"T") character="shift-t";; "T") character="shift-t" ;;
"U") character="shift-u";; "U") character="shift-u" ;;
"V") character="shift-v";; "V") character="shift-v" ;;
"W") character="shift-w";; "W") character="shift-w" ;;
"X") character="shift=x";; "X") character="shift=x" ;;
"Y") character="shift-y";; "Y") character="shift-y" ;;
"Z") character="shift-z";; "Z") character="shift-z" ;;
"!") character="shift-1";; "!") character="shift-1" ;;
"@") character="shift-2";; "@") character="shift-2" ;;
"#") character="shift-3";; "#") character="shift-3" ;;
'$') character="shift-4";; '$') character="shift-4" ;;
"%") character="shift-5";; "%") character="shift-5" ;;
"^") character="shift-6";; "^") character="shift-6" ;;
"&") character="shift-7";; "&") character="shift-7" ;;
"*") character="shift-8";; "*") character="shift-8" ;;
"(") character="shift-9";; "(") character="shift-9" ;;
")") character="shift-0";; ")") character="shift-0" ;;
esac esac
qm sendkey $VMID "$character" qm sendkey $VMID "$character"
done done
@ -406,8 +406,7 @@ send_line_to_vm "uci set firewall.@zone[1].forward='ACCEPT'"
send_line_to_vm "uci commit" send_line_to_vm "uci commit"
send_line_to_vm "halt" send_line_to_vm "halt"
msg_ok "Pre-configured network interfaces" msg_ok "Pre-configured network interfaces"
until qm status $VMID | grep -q "stopped" until qm status $VMID | grep -q "stopped"; do
do
sleep 2 sleep 2
done done
msg_info "Adding bridge interface" msg_info "Adding bridge interface"