Make username entry more reliable

Disabled dmesg during entry, check for safe usernames
This commit is contained in:
SolidHal 2018-10-05 00:10:11 +00:00 committed by GitHub
parent 64b21e6b47
commit fb9f8d7712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,12 +72,25 @@ cp -rf $DIR/50-synaptics.conf /etc/X11/xorg.conf.d/
apt clean && apt autoremove --purge apt clean && apt autoremove --purge
echo " Enter new username: " dmesg -D
read username
adduser $username #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 usermod -a -G sudo,netdev,input,video $username
dmesg -E