Genericise in case the project name later changes
This commit is contained in:
parent
3239da7be5
commit
2f74d5865c
|
@ -33,10 +33,11 @@ CURR_DIR=$(pwd)
|
|||
BUILD_DIR=~/.tmp_freedombone_build
|
||||
VMDEBOOTSTRAP_REPO=git://git.liw.fi/vmdebootstrap
|
||||
VMDEBOOTSTRAP_VERSION=0.8
|
||||
MAKEFILE=freedombone-image-makefile
|
||||
PROJECT_NAME=freedombone
|
||||
MAKEFILE=${PROJECT_NAME}-image-makefile
|
||||
|
||||
USERNAME=$(echo $USER)
|
||||
PASSWORD='freedombone'
|
||||
PASSWORD="${PROJECT_NAME}"
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS="192.168.1.254"
|
||||
|
@ -111,7 +112,7 @@ else
|
|||
cp /usr/bin/$MAKEFILE $BUILD_DIR/Makefile
|
||||
fi
|
||||
|
||||
cp -r /etc/freedombone/* $BUILD_DIR
|
||||
cp -r /etc/${PROJECT_NAME}/* $BUILD_DIR
|
||||
cd $BUILD_DIR
|
||||
|
||||
rm -rf vendor
|
||||
|
@ -136,25 +137,26 @@ make $IMAGE_TYPE \
|
|||
ROUTER_IP_ADDRESS="$ROUTER_IP_ADDRESS" \
|
||||
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
|
||||
NAMESERVER1="$NAMESERVER1" \
|
||||
NAMESERVER2="$NAMESERVER2"
|
||||
NAMESERVER2="$NAMESERVER2" \
|
||||
PROJECT_NAME="$PROJECT_NAME"
|
||||
|
||||
shopt -s nullglob
|
||||
imgfiles=(build/freedombone*.img)
|
||||
imgfiles=(build/${PROJECT_NAME}*.img)
|
||||
if [ ${#imgfiles[@]} -eq 0 ]; then
|
||||
echo 'Image was not created'
|
||||
rm -rf $BUILD_DIR
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv build/freedombone*.bz2 $CURR_DIR
|
||||
mv build/freedombone*.img $CURR_DIR
|
||||
mv build/freedombone*.sig $CURR_DIR
|
||||
mv build/${PROJECT_NAME}*.bz2 $CURR_DIR
|
||||
mv build/${PROJECT_NAME}*.img $CURR_DIR
|
||||
mv build/${PROJECT_NAME}*.sig $CURR_DIR
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
clear
|
||||
echo '
|
||||
Image was created
|
||||
'
|
||||
ls -lh freedombone*.img freedombone*.sig freedombone*.bz2
|
||||
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.bz2
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -31,6 +31,7 @@ export ROUTER_IP_ADDRESS
|
|||
export BOX_IP_ADDRESS
|
||||
export NAMESERVER1
|
||||
export NAMESERVER2
|
||||
export PROJECT_NAME
|
||||
|
||||
# Locate vmdebootstrap program fetched in Makefile
|
||||
basedir=`pwd`
|
||||
|
@ -55,7 +56,7 @@ dev_pkgs="build-essential devscripts make man-db emacs org-mode git mercurial"
|
|||
# Packages needed for XFCE desktop environment
|
||||
xfce_pkgs="task-xfce-desktop iceweasel ca-certificates"
|
||||
|
||||
echo Building $MACHINE Freedombone for $ARCHITECTURE.
|
||||
echo Building $MACHINE $PROJECT_NAME for $ARCHITECTURE.
|
||||
|
||||
case "$MACHINE" in
|
||||
beaglebone)
|
||||
|
@ -101,7 +102,7 @@ for p in $base_pkgs $extra_pkgs; do
|
|||
done
|
||||
|
||||
# Make sure file is owned by current user, not root
|
||||
touch $(dirname $IMAGE)/freedombone.log
|
||||
touch $(dirname $IMAGE)/${PROJECT_NAME}.log
|
||||
|
||||
if [ -x vendor/vmdebootstrap/vmdebootstrap ] ; then
|
||||
VMDEBOOTSTRAP=vendor/vmdebootstrap/vmdebootstrap
|
||||
|
@ -110,11 +111,11 @@ else
|
|||
fi
|
||||
|
||||
echo 'Making customised customisation script'
|
||||
TEMP_CUSTOMISE=/etc/freedombone/image-customise
|
||||
if [ -f /usr/local/bin/freedombone-image-customise ]; then
|
||||
sudo cp /usr/local/bin/freedombone-image-customise $TEMP_CUSTOMISE
|
||||
TEMP_CUSTOMISE=/etc/${PROJECT_NAME}/image-customise
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME}-image-customise ]; then
|
||||
sudo cp /usr/local/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
||||
else
|
||||
sudo cp /usr/bin/freedombone-image-customise $TEMP_CUSTOMISE
|
||||
sudo cp /usr/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
||||
fi
|
||||
sudo sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MY_USERNAME}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MY_PASSWORD}|g" $TEMP_CUSTOMISE
|
||||
|
@ -134,11 +135,11 @@ sudo -H \
|
|||
SOURCE="$SOURCE" \
|
||||
CUSTOM_SETUP="$CUSTOM_SETUP" \
|
||||
$VMDEBOOTSTRAP \
|
||||
--log $(dirname $IMAGE)/freedombone.log \
|
||||
--log $(dirname $IMAGE)/${PROJECT_NAME}.log \
|
||||
--log-level debug \
|
||||
--size $IMAGE_SIZE \
|
||||
--image $IMAGE.img \
|
||||
--hostname freedombone \
|
||||
--hostname ${PROJECT_NAME} \
|
||||
--verbose \
|
||||
--mirror $BUILD_MIRROR \
|
||||
--customize "$TEMP_CUSTOMISE" \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/make
|
||||
#
|
||||
# A debian image builder, based upon freedom-maker
|
||||
# A debian image builder, based upon freedom-maker Makefile
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +26,7 @@ SOURCE ?= false
|
|||
# yes no
|
||||
BUILD = $(MACHINE)-$(ARCHITECTURE)
|
||||
TODAY := $(shell date +%Y-%m-%d)
|
||||
NAME = build/freedombone-$(TODAY)_$(BUILD)
|
||||
NAME = build/$(PROJECT_NAME)-$(TODAY)_$(BUILD)
|
||||
IMAGE = $(NAME).img
|
||||
ARCHIVE = $(NAME).tar.bz2
|
||||
SIGNATURE = $(ARCHIVE).sig
|
||||
|
@ -39,7 +39,7 @@ TEST_SSH_PORT = 2222
|
|||
TEST_FIRSTRUN_WAIT_TIME = 120 # seconds
|
||||
|
||||
USERNAME ?= $(echo $USER)
|
||||
PASSWORD ?= 'freedombone'
|
||||
PASSWORD ?= $(PROJECT_NAME)
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS ?= "192.168.1.254"
|
||||
|
@ -64,7 +64,7 @@ MAKE_IMAGE = ARCHITECTURE=$(ARCHITECTURE) MACHINE=$(MACHINE) SOURCE=$(SOURCE) \
|
|||
NAMESERVER1=$(NAMESERVER1) \
|
||||
NAMESERVER2=$(NAMESERVER2) \
|
||||
CUSTOM_SETUP=$(CUSTOM_SETUP) \
|
||||
IMAGE_SIZE=$(IMAGE_SIZE) taskset 0x01 freedombone-image-make $(NAME)
|
||||
IMAGE_SIZE=$(IMAGE_SIZE) taskset 0x01 $(PROJECT_NAME)-image-make $(NAME)
|
||||
|
||||
# build Beaglebone SD card image
|
||||
beaglebone: prep
|
||||
|
@ -134,7 +134,7 @@ virtualbox-amd64: prep
|
|||
test: test-virtualbox
|
||||
|
||||
test-virtualbox: virtualbox
|
||||
$(eval VM_NAME = freedom-maker-test)
|
||||
$(eval VM_NAME = $(PROJECT_NAME)-test)
|
||||
VBoxManage createvm --name $(VM_NAME) --ostype "Debian" --register
|
||||
VBoxManage storagectl $(VM_NAME) --name "SATA Controller" --add sata \
|
||||
--controller IntelAHCI
|
||||
|
@ -160,7 +160,7 @@ prep: vendor/vmdebootstrap/vmdebootstrap
|
|||
mkdir -p build
|
||||
|
||||
clean:
|
||||
-rm -f build/freedombone.log
|
||||
-rm -f build/$(PROJECT_NAME).log
|
||||
|
||||
distclean: clean
|
||||
sudo rm -rf build
|
||||
|
|
Loading…
Reference in New Issue