preliminary changes to first-boot.

This commit is contained in:
Storm Dragon 2020-01-07 09:58:25 -05:00
parent 98ee31da8b
commit 0f4b657541

View File

@ -48,38 +48,11 @@ echo -n | sudo tee "$logFile" &> /dev/null
get_user_info() {
# Request first and last name.
if [[ -z "${preferences[firstName]}" ]]; then
preferences[firstName]="$(inputbox "$(gettext "Please enter your first name.")")"
else
previousValue="${preferences[firstName]}"
preferences[firstName]="$(inputbox "$(gettext "Please enter your first name. Just press enter if your first name is:") ${preferences[firstName]}")"
preferences[firstName]="${preferences[firstName]:-$previousValue}"
fi
if [[ -z "${preferences[lastName]}" ]]; then
preferences[lastName]="$(inputbox "$(gettext "Please enter your last name.")")"
else
previousValue="${preferences[lastName]}"
preferences[lastName]="$(inputbox "$(gettext "Please enter your last name. Just press enter if your last name is:") ${preferences[lastName]}")"
preferences[lastName]="${preferences[lastName]:-$previousValue}"
fi
if [[ -z "${preferences[emailAddress]}" ]]; then
preferences[emailAddress]="$(inputbox "$(gettext "Please enter your email address.")")"
else
previousValue="${preferences[emailAddress]}"
preferences[emailAddress]="$(inputbox "$(gettext "Please enter your email address. Just press enter if your email address is:") ${preferences[emailAddress]}")"
preferences[emailAddress]="${preferences[emailAddress]:-$previousValue}"
fi
# Username defaults to first name replacing spaces with dashes
userName="${preferences[firstName],,}"
userName="${userName//[[:punct:][:space:]]/-}"
# Make sure username has a value.
userName="${userName:-f123}"
userName="${USER:-stormux}"
previousValue="${userName}"
userName="$(inputbox "$(gettext "Please enter your username for this computer. Usernames are usually lower case and contain only letters, numbers, and dashes. The name must not start with a dash. Please note, if you set a password earlier it will be the password for the new username, otherwise the password will be f123. Just press enter if you want your username to be:") $userName")"
userName="${userName:-$previousValue}"
# Write the name and email stuff to preferences file
write_preferences
}
get_internet() {
@ -114,7 +87,7 @@ setup_complete() {
msgbox "$(gettext "Initial F123 Light configuration is complete. To further customize your computer, please use the settings menu. Your computer will now reboot to finalize the setup.")"
# remove the firstboot file if it exists.
[[ -e ~/.firstboot ]] && rm -fv ~/.firstboot |& log
if [[ "$userName" != "f123" && "$userName" != "$USER" ]]; then
if [[ "$userName" != "stormux" && "$userName" != "$USER" ]]; then
/usr/lib/F123-wrappers/chuser.sh $userName
fi
sudo reboot
@ -136,7 +109,6 @@ fi
xdg-user-dirs-update |& log
# Add any user based systemd service files here. remember to pipe output through the log function.
systemctl --user enable --now recoll.service |& log
# Call the functions that make up this script.
# I tried to make the functions descriptive as to what they do.
@ -169,12 +141,12 @@ fi
# End keyboard layout
# Show quick start
if [[ -f "/usr/share/doc/F123/${LANG}/quickstart.txt" ]]; then
echo "Displaying /usr/share/doc/F123/${LANG}/quickstart.txt" | log
show_doc "/usr/share/doc/F123/${LANG}/quickstart.txt"
if [[ -f "/usr/share/doc/stormux/${LANG}/quickstart.txt" ]]; then
echo "Displaying /usr/share/doc/stormux/${LANG}/quickstart.txt" | log
show_doc "/usr/share/doc/stormux/${LANG}/quickstart.txt"
else
echo "No quickstart for ${LANG}, displaying default /usr/share/doc/F123/en_US.UTF-8/quickstart.txt" | log
show_doc "/usr/share/doc/F123/en_US.UTF-8/quickstart.txt"
echo "No quickstart for ${LANG}, displaying default /usr/share/doc/stormux/en_US.UTF-8/quickstart.txt" | log
show_doc "/usr/share/doc/stormux/en_US.UTF-8/quickstart.txt"
fi
echo "Prompting for password change." | log
if [[ "$(yesno "$(gettext "Do you want to change passwords for users of this system? Since everyone knows that the default password is f123, it is recommended that you change it.")")" == "Yes" ]]; then