Give mesh images an indicative filename

This commit is contained in:
Bob Mottram 2016-05-28 17:52:13 +01:00
parent 55a2bd2899
commit 982192d679
1 changed files with 128 additions and 124 deletions

View File

@ -111,148 +111,148 @@ WIFI_HOTSPOT='no'
WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
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"
;; ;;
# 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"
;; ;;
-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"
;; ;;
@ -331,11 +331,15 @@ 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
if [[ $VARIANT == 'mesh' ]]; then
IMAGE_NAME=$'mesh'
fi fi
cd $TEMPBUILD_DIR cd $TEMPBUILD_DIR
@ -366,7 +370,7 @@ make $IMAGE_TYPE \
WIFI_HOTSPOT="$WIFI_HOTSPOT" \ WIFI_HOTSPOT="$WIFI_HOTSPOT" \
WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \ WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \
VARIANT="$VARIANT" VARIANT="$VARIANT"
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Build failed' echo $'Build failed'
rm -rf $TEMPBUILD_DIR rm -rf $TEMPBUILD_DIR