Skip to content
Snippets Groups Projects
Commit 653d6f2d authored by Bob Mottram's avatar Bob Mottram
Browse files

Fixed username and password when generic images are created

parent 39e2d679
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ NO_OF_ARGS=$#
PROJECT_NAME='freedombone'
# username created by default within a debian image
DEFAULT_IMAGE_USERNAME='fbone'
GENERIC_IMAGE_USERNAME='fbone'
export TEXTDOMAIN=${PROJECT_NAME}-config
export TEXTDOMAINDIR="/usr/share/locale"
......@@ -475,9 +475,9 @@ function interactive_gpg {
esac
case $(cat $data) in
1) if [ -d /home/$MY_USERNAME/.gnupg ]; then
rm -rf /home/$MY_USERNAME/.gnupg
fi
break;;
rm -rf /home/$MY_USERNAME/.gnupg
fi
break;;
2) interactive_gpg_from_usb
break;;
3) interactive_gpg_from_remote
......@@ -653,7 +653,7 @@ function interactive_configuration {
fi
fi
if [ -d /home/$DEFAULT_IMAGE_USERNAME ]; then
if [ -d /home/$GENERIC_IMAGE_USERNAME ]; then
# when installing from an image which comes with a known default user account
selected_username=
while [ ! $selected_username ]
......@@ -673,9 +673,9 @@ function interactive_configuration {
if [[ $possible_username != *' '* && $possible_username != *'/'* && $possible_username != *'\'* && $possible_username != *'*'* ]]; then
if [ $possible_username ]; then
if [ ${#possible_username} -gt 1 ]; then
if [[ $possible_username != $DEFAULT_IMAGE_USERNAME ]]; then
if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
MY_USERNAME=$(cat $data)
usermod -l $MY_USERNAME $DEFAULT_IMAGE_USERNAME
usermod -l $MY_USERNAME $GENERIC_IMAGE_USERNAME
usermod -d /home/$MY_USERNAME -m $MY_USERNAME
break
fi
......
......@@ -33,6 +33,10 @@ PROJECT_NAME='freedombone'
export TEXTDOMAIN=${PROJECT_NAME}-image
export TEXTDOMAINDIR="/usr/share/locale"
# fixed username and password when the --generic option is used
GENERIC_IMAGE_USERNAME='fbone'
GENERIC_IMAGE_PASSWORD='freedombone'
IMAGE_TYPE='beaglebone'
CURR_DIR=$(pwd)
CURR_USER=$(echo $USER)
......@@ -156,6 +160,11 @@ if [[ $INTERACTIVE == "yes" || $INTERACTIVE == "y" || $INTERACTIVE == "Yes" ]];
fi
fi
if [[ $GENERIC_IMAGE == "yes" ]]; then
USERNAME=$GENERIC_IMAGE_USERNAME
PASSWORD=$GENERIC_IMAGE_PASSWORD
fi
if [ ! $PASSWORD ]; then
# generate a random password
PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment