Create a new user during image install
This commit is contained in:
parent
3eb0cfb21f
commit
758f507dfd
|
@ -35,6 +35,9 @@ PROJECT_NAME='freedombone'
|
|||
export TEXTDOMAIN=$PROJECT_NAME
|
||||
export TEXTDOMAINDIR="/usr/share/locale"
|
||||
|
||||
# username created by default within a debian image
|
||||
GENERIC_IMAGE_USERNAME='fbone'
|
||||
|
||||
# Web site
|
||||
FREEDOMBONE_WEBSITE="http://freedombone.uk.to"
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ FREEDOMBONE_BITMESSAGE="BM-2cWuhmBvVdfrHhLoZTdspCkKeiTorUesSL"
|
|||
# Minimum number of characters in a password
|
||||
MINIMUM_PASSWORD_LENGTH=10
|
||||
|
||||
# file containing new password
|
||||
IMAGE_PASSWORD_FILE=/root/login.txt
|
||||
|
||||
# Different system variants which may be specified within
|
||||
# the SYSTEM_TYPE option
|
||||
VARIANT_FULL="full"
|
||||
|
@ -654,6 +657,10 @@ function interactive_configuration {
|
|||
fi
|
||||
|
||||
if [ -d /home/$GENERIC_IMAGE_USERNAME ]; then
|
||||
if [ ! -f $IMAGE_PASSWORD_FILE ]; then
|
||||
echo 'Cannot find the password file for the admin user'
|
||||
exit 62753
|
||||
fi
|
||||
# when installing from an image which comes with a known default user account
|
||||
selected_username=
|
||||
while [ ! $selected_username ]
|
||||
|
@ -675,8 +682,7 @@ function interactive_configuration {
|
|||
if [ ${#possible_username} -gt 1 ]; then
|
||||
if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
|
||||
MY_USERNAME=$(cat $data)
|
||||
usermod -l $MY_USERNAME $GENERIC_IMAGE_USERNAME
|
||||
usermod -d /home/$MY_USERNAME -m $MY_USERNAME
|
||||
useradd -m -p "$IMAGE_PASSWORD_FILE" -s /bin/bash $MY_USERNAME
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue