This commit is contained in:
tteckster 2023-03-21 21:39:24 -04:00 committed by GitHub
parent 669fcbd4a6
commit db58c365b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 18 deletions

View File

@ -52,49 +52,51 @@ function default_settings() {
} }
function update_script() { function update_script() {
normal=$(tput sgr0)
menu=$(tput setaf 6)
number=$(tput setaf 3)
fgred=$(tput setaf 1)
header_info header_info
normal=$(echo "\033[m")
menu=$(echo "\033[36m")
number=$(echo "\033[33m")
fgred=$(echo "\033[31m")
printf "\n${menu}*********************************************${normal}\n" printf "\n${menu}*********************************************${normal}\n"
printf "${menu}**${number} 1)${normal} Update Vaultwarden \n" printf "${menu}**${number} 1)${normal} Update Vaultwarden\n"
printf "${menu}**${number} 2)${normal} View Admin Token\n" printf "${menu}**${number} 2)${normal} View Admin Token\n"
printf "\n${menu}*********************************************${normal}\n" printf "\n${menu}*********************************************${normal}\n"
printf "Please choose an option from the menu, or ${fgred}x${normal} to exit." printf "Please choose an option from the menu, or ${fgred}x${normal} to exit.\n"
read opt read opt
while [ "$opt" != "" ]; do while true; do
case $opt in case $opt in
1) 1)
clear clear
echo -e "${fgred}Update Vaultwarden${normal}" echo -e "${fgred}Update Vaultwarden${normal}"
apk update &>/dev/null apk update &>/dev/null
apk upgrade &>/dev/null apk upgrade &>/dev/null
break break
;; ;;
2) 2)
clear clear
echo -e "${fgred}View the Admin Token${normal}" echo -e "${fgred}View the Admin Token${normal}"
cat /etc/conf.d/vaultwarden | grep "ADMIN_TOKEN" | awk '{print substr($2, 7) }' 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 break
;; ;;
x) x|\n)
exit
;;
\n)
exit exit
;; ;;
*) *)
clear clear
echo -e "Please choose an option from the menu" echo -e "${fgred}Invalid option. Please choose an option from the menu.${normal}"
update_script
;; ;;
esac esac
done read -p "Press Enter to continue..."
exit update_script
done
exit
} }
start start