From fb9f8d7712364811781fea5bb595e27256c9309b Mon Sep 17 00:00:00 2001 From: SolidHal Date: Fri, 5 Oct 2018 00:10:11 +0000 Subject: [PATCH] Make username entry more reliable Disabled dmesg during entry, check for safe usernames --- scripts/InstallScripts/InstallPackages.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/InstallScripts/InstallPackages.sh b/scripts/InstallScripts/InstallPackages.sh index bf87030..0aff596 100755 --- a/scripts/InstallScripts/InstallPackages.sh +++ b/scripts/InstallScripts/InstallPackages.sh @@ -72,12 +72,25 @@ cp -rf $DIR/50-synaptics.conf /etc/X11/xorg.conf.d/ apt clean && apt autoremove --purge -echo " Enter new username: " -read username -adduser $username +dmesg -D + +#Force a safe username +while true; do + while true; do + echo " Enter new username: " + read username + #ensure no whitespace + case $username in *\ *) echo usernames may not contain whitespace;; *) break;; esac + done +adduser $username --gecos "" +retVal=$? +if [ $retVal == 0 ]; then + break +fi +done usermod -a -G sudo,netdev,input,video $username - +dmesg -E