TyOS-Local-Scripts/flatpak_selections

35 lines
869 B
Bash

#!/bin/bash
# Directory containing scripts
SCRIPT_DIR="/usr/local/bin/flatpacks"
# Check if the directory exists
if [[ ! -d "$SCRIPT_DIR" ]]; then
echo "Directory $SCRIPT_DIR does not exist."
exit 1
fi
# Get list of scripts
SCRIPTS=($(ls "$SCRIPT_DIR"))
# Check if there are any scripts
if [[ ${#SCRIPTS[@]} -eq 0 ]]; then
whiptail --msgbox "No scripts found in $SCRIPT_DIR" 10 40
exit 0
fi
# Build menu options
MENU_OPTIONS=()
for SCRIPT in "${SCRIPTS[@]}"; do
MENU_OPTIONS+=("$SCRIPT" "$SCRIPT")
done
# Show menu with the new title
SELECTED_SCRIPT=$(whiptail --title "TyOS Flatpak Selections" --menu "Choose a script to run:" 20 60 10 "${MENU_OPTIONS[@]}" 3>&1 1>&2 2>&3)
# Check if a script was selected
if [[ -n "$SELECTED_SCRIPT" ]]; then
bash "$SCRIPT_DIR/$SELECTED_SCRIPT"
else
whiptail --msgbox "No script selected." 10 40
fi