Keep the mesh client image size small, so that it can be copied quickly
This commit is contained in:
parent
1965bf7668
commit
0c14b14603
|
@ -119,220 +119,220 @@ INSECURE='no'
|
||||||
AMNESIC='no'
|
AMNESIC='no'
|
||||||
|
|
||||||
mesh_router_setup_script() {
|
mesh_router_setup_script() {
|
||||||
# create a setup script for a mesh router
|
# create a setup script for a mesh router
|
||||||
mesh_script_filename=$1
|
mesh_script_filename=$1
|
||||||
echo "MY_USERNAME=${USERNAME}" > $mesh_script_filename
|
echo "MY_USERNAME=${USERNAME}" > $mesh_script_filename
|
||||||
echo "DEFAULT_DOMAIN_NAME=${USERNAME}" >> $mesh_script_filename
|
echo "DEFAULT_DOMAIN_NAME=${USERNAME}" >> $mesh_script_filename
|
||||||
echo 'SYSTEM_TYPE=mesh' >> $mesh_script_filename
|
echo 'SYSTEM_TYPE=mesh' >> $mesh_script_filename
|
||||||
echo 'INSTALLING_ON_BBB=no' >> $mesh_script_filename
|
echo 'INSTALLING_ON_BBB=no' >> $mesh_script_filename
|
||||||
echo 'USB_DRIVE=/dev/sda1' >> $mesh_script_filename
|
echo 'USB_DRIVE=/dev/sda1' >> $mesh_script_filename
|
||||||
echo 'DDNS_PROVIDER=' >> $mesh_script_filename
|
echo 'DDNS_PROVIDER=' >> $mesh_script_filename
|
||||||
echo 'DDNS_USERNAME=' >> $mesh_script_filename
|
echo 'DDNS_USERNAME=' >> $mesh_script_filename
|
||||||
echo 'DDNS_PASSWORD=' >> $mesh_script_filename
|
echo 'DDNS_PASSWORD=' >> $mesh_script_filename
|
||||||
echo 'DEFAULT_LANGUAGE=en_GB.UTF-8' >> $mesh_script_filename
|
echo 'DEFAULT_LANGUAGE=en_GB.UTF-8' >> $mesh_script_filename
|
||||||
echo 'MY_EMAIL_ADDRESS=' >> $mesh_script_filename
|
echo 'MY_EMAIL_ADDRESS=' >> $mesh_script_filename
|
||||||
echo 'ENABLE_CJDNS=no' >> $mesh_script_filename
|
echo 'ENABLE_CJDNS=no' >> $mesh_script_filename
|
||||||
echo 'ENABLE_BATMAN=yes' >> $mesh_script_filename
|
echo 'ENABLE_BATMAN=yes' >> $mesh_script_filename
|
||||||
echo 'ENABLE_BABEL=no' >> $mesh_script_filename
|
echo 'ENABLE_BABEL=no' >> $mesh_script_filename
|
||||||
echo 'DEBIAN_REPO=' >> $mesh_script_filename
|
echo 'DEBIAN_REPO=' >> $mesh_script_filename
|
||||||
echo 'NAMESERVER1=' >> $mesh_script_filename
|
echo 'NAMESERVER1=' >> $mesh_script_filename
|
||||||
echo 'NAMESERVER2=' >> $mesh_script_filename
|
echo 'NAMESERVER2=' >> $mesh_script_filename
|
||||||
echo 'BATMAN_CELLID=any' >> $mesh_script_filename
|
echo 'BATMAN_CELLID=any' >> $mesh_script_filename
|
||||||
echo 'WIFI_CHANNEL=9' >> $mesh_script_filename
|
echo 'WIFI_CHANNEL=9' >> $mesh_script_filename
|
||||||
}
|
}
|
||||||
|
|
||||||
while [[ $# > 1 ]]
|
while [[ $# > 1 ]]
|
||||||
do
|
do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
;;
|
;;
|
||||||
-c|--config)
|
-c|--config)
|
||||||
shift
|
shift
|
||||||
CONFIG_FILENAME="$1"
|
CONFIG_FILENAME="$1"
|
||||||
if [ ! -f $CONFIG_FILENAME ]; then
|
if [ ! -f $CONFIG_FILENAME ]; then
|
||||||
echo $"Config file $CONFIG_FILENAME not found"
|
echo $"Config file $CONFIG_FILENAME not found"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
|
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
|
||||||
;;
|
;;
|
||||||
-t|--target|--board)
|
-t|--target|--board)
|
||||||
shift
|
shift
|
||||||
IMAGE_TYPE="$1"
|
IMAGE_TYPE="$1"
|
||||||
;;
|
;;
|
||||||
-u|--user|--username)
|
-u|--user|--username)
|
||||||
shift
|
shift
|
||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
;;
|
;;
|
||||||
-p|--password)
|
-p|--password)
|
||||||
shift
|
shift
|
||||||
PASSWORD="$1"
|
PASSWORD="$1"
|
||||||
if [ ${#PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
if [ ${#PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||||
echo $"Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters"
|
echo $"Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters"
|
||||||
exit 3628
|
exit 3628
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--sshkey|--sshpubkey|--pubkey)
|
--sshkey|--sshpubkey|--pubkey)
|
||||||
shift
|
shift
|
||||||
SSH_PUBKEY="$1"
|
SSH_PUBKEY="$1"
|
||||||
;;
|
;;
|
||||||
-s|--size)
|
-s|--size)
|
||||||
shift
|
shift
|
||||||
IMAGE_SIZE="$1"
|
IMAGE_SIZE="$1"
|
||||||
IMAGE_SIZE_SPECIFIED=1
|
IMAGE_SIZE_SPECIFIED=1
|
||||||
;;
|
;;
|
||||||
# Box static IP address on the LAN
|
# Box static IP address on the LAN
|
||||||
--ip)
|
--ip)
|
||||||
shift
|
shift
|
||||||
BOX_IP_ADDRESS="$1"
|
BOX_IP_ADDRESS="$1"
|
||||||
;;
|
;;
|
||||||
# Router IP address on the LAN
|
# Router IP address on the LAN
|
||||||
--iprouter)
|
--iprouter)
|
||||||
shift
|
shift
|
||||||
ROUTER_IP_ADDRESS="$1"
|
ROUTER_IP_ADDRESS="$1"
|
||||||
;;
|
;;
|
||||||
# nameserver 1
|
# nameserver 1
|
||||||
--ns1|--nameserver1)
|
--ns1|--nameserver1)
|
||||||
shift
|
shift
|
||||||
NAMESERVER1="$1"
|
NAMESERVER1="$1"
|
||||||
;;
|
;;
|
||||||
# nameserver 2
|
# nameserver 2
|
||||||
--ns2|--nameserver2)
|
--ns2|--nameserver2)
|
||||||
shift
|
shift
|
||||||
NAMESERVER2="$1"
|
NAMESERVER2="$1"
|
||||||
;;
|
;;
|
||||||
-i|--interactive)
|
-i|--interactive)
|
||||||
shift
|
shift
|
||||||
INTERACTIVE="$1"
|
INTERACTIVE="$1"
|
||||||
;;
|
;;
|
||||||
-g|--generic)
|
-g|--generic)
|
||||||
shift
|
shift
|
||||||
GENERIC_IMAGE="$1"
|
GENERIC_IMAGE="$1"
|
||||||
;;
|
;;
|
||||||
--minimal)
|
--minimal)
|
||||||
shift
|
shift
|
||||||
MINIMAL_INSTALL="$1"
|
MINIMAL_INSTALL="$1"
|
||||||
;;
|
;;
|
||||||
--ssh|--sshport)
|
--ssh|--sshport)
|
||||||
shift
|
shift
|
||||||
SSH_PORT="$1"
|
SSH_PORT="$1"
|
||||||
;;
|
;;
|
||||||
-v|--variant)
|
-v|--variant)
|
||||||
shift
|
shift
|
||||||
VARIANT="$1"
|
VARIANT="$1"
|
||||||
;;
|
;;
|
||||||
-o|--onion)
|
-o|--onion)
|
||||||
shift
|
shift
|
||||||
ONION_ONLY="$1"
|
ONION_ONLY="$1"
|
||||||
;;
|
;;
|
||||||
-a|--amnesic)
|
-a|--amnesic)
|
||||||
shift
|
shift
|
||||||
AMNESIC="$1"
|
AMNESIC="$1"
|
||||||
;;
|
;;
|
||||||
-r|--repo|--repository)
|
-r|--repo|--repository)
|
||||||
shift
|
shift
|
||||||
PROJECT_REPO="$1"
|
PROJECT_REPO="$1"
|
||||||
;;
|
;;
|
||||||
-m|--mirror)
|
-m|--mirror)
|
||||||
shift
|
shift
|
||||||
MIRROR="$1"
|
MIRROR="$1"
|
||||||
;;
|
;;
|
||||||
--debianonly|--basic|--minimal)
|
--debianonly|--basic|--minimal)
|
||||||
shift
|
shift
|
||||||
DEBIAN_INSTALL_ONLY="$1"
|
DEBIAN_INSTALL_ONLY="$1"
|
||||||
;;
|
;;
|
||||||
--interface|--if)
|
--interface|--if)
|
||||||
shift
|
shift
|
||||||
WIFI_INTERFACE="$1"
|
WIFI_INTERFACE="$1"
|
||||||
;;
|
;;
|
||||||
--ssid|--essid)
|
--ssid|--essid)
|
||||||
shift
|
shift
|
||||||
WIFI_SSID="$1"
|
WIFI_SSID="$1"
|
||||||
;;
|
;;
|
||||||
--wifitype)
|
--wifitype)
|
||||||
shift
|
shift
|
||||||
WIFI_TYPE="$1"
|
WIFI_TYPE="$1"
|
||||||
;;
|
;;
|
||||||
--wifipass|--passphrase)
|
--wifipass|--passphrase)
|
||||||
shift
|
shift
|
||||||
WIFI_PASSPHRASE="$1"
|
WIFI_PASSPHRASE="$1"
|
||||||
;;
|
;;
|
||||||
--hotspot)
|
--hotspot)
|
||||||
shift
|
shift
|
||||||
if [[ $"$1" == $'yes' || $"$1" == $'y' ]]; then
|
if [[ $"$1" == $'yes' || $"$1" == $'y' ]]; then
|
||||||
WIFI_HOTSPOT='yes'
|
WIFI_HOTSPOT='yes'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--networks)
|
--networks)
|
||||||
shift
|
shift
|
||||||
WIFI_NETWORKS_FILE="$1"
|
WIFI_NETWORKS_FILE="$1"
|
||||||
;;
|
;;
|
||||||
--insecure)
|
--insecure)
|
||||||
shift
|
shift
|
||||||
INSECURE="$1"
|
INSECURE="$1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $INTERACTIVE == "yes" || $INTERACTIVE == "y" || $INTERACTIVE == "Yes" ]]; then
|
if [[ $INTERACTIVE == "yes" || $INTERACTIVE == "y" || $INTERACTIVE == "Yes" ]]; then
|
||||||
${PROJECT_NAME}-config --minimal "$MINIMAL_INSTALL"
|
${PROJECT_NAME}-config --minimal "$MINIMAL_INSTALL"
|
||||||
if [ -f freedombone.cfg ]; then
|
if [ -f freedombone.cfg ]; then
|
||||||
CONFIG_FILENAME=freedombone.cfg
|
CONFIG_FILENAME=freedombone.cfg
|
||||||
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
|
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $GENERIC_IMAGE == "yes" ]]; then
|
if [[ $GENERIC_IMAGE == "yes" ]]; then
|
||||||
USERNAME=$GENERIC_IMAGE_USERNAME
|
USERNAME=$GENERIC_IMAGE_USERNAME
|
||||||
PASSWORD=$GENERIC_IMAGE_PASSWORD
|
PASSWORD=$GENERIC_IMAGE_PASSWORD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! $PASSWORD ]; then
|
if [ ! $PASSWORD ]; then
|
||||||
# generate a random password
|
# generate a random password
|
||||||
PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
PASSWORD="$(openssl rand -base64 30 | cut -c1-${MINIMUM_PASSWORD_LENGTH})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move any existing images into a build subdirectory
|
# Move any existing images into a build subdirectory
|
||||||
image_types=( xz img sig vdi qcow2 )
|
image_types=( xz img sig vdi qcow2 )
|
||||||
for im in "${image_types[@]}"
|
for im in "${image_types[@]}"
|
||||||
do
|
do
|
||||||
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
||||||
if (( no_of_files > 0 )); then
|
if (( no_of_files > 0 )); then
|
||||||
if [ ! -d ${CURR_DIR}/build ]; then
|
if [ ! -d ${CURR_DIR}/build ]; then
|
||||||
mkdir ${CURR_DIR}/build
|
mkdir ${CURR_DIR}/build
|
||||||
fi
|
fi
|
||||||
mv -f ${CURR_DIR}/${PROJECT_NAME}*.${im} ${CURR_DIR}/build
|
mv -f ${CURR_DIR}/${PROJECT_NAME}*.${im} ${CURR_DIR}/build
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Delete anything which didn't move
|
# Delete anything which didn't move
|
||||||
for im in "${image_types[@]}"
|
for im in "${image_types[@]}"
|
||||||
do
|
do
|
||||||
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
||||||
if (( no_of_files > 0 )); then
|
if (( no_of_files > 0 )); then
|
||||||
rm -f ${CURR_DIR}/${PROJECT_NAME}*.${im}
|
rm -f ${CURR_DIR}/${PROJECT_NAME}*.${im}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove any existing login credentials file
|
# Remove any existing login credentials file
|
||||||
if [ -f ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt ]; then
|
if [ -f ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt ]; then
|
||||||
rm ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt
|
rm ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $TEMPBUILD_DIR ]; then
|
if [ -d $TEMPBUILD_DIR ]; then
|
||||||
rm -rf $TEMPBUILD_DIR
|
rm -rf $TEMPBUILD_DIR
|
||||||
fi
|
fi
|
||||||
mkdir -p $TEMPBUILD_DIR
|
mkdir -p $TEMPBUILD_DIR
|
||||||
if [ -f /usr/local/bin/$MAKEFILE ]; then
|
if [ -f /usr/local/bin/$MAKEFILE ]; then
|
||||||
cp /usr/local/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
cp /usr/local/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
||||||
else
|
else
|
||||||
cp /usr/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
cp /usr/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -r /etc/${PROJECT_NAME}/* $TEMPBUILD_DIR
|
cp -r /etc/${PROJECT_NAME}/* $TEMPBUILD_DIR
|
||||||
|
@ -341,96 +341,99 @@ chown -R $CURR_USER:$CURR_USER $TEMPBUILD_DIR
|
||||||
cd $TEMPBUILD_DIR
|
cd $TEMPBUILD_DIR
|
||||||
|
|
||||||
if [[ $MINIMAL_INSTALL == "yes" ]]; then
|
if [[ $MINIMAL_INSTALL == "yes" ]]; then
|
||||||
IMAGE_NAME=$'min'
|
IMAGE_NAME=$'min'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ONION_ONLY != "no" ]]; then
|
if [[ $ONION_ONLY != "no" ]]; then
|
||||||
IMAGE_NAME=$'onion'
|
IMAGE_NAME=$'onion'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $VARIANT == 'mesh' ]]; then
|
if [[ $VARIANT == 'mesh' ]]; then
|
||||||
IMAGE_NAME=$'mesh'
|
IMAGE_NAME=$'mesh'
|
||||||
# typically not much disk space is needed for a mesh node
|
# typically not much disk space is needed for a mesh node
|
||||||
if [ ! $IMAGE_SIZE_SPECIFIED ]; then
|
if [ ! $IMAGE_SIZE_SPECIFIED ]; then
|
||||||
IMAGE_SIZE=2G
|
IMAGE_SIZE=2G
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $VARIANT == 'meshclient' || $VARIANT == 'meshusb' ]]; then
|
if [[ $VARIANT == 'meshclient' || $VARIANT == 'meshusb' ]]; then
|
||||||
IMAGE_NAME=$'meshclient'
|
IMAGE_NAME=$'meshclient'
|
||||||
|
if [ ! $IMAGE_SIZE_SPECIFIED ]; then
|
||||||
|
IMAGE_SIZE=2.5G
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $VARIANT == 'usb' ]]; then
|
if [[ $VARIANT == 'usb' ]]; then
|
||||||
IMAGE_NAME=$'usb'
|
IMAGE_NAME=$'usb'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# append amnesic to the image name if needed
|
# append amnesic to the image name if needed
|
||||||
if [[ $AMNESIC != 'no' ]]; then
|
if [[ $AMNESIC != 'no' ]]; then
|
||||||
IMAGE_NAME="${IMAGE_NAME}-amnesic"
|
IMAGE_NAME="${IMAGE_NAME}-amnesic"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $TEMPBUILD_DIR
|
cd $TEMPBUILD_DIR
|
||||||
make $IMAGE_TYPE \
|
make $IMAGE_TYPE \
|
||||||
MYUSERNAME="$USERNAME" \
|
MYUSERNAME="$USERNAME" \
|
||||||
MYPASSWORD="$PASSWORD" \
|
MYPASSWORD="$PASSWORD" \
|
||||||
ROUTER_IP_ADDRESS="$ROUTER_IP_ADDRESS" \
|
ROUTER_IP_ADDRESS="$ROUTER_IP_ADDRESS" \
|
||||||
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
|
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
|
||||||
NAMESERVER1="$NAMESERVER1" \
|
NAMESERVER1="$NAMESERVER1" \
|
||||||
NAMESERVER2="$NAMESERVER2" \
|
NAMESERVER2="$NAMESERVER2" \
|
||||||
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" \
|
||||||
GENERIC_IMAGE="$GENERIC_IMAGE" \
|
GENERIC_IMAGE="$GENERIC_IMAGE" \
|
||||||
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
|
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
|
||||||
SSH_PORT="$SSH_PORT" \
|
SSH_PORT="$SSH_PORT" \
|
||||||
ONION_ONLY="$ONION_ONLY" \
|
ONION_ONLY="$ONION_ONLY" \
|
||||||
IMAGE_NAME="$IMAGE_NAME" \
|
IMAGE_NAME="$IMAGE_NAME" \
|
||||||
PROJECT_REPO="$PROJECT_REPO" \
|
PROJECT_REPO="$PROJECT_REPO" \
|
||||||
MIRROR="$MIRROR" \
|
MIRROR="$MIRROR" \
|
||||||
BUILD_MIRROR="$MIRROR" \
|
BUILD_MIRROR="$MIRROR" \
|
||||||
DEBIAN_INSTALL_ONLY="$DEBIAN_INSTALL_ONLY" \
|
DEBIAN_INSTALL_ONLY="$DEBIAN_INSTALL_ONLY" \
|
||||||
WIFI_INTERFACE="$WIFI_INTERFACE" \
|
WIFI_INTERFACE="$WIFI_INTERFACE" \
|
||||||
WIFI_SSID="$WIFI_SSID" \
|
WIFI_SSID="$WIFI_SSID" \
|
||||||
WIFI_TYPE="$WIFI_TYPE" \
|
WIFI_TYPE="$WIFI_TYPE" \
|
||||||
WIFI_PASSPHRASE="$WIFI_PASSPHRASE" \
|
WIFI_PASSPHRASE="$WIFI_PASSPHRASE" \
|
||||||
WIFI_HOTSPOT="$WIFI_HOTSPOT" \
|
WIFI_HOTSPOT="$WIFI_HOTSPOT" \
|
||||||
WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \
|
WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \
|
||||||
VARIANT="$VARIANT" \
|
VARIANT="$VARIANT" \
|
||||||
MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
|
MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
|
||||||
INSECURE="$INSECURE" \
|
INSECURE="$INSECURE" \
|
||||||
AMNESIC="$AMNESIC"
|
AMNESIC="$AMNESIC"
|
||||||
|
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $'Build failed'
|
echo $'Build failed'
|
||||||
rm -rf $TEMPBUILD_DIR
|
rm -rf $TEMPBUILD_DIR
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXPECTED_EXTENSION='xz'
|
EXPECTED_EXTENSION='xz'
|
||||||
if [[ $IMAGE_TYPE == "qemu"* ]]; then
|
if [[ $IMAGE_TYPE == "qemu"* ]]; then
|
||||||
EXPECTED_EXTENSION='qcow2'
|
EXPECTED_EXTENSION='qcow2'
|
||||||
fi
|
fi
|
||||||
if [[ $IMAGE_TYPE == "virtualbox"* ]]; then
|
if [[ $IMAGE_TYPE == "virtualbox"* ]]; then
|
||||||
EXPECTED_EXTENSION='vdi'
|
EXPECTED_EXTENSION='vdi'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
imgfiles=(build/${PROJECT_NAME}*.${EXPECTED_EXTENSION})
|
imgfiles=(build/${PROJECT_NAME}*.${EXPECTED_EXTENSION})
|
||||||
if [ ${#imgfiles[@]} -eq 0 ]; then
|
if [ ${#imgfiles[@]} -eq 0 ]; then
|
||||||
echo $'Image was not created'
|
echo $'Image was not created'
|
||||||
rm -rf $TEMPBUILD_DIR
|
rm -rf $TEMPBUILD_DIR
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move images from temporary directory to the current directory
|
# Move images from temporary directory to the current directory
|
||||||
for im in "${image_types[@]}"
|
for im in "${image_types[@]}"
|
||||||
do
|
do
|
||||||
no_of_files=$(ls -afq build/${PROJECT_NAME}*.${im} | wc -l)
|
no_of_files=$(ls -afq build/${PROJECT_NAME}*.${im} | wc -l)
|
||||||
if (( no_of_files > 0 )); then
|
if (( no_of_files > 0 )); then
|
||||||
mv build/${PROJECT_NAME}*.${im} ${CURR_DIR}/
|
mv build/${PROJECT_NAME}*.${im} ${CURR_DIR}/
|
||||||
sudo chown ${CURR_USER}:${CURR_USER} ${CURR_DIR}/*.${im}
|
sudo chown ${CURR_USER}:${CURR_USER} ${CURR_DIR}/*.${im}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove the temporary directory
|
# Remove the temporary directory
|
||||||
|
@ -445,32 +448,32 @@ Image was created.
|
||||||
You will be able to log into it with:
|
You will be able to log into it with:
|
||||||
"
|
"
|
||||||
if [[ $IMAGE_TYPE != "virtualbox"* && $IMAGE_TYPE != "qemu"* ]]; then
|
if [[ $IMAGE_TYPE != "virtualbox"* && $IMAGE_TYPE != "qemu"* ]]; then
|
||||||
echo $" ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT
|
echo $" ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT
|
||||||
|
|
||||||
Password: $PASSWORD
|
Password: $PASSWORD
|
||||||
"
|
"
|
||||||
else
|
else
|
||||||
if [[ $IMAGE_TYPE != "qemu"* ]]; then
|
if [[ $IMAGE_TYPE != "qemu"* ]]; then
|
||||||
echo $" Username: $USERNAME
|
echo $" Username: $USERNAME
|
||||||
Password: $PASSWORD
|
Password: $PASSWORD
|
||||||
"
|
"
|
||||||
else
|
else
|
||||||
if [[ $IMAGE_TYPE != "qemu-x86_64"* && $IMAGE_TYPE != "qemu-amd64"* ]]; then
|
if [[ $IMAGE_TYPE != "qemu-x86_64"* && $IMAGE_TYPE != "qemu-amd64"* ]]; then
|
||||||
echo "qemu-system-i386 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
echo "qemu-system-i386 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
||||||
else
|
else
|
||||||
echo "qemu-system-x86_64 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
echo "qemu-system-x86_64 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
||||||
fi
|
fi
|
||||||
echo $"
|
echo $"
|
||||||
Username: $USERNAME
|
Username: $USERNAME
|
||||||
Password: $PASSWORD
|
Password: $PASSWORD
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.xz ${PROJECT_NAME}*.vdi ${PROJECT_NAME}*.qcow2
|
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.xz ${PROJECT_NAME}*.vdi ${PROJECT_NAME}*.qcow2
|
||||||
|
|
||||||
# Remove the mesh script after use
|
# Remove the mesh script after use
|
||||||
if [[ $VARIANT == "mesh"* ]]; then
|
if [[ $VARIANT == "mesh"* ]]; then
|
||||||
rm -f $CONFIG_FILENAME
|
rm -f $CONFIG_FILENAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# record the default login credentials for later use
|
# record the default login credentials for later use
|
||||||
|
@ -479,12 +482,12 @@ Password: $PASSWORD" > ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt
|
||||||
chmod 600 ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt
|
chmod 600 ${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt
|
||||||
|
|
||||||
if [[ $IMAGE_TYPE != "virtualbox"* && $IMAGE_TYPE != "qemu"* ]]; then
|
if [[ $IMAGE_TYPE != "virtualbox"* && $IMAGE_TYPE != "qemu"* ]]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo $'You can copy the image to a microSD card with:'
|
echo $'You can copy the image to a microSD card with:'
|
||||||
echo ''
|
echo ''
|
||||||
echo " unxz -k ${PROJECT_NAME}*.img.xz"
|
echo " unxz -k ${PROJECT_NAME}*.img.xz"
|
||||||
echo " sudo dd bs=1M if=${PROJECT_NAME}*.img of=/dev/sdX conv=fdatasync"
|
echo " sudo dd bs=1M if=${PROJECT_NAME}*.img of=/dev/sdX conv=fdatasync"
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue