diff --git a/man/freedombone-image.1.gz b/man/freedombone-image.1.gz index 4f48fa75..4da57069 100644 Binary files a/man/freedombone-image.1.gz and b/man/freedombone-image.1.gz differ diff --git a/src/freedombone-image b/src/freedombone-image index a34ea2a1..154548b5 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -65,6 +65,9 @@ SSH_PUBKEY="no" # interactive mode INTERACTIVE="no" +# Whether this is a generic image for mass redistribution on the interwebs +GENERIC_IMAGE="no" + while [[ $# > 1 ]] do key="$1" @@ -130,6 +133,10 @@ case $key in shift INTERACTIVE="$1" ;; + -g|--generic) + shift + GENERIC_IMAGE="$1" + ;; *) # unknown option ;; @@ -182,7 +189,8 @@ make $IMAGE_TYPE \ PROJECT_NAME="$PROJECT_NAME" \ CONFIG_FILENAME="$CONFIG_FILENAME" \ IMAGE_SIZE="$IMAGE_SIZE" \ - SSH_PUBKEY="$SSH_PUBKEY" + SSH_PUBKEY="$SSH_PUBKEY" \ + GENERIC_IMAGE="$GENERIC_IMAGE" shopt -s nullglob imgfiles=(build/${PROJECT_NAME}*.img) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 8aa1eb8b..a7d2b4a7 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -50,6 +50,9 @@ CONFIG_FILENAME= # Optional ssh public key to allow SSH_PUBKEY="no" +# Whether this is a generic image for mass redistribution on the interwebs +GENERIC_IMAGE="no" + enable_eatmydata_override() { chroot $rootdir apt-get install --no-install-recommends -y eatmydata if [ -x $rootdir/usr/bin/eatmydata ] && \ @@ -181,6 +184,33 @@ admin_user_sudo() { echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers } +create_generic_image() { + if [[ $GENERIC_IMAGE == "no" ]]; then + return + fi + # Don't install any configuration. This will be a base system + CONFIG_FILENAME= + # The presence of this file indicates that the initial + # setup has not yet been completed + touch $rootdir/home/$MY_USERNAME/.initial_setup + + + cat >> /home/$MY_USERNAME/.bashrc <>> Freedombone system initial setup <<<' + echo '' + echo 'The first thing you need to do is to change your password, otherwise' + echo 'your system will be insecure. Your password should be at least 10' + echo 'characters long and contain letters and numbers. Do this now:' + passwd + sudo su + freedombone menuconfig + rm ~/.initial_setup +fi +EOF +} + continue_installation() { # If a configuration file exists then run with it # otherwise the interactive installer can be used @@ -298,6 +328,7 @@ chroot "$rootdir" apt-get update configure_ssh configure_networking admin_user_sudo +create_generic_image continue_installation cd / diff --git a/src/freedombone-image-make b/src/freedombone-image-make index 008205d8..1823328d 100755 --- a/src/freedombone-image-make +++ b/src/freedombone-image-make @@ -45,6 +45,7 @@ export NAMESERVER2 export PROJECT_NAME export CONFIG_FILENAME export SSH_PUBKEY +export GENERIC_IMAGE # Locate vmdebootstrap program fetched in Makefile basedir=`pwd` @@ -144,6 +145,7 @@ sudo sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE sudo sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE sudo sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" $TEMP_CUSTOMISE sudo sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" $TEMP_CUSTOMISE +sudo sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" $TEMP_CUSTOMISE echo "starting $VMDEBOOTSTRAP" # Run vmdebootstrap script to create image