--msgbox "So, you're ready to install your website? Very little information is required to start the configuration, this should take 2-3 minutes before the proper install can start."\
--yesno "A previously saved configuration file was found in the .easyinstall folder, that contains the following settings:\n\n$saved_summary\n\nWould you like to use those settings (you can edit some of them)?"\
die "Wokay, come back when you feel ready to test this!"
fi
}
function enter_domain {
if[ -z "$inputbox_domain"]
then
if["$level" !="beginner"]
then
inputbox_domain="What is your website's address/FQDN (Fully Qualified Domain Name)?\n(i.e. mywebsite.example.com, mywesbsite.net)\nYou can also use a local domain for testing\n(i.e. \"localhost\", \"testing\"...)"
else
inputbox_domain="Please enter your website's address/domain name\n(i.e. \"mywebsite.example.com\", \"mywesbsite.net\")"
fi
fi
le_domain=$(whiptail \
--title "Domain name"\
--inputbox "$inputbox_domain"\
1280 3>&1 1>&2 2>&3)
exitstatus=$?
if[$exitstatus=0]
then
if[ -z "$le_domain"]
then
inputbox_domain="You understand that if you put nothing here, you won't be able to have a website, right?\nPlease enter the domain name you plan to use for your website:"
summary_domain="Local site address : http://$le_domain/\n"
if[ -z "$using_saved"]
then
webserver_check
else
edit_settings
fi
else
inputbox_domain="\"$le_domain\" is not a valid FQDN or valid local domain for your test install. Please enter one of those now:"
enter_domain
fi
else
inputbox_domain="\"$le_domain\" is not a valid address/domain name for your website. Please enter something that looks like \"example.com\" or \"subdomain.example.com\":"
enter_domain
fi
fi
fi
else
die "Run the script again when you're ready to enter a valid domain name"
fi
}
function enter_email {
if[ -z "$inputbox_email"]
then
inputbox_email="Please enter the e-mail address that will be use for your Let's Encrypt certificate request (and nothing else):"
fi
le_email=$(whiptail \
--title "E-mail address (for Let's Encrypt)"\
--inputbox "$inputbox_email"\
1060 3>&1 1>&2 2>&3)
exitstatus=$?
if[$exitstatus=0]
then
if[ -z "$le_email"]
then
inputbox_email="The e-mail address is mandatory to obtain a Let's Encrypt certificate, so please enter one:"
inputbox_email="\"$le_email\" doesn't remotely look like an e-mail address. Please enter something that looks like \"someone@example.com\" or \"somebody@subdomain.example.com\":"
--msgbox "You already have $webserver_name web server running on this computer, it will also be used for this install. Or you can press Esc and solve this issue by yourself."\
1060
exitstatus=$?
if[$exitstatus=0]
then
if[ -z "$using_saved"]
then
ddns_choice
else
edit_settings
fi
else
die "Wokay, come back when you feel ready to test this!"
--menu "If you plan to use a Dynamic DNS (DDNS) provider, you may choose one here. Currently supported providers are FreeDNS, Gandi and selHOST.de. You must already have an account with the selected provider and own a domain/subdomain. Please choose one of the following options:"\
18805\
"1""None, I won't be using a DDNS provider"\
"2""FreeDNS (offers free of charge subdomains)"\
"3""Gandi (French domain name registrar with a nice API)"\
"4""selfHOST.de (German language provider & registrar)"\
--passwordbox "Enter your database server main password and choose Ok to continue. If you leave the field empty a random password will be generated, you will be able to retrieve it later."\
--cancel-button "Go Back"\
1060 3>&1 1>&2 2>&3)
exitstatus=$?
if[$exitstatus=0]
then
if[ -z "$db_pass"]
then
db_pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;)
fi
summary_db_pass="Database main password : $db_pass\n"
--yesno "Default setting is to use a single password for anything database related and to use the installation folder's name as database name and user. Do you wish to keep it that way or to customize those settings (database username, database name, database password)?"\
--yes-button "Keep it simple" --no-button "Customize"\
10 80)
then
summary
else
advanced_db_name
fi
}
function advanced_db_name {
if[ -z "$inputbox_db_name"]
then
inputbox_db_name="Please enter your website database name, do not use spaces. If left empty it will be named as the install folder (here \"$install_folder\" as your install path is \"$install_path\"):"
fi
website_db_name=$(whiptail \
--title "Website database name"\
--inputbox "$inputbox_db_name"\
1060 3>&1 1>&2 2>&3)
exitstatus=$?
if[$exitstatus=0]
then
if[ ! -z "$website_db_name"]
then
# Validate database name
db_name_regex="^([a-zA-Z0-9_]){2,25}$"
if[["$website_db_name"=~ $db_name_regex]]
then
summary_db_name="Website database name : $website_db_name\n"
advanced_db_user
else
inputbox_db_name="Please enter a usable database name, or leave empty to use \"$install_folder\":"
advanced_db_name
fi
else
advanced_db_user
fi
else
advanced_db
fi
}
function advanced_db_user {
if[ -z "$inputbox_db_user"]
then
inputbox_db_user="Please enter your website database username, do not use spaces. If left empty it will be named after the install folder (here \"$install_folder\" as your install path is \"$install_path\"):"
inputbox_db_user="Please enter a usable database username, or leave empty to use \"$install_folder\":"
advanced_db_user
fi
else
advanced_db_pass
fi
else
advanced_db
fi
}
function advanced_db_pass {
website_db_pass=$(whiptail \
--title "Set your database custom password"\
--passwordbox "Enter your database custom password and choose Ok to continue. If you leave the field empty the database server main password will be used."\
--yesno "A previously saved configuration file was found in the .easyinstall folder, that contains the following settings:\n\n$summary_display\n\nWould you like to use those settings (you can edit some of them)?"\