alnum to graph for instances

This commit is contained in:
paukstelis
2022-07-06 19:59:36 -04:00
parent da65e1fabd
commit ce6d9a117d

View File

@@ -361,8 +361,8 @@ add_camera() {
if [ $SUDO_USER ]; then user=$SUDO_USER; fi if [ $SUDO_USER ]; then user=$SUDO_USER; fi
echo 'Adding camera' | log echo 'Adding camera' | log
if [ -z "$INSTANCE" ]; then if [ -z "$INSTANCE" ]; then
PS3='Select instance to add camera to: ' PS3='Select instance number to add camera to: '
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
options+=("Quit") options+=("Quit")
#Not yet check to see if instance already has a camera #Not yet check to see if instance already has a camera
select camopt in "${options[@]}" select camopt in "${options[@]}"
@@ -468,8 +468,8 @@ remove_instance() {
if [ $SUDO_USER ]; then user=$SUDO_USER; fi if [ $SUDO_USER ]; then user=$SUDO_USER; fi
if [ -f "/etc/octoprint_instances" ]; then if [ -f "/etc/octoprint_instances" ]; then
echo 'Do not remove the generic instance!' | log echo 'Do not remove the generic instance!' | log
PS3='Select instance to remove: ' PS3='Select instance number to remove: '
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) port:.*/\1/p')
select opt in "${options[@]}" select opt in "${options[@]}"
do do
echo "Selected instance to remove: $opt" | log echo "Selected instance to remove: $opt" | log
@@ -924,7 +924,7 @@ check_sn() {
remove_everything() { remove_everything() {
get_settings get_settings
if prompt_confirm "Remove everything?"; then if prompt_confirm "Remove everything?"; then
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
for instance in "${instances[@]}"; do for instance in "${instances[@]}"; do
echo "Trying to remove instance $instance" echo "Trying to remove instance $instance"
systemctl stop $instance systemctl stop $instance
@@ -963,8 +963,8 @@ remove_everything() {
fi fi
} }
create_menu() { create_menu() {
PS3='Select instance to backup: ' PS3='Select instance number to backup: '
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
options+=("Quit") options+=("Quit")
select opt in "${options[@]}" select opt in "${options[@]}"
do do
@@ -980,7 +980,7 @@ create_menu() {
restart_all() { restart_all() {
get_settings get_settings
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
for instance in "${instances[@]}"; do for instance in "${instances[@]}"; do
if [ "$instance" == generic ]; then if [ "$instance" == generic ]; then
continue continue
@@ -1027,7 +1027,7 @@ restore() {
back_up_all() { back_up_all() {
get_settings get_settings
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
for instance in "${instances[@]}"; do for instance in "${instances[@]}"; do
if [ "$instance" == generic ]; then if [ "$instance" == generic ]; then
continue continue
@@ -1043,7 +1043,7 @@ replace_id() {
echo "PLEASE NOTE, this will only work in replacing an existing serial number with another serial number" echo "PLEASE NOTE, this will only work in replacing an existing serial number with another serial number"
echo "or an existing USB port with another USB port. You cannot mix and match." echo "or an existing USB port with another USB port. You cannot mix and match."
PS3='Select instance to change serial ID: ' PS3='Select instance to change serial ID: '
readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t options < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:graph:]]*\) .*/\1/p')
options+=("Quit") options+=("Quit")
select opt in "${options[@]}" select opt in "${options[@]}"
do do
@@ -1069,7 +1069,7 @@ replace_id() {
} }
main_menu() { main_menu() {
VERSION=0.1.0 VERSION=0.1.1
#reset #reset
UDEV='' UDEV=''
TEMPUSB='' TEMPUSB=''