Rename option now working.

This commit is contained in:
Storm Dragon
2021-10-18 00:46:11 -04:00
parent 7c128421d5
commit 1c4ea96f53
5 changed files with 35 additions and 173 deletions

View File

@ -36,12 +36,12 @@
exit 1
fi
local oldUser="$USER"
oldUser="$USER"
local groups="$(groups "$oldUser")"
groups="$(groups "$oldUser")"
groups="${groups// /,}"
local newUser="$1"
newUser="$1"
if ! [[ "$newUser" =~ ^[a-z][-a-z0-9]*$ ]]; then
msgbox "Username $newUser failed validation. It cannot contain spaces or some punctuation."
exit 1
@ -59,8 +59,3 @@ EOF
# Files in cron.d must be 644 to work.
sudo chmod 644 /etc/cron.d/0chuser
# Reboot the computer so the script can run
local answer="$(yesno "Would you like to reboot now so the username can be changed? If no, you will need to reboot manually for the changes to be applied.")"
if [[ "$answer" == "Yes" ]]; then
sudo reboot
fi