magic
This commit is contained in:
+6
-7
@@ -6,15 +6,14 @@ YELLOW='\033[1;33m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m'
|
||||
|
||||
# discover bins
|
||||
declare -a editions edition_names
|
||||
for dir in "${INSTALL_DIR}"/*/; do
|
||||
[ -d "$dir" ] || continue
|
||||
edition=$(basename "$dir")
|
||||
bin="${dir}/linusware/linusware"
|
||||
if [ -f "$bin" ] && [ -x "$bin" ]; then
|
||||
run="${dir}/linusware/run.sh"
|
||||
if [ -f "$run" ] && [ -x "$run" ]; then
|
||||
edition_names+=("$edition")
|
||||
editions+=("$bin")
|
||||
editions+=("$run")
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -55,12 +54,12 @@ if command -v whiptail >/dev/null 2>&1; then
|
||||
choice=$(whiptail --title "LinusWare Launcher" \
|
||||
--menu "Select an edition to launch:" \
|
||||
15 55 5 "${menu_items[@]}" \
|
||||
3>&1 1>&2 2>&3) || choice="Q"
|
||||
3>&1 1>&2 2>&3) || choice="q"
|
||||
|
||||
case "$choice" in
|
||||
u) run_updater;;
|
||||
q|"") exit 0;;
|
||||
*) [[ "$choice" =~ ^[0-9]+$ ]] && exec sudo "${editions[$((choice-1))]}" ;;
|
||||
*) [[ "$choice" =~ ^[0-9]+$ ]] && exec "${editions[$((choice-1))]}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
@@ -85,7 +84,7 @@ while true; do
|
||||
if [[ "$choice" =~ ^[0-9]+$ ]] && \
|
||||
[ "$choice" -ge 1 ] && \
|
||||
[ "$choice" -le "${#editions[@]}" ]; then
|
||||
exec sudo "${editions[$((choice-1))]}"
|
||||
exec "${editions[$((choice-1))]}"
|
||||
else
|
||||
echo -e "${RED}Invalid choice${NC}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user