Image creation interactive mode

This commit is contained in:
Bob Mottram 2015-11-21 15:44:59 +00:00
parent cad6c92681
commit bbac58020a
2 changed files with 16 additions and 1 deletions

Binary file not shown.

View File

@ -61,6 +61,9 @@ MINIMUM_PASSWORD_LENGTH=10
# Optional ssh public key to allow # Optional ssh public key to allow
SSH_PUBKEY="no" SSH_PUBKEY="no"
# interactive mode
INTERACTIVE="no"
while [[ $# > 1 ]] while [[ $# > 1 ]]
do do
key="$1" key="$1"
@ -122,6 +125,10 @@ case $key in
shift shift
NAMESERVER2="$1" NAMESERVER2="$1"
;; ;;
-i|--interactive)
shift
INTERACTIVE="$1"
;;
*) *)
# unknown option # unknown option
;; ;;
@ -129,6 +136,14 @@ esac
shift shift
done done
if [[ $INTERACTIVE == "yes" || $INTERACTIVE == "y" || $INTERACTIVE == "Yes" ]]; then
freedombone-config
if [ -f freedombone.cfg ]; then
CONFIG_FILENAME=freedombone.cfg
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
fi
fi
if [ ! $PASSWORD ]; then if [ ! $PASSWORD ]; then
# generate a random password # generate a random password
PASSWORD="$(openssl rand -base64 10 | cut -c1-8)" PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
@ -177,7 +192,7 @@ make $IMAGE_TYPE \
PROJECT_NAME="$PROJECT_NAME" \ PROJECT_NAME="$PROJECT_NAME" \
CONFIG_FILENAME="$CONFIG_FILENAME" \ CONFIG_FILENAME="$CONFIG_FILENAME" \
IMAGE_SIZE="$IMAGE_SIZE" \ IMAGE_SIZE="$IMAGE_SIZE" \
SSH_PUBKEY="$SSH_PUBKEY" SSH_PUBKEY="$SSH_PUBKEY"
shopt -s nullglob shopt -s nullglob
imgfiles=(build/${PROJECT_NAME}*.img) imgfiles=(build/${PROJECT_NAME}*.img)