If a configuration file is supplied then run it at the end of image generation

This commit is contained in:
Bob Mottram 2015-11-21 11:56:40 +00:00
parent 71503f2297
commit 699c77122a
3 changed files with 25 additions and 3 deletions

View File

@ -28,12 +28,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PROJECT_NAME='freedombone'
IMAGE_TYPE='beaglebone'
CURR_DIR=$(pwd)
BUILD_DIR=~/.tmp_freedombone_build
BUILD_DIR=~/.tmp_${PROJECT_NAME}_build
VMDEBOOTSTRAP_REPO=git://git.liw.fi/vmdebootstrap
VMDEBOOTSTRAP_VERSION=0.8
PROJECT_NAME=freedombone
MAKEFILE=${PROJECT_NAME}-image-makefile
USERNAME=$(echo $USER)
@ -49,6 +49,9 @@ BOX_IP_ADDRESS="192.168.1.55"
NAMESERVER1='213.73.91.35'
NAMESERVER2='85.214.20.141'
# An optional freedombone configuration file
CONFIG_FILENAME=
while [[ $# > 1 ]]
do
key="$1"
@ -57,6 +60,10 @@ case $key in
-h|--help)
show_help
;;
-c|--config)
shift
CONFIG_FILENAME="$1"
;;
-t|--target|--board)
shift
IMAGE_TYPE="$1"
@ -138,7 +145,8 @@ make $IMAGE_TYPE \
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
NAMESERVER1="$NAMESERVER1" \
NAMESERVER2="$NAMESERVER2" \
PROJECT_NAME="$PROJECT_NAME"
PROJECT_NAME="$PROJECT_NAME" \
CONFIG_FILENAME="$CONFIG_FILENAME"
shopt -s nullglob
imgfiles=(build/${PROJECT_NAME}*.img)

View File

@ -29,6 +29,8 @@
set -e
set -x
PROJECT_NAME='freedombone'
MY_USERNAME='debian'
MY_PASSWORD='freedombone'
@ -233,6 +235,16 @@ fi
set_apt_sources $MIRROR
chroot $rootdir apt-get update
# If a configuration file exists then run with it
# otherwise the interactive installer can be used
# This is equivalent to installing freedombox-setup on freedombox
if [ $CONFIG_FILENAME ]; then
if [ ${#CONFIG_FILENAME} -gt 2 ]; then
cp $CONFIG_FILENAME $rootdir/root/$PROJECT_NAME.cfg
chroot $rootdir $PROJECT_NAME -c /root/$PROJECT_NAME.cfg
fi
fi
cd /
echo "info: killing leftover processes in chroot"
# 2014-11-04 this killed /usr/lib/erlang/erts-6.2/bin/epmd, see

View File

@ -43,6 +43,7 @@ export BOX_IP_ADDRESS
export NAMESERVER1
export NAMESERVER2
export PROJECT_NAME
export CONFIG_FILENAME
# Locate vmdebootstrap program fetched in Makefile
basedir=`pwd`
@ -134,6 +135,7 @@ sudo sed -i "s|ROUTER_IP_ADDRESS=.*|ROUTER_IP_ADDRESS=${ROUTER_IP_ADDRESS}|g" $T
sudo sed -i "s|BOX_IP_ADDRESS=.*|BOX_IP_ADDRESS=${BOX_IP_ADDRESS}|g" $TEMP_CUSTOMISE
sudo sed -i "s|NAMESERVER1=.*|NAMESERVER1=${NAMESERVER1}|g" $TEMP_CUSTOMISE
sudo sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE
sudo sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE
echo "starting $VMDEBOOTSTRAP"
# Run vmdebootstrap script to create image