From f4167e20d3f0752fade800978ec2474fcab491cc Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 7 Feb 2025 12:41:13 +0200 Subject: [PATCH] Show install status of package in software menu --- .../usr/local/bin/femto-config | 4 ++-- .../usr/local/bin/femto-software.sh | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 98d52d3..32c584e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -170,7 +170,7 @@ networking_settings() { ;; 7) # Test internet connection) loading "Testing internet connection..." - dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 8 40 + dialog --no-collapse --title "Internet connectivity test" --colors --msgbox "$(replace_colors "$(femto-network-config.sh -t)")" 9 40 ;; 8) return @@ -751,7 +751,7 @@ done # Main menu while true; do - main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ + main_menu_choice=$(dialog --no-collapse --cancel-label "Exit" --backtitle "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release)" --default-item "$main_menu_choice" --item-help --menu "Femtofox Config" 16 40 5 \ 1 "Settings wizard" "" \ 2 "Networking" "" \ 3 "Meshtastic" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 865e365..0d5955b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -120,18 +120,18 @@ package_menu() { # generate menu from filenames in /usr/local/bin/packages while true; do - menu_entries=() + menu_entries=("Package name" "Installed?" "" "") index=1 for file in /usr/local/bin/packages/*.sh; do filename=$(basename "$file" .sh) [[ "$filename" == "package_template" ]] && continue # skip package_template.sh - menu_entries+=("$index" "$(/usr/local/bin/packages/"$filename".sh -N)") - ((index++)) + menu_entries+=("$(/usr/local/bin/packages/"$filename".sh -N)" "$($package_dir/$filename.sh -I && echo "✅ " || echo "❌ ")") + ((index++)) # keeping an index to determine menu window height done menu_entries+=(" " "") # add blank line and "Back to Main Menu" entry - menu_entries+=("$index" "Back to main menu") - software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((9 + index)) 50 $((index + 1)) "${menu_entries[@]}" 3>&1 1>&2 2>&3) + menu_entries+=("Back to main menu" "") + software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((11 + index)) 50 $((index + 3)) "${menu_entries[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog case_block=" case \$software_option in" @@ -140,12 +140,12 @@ while true; do filename=$(basename "$file" .sh) [[ "$filename" == "package_template" ]] && continue # skip package_template.sh case_block+=" - $index) package_intro \"$filename\" ;;" + \"$(/usr/local/bin/packages/"$filename".sh -N)\") package_intro \"$filename\" ;;" ((index++)) done case_block+=" - $index) break ;; + \"Back to main menu\") break ;; esac" #add return to main menu option eval "$case_block" # Execute the generated case statement done