#some constant values used by the dialog screens to make them more legible
BACK="--colors --backtitle"
TITLE="\Z7Pyrenee Conversion Utility"
TITLE="\Z7Avalanche Conversion Tool"
MSG='--yes-label "OK" --msgbox'
SIZE="10 75"
SIZE2="20 75"
dialog $BACK"$TITLE" --title "WELCOME!"$MSG"Welcome to the Pyrenee Conversion Utility.\n\nThis utility will make a number of (mostly reversible) changes to your system. It should be run directly after installing Alpine Linux 3.15, which will setup the foundation we build upon."$SIZE
dialog $BACK"$TITLE" --title "WELCOME!"$MSG"Welcome to the Avalanche Conversion Tool.\n\nThis utility will make a number of (mostly reversible) changes to your system. It should be run directly after installing Alpine Linux 3.16, which will setup the foundation we build upon."$SIZE
dialog $BACK"$TITLE" --form "Please supply the required information:\n(username can only contain small letters)"$SIZE3"Full Name:"10""111600"username :"20""211600 2>input &&FULLNAME=$(sed -n '1p' input)&&USER=$(sed -n '2p' input | sed 's/[A-Z]/\L&/g')&& rm -f input
#Return status of non-zero indicates cancel
if["$?" !="0"]||["$USER"=""]||["$FULLNAME"=""]
then
dialog $BACK"$TITLE"$MSG"Pyrenee Conversion was canceled at your request or either field was empty.\n\nPlease restart the Pyrenee Conversion Utility."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Avalanche Conversion was canceled at your request or either field was empty.\n\nPlease restart the Avalanche Conversion Tool."$SIZE&& clear
else
dialog $BACK"$TITLE" --insecure --title "Password Provider" --passwordbox "Provide a password for $FULLNAME"$SIZE 2>password &&PASSWORD1=$(sed -n '1p' password)&& rm -f password
#Return status of non-zero indicates cancel
if["$?" !="0"]||["$PASSWORD1"=""]
then
dialog $BACK"$TITLE"$MSG"Pyrenee Conversion was canceled at your request or input field was empty.\n\nPlease restart the Pyrenee Conversion Utility."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Avalanche Conversion was canceled at your request or input field was empty.\n\nPlease restart the Avalanche Conversion Tool."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Pyrenee Conversion was canceled at your request or input field was empty.\n\nPlease restart the Pyrenee Conversion Utility."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Avalanche Conversion was canceled at your request or input field was empty.\n\nPlease restart the Avalanche Conversion Tool."$SIZE&& clear
else
if["$PASSWORD1" !="$PASSWORD2"]
then
dialog $BACK"$TITLE"$MSG"Pyrenee Conversion was canceled because the provided passwords didn't match.\n\nPlease restart the Pyrenee Conversion Utility."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Avalanche Conversion was canceled because the provided passwords didn't match.\n\nPlease restart the Avalanche Conversion Tool."$SIZE&& clear
else
dialog $BACK"$TITLE" --title "Confirmation" --yes-label "Enter" --no-label "Esc" --yesno "This is the last opportunity to cancel the conversion.\n\nPlease press <Enter> to start conversion or <Esc> to cancel."$SIZE
#Return status of non-zero indicates cancel
if["$?" !="0"]
then
dialog $BACK"$TITLE"$MSG"Pyrenee Conversion was canceled at your request."$SIZE&& clear
dialog $BACK"$TITLE"$MSG"Avalanche Conversion was canceled at your request."$SIZE&& clear