alpine whiptail menu

This commit is contained in:
tteckster 2023-03-21 22:08:04 -04:00 committed by GitHub
parent 6464229f14
commit 54e3870b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 30 deletions

View File

@ -30,36 +30,22 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \
PS3="Please choose an option from the menu, or enter q to exit: " "1" "Update VaultWarden $VAULT" ON \
options=("Update Vaultwarden" "View Admin Token" "Exit") "2" "Show Admin Token" OFF \
select opt in "${options[@]}" 3>&1 1>&2 2>&3)
do
case $opt in header_info
"Update Vaultwarden") if [ "$UPD" == "1" ]; then
clear apk update && apk upgrade
echo "Updating Vaultwarden..." exit;
apk update &>/dev/null fi
apk upgrade &>/dev/null
break if [ "$UPD" == "2" ]; then
;; cat /etc/conf.d/vaultwarden | grep "ADMIN_TOKEN" | awk '{print substr($2, 7) }'
"View Admin Token") fi
clear exit
echo "Viewing the Admin Token..." fi
token=$(awk -F'"' '/ADMIN_TOKEN/{print $2}' /etc/conf.d/vaultwarden)
if [ -n "$token" ]; then
echo "Admin Token: $token"
else
echo "Failed to retrieve the Admin Token."
fi
break
;;
"Exit")
exit
;;
*) echo "Invalid option. Please choose an option from the menu.";;
esac
done
} }
start start

View File

@ -14,6 +14,7 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apk add newt
$STD apk add wget $STD apk add wget
$STD apk add bash $STD apk add bash
$STD apk add curl $STD apk add curl