diff --git a/src/freedombone-image b/src/freedombone-image index a162624d..0a288d87 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -111,148 +111,148 @@ WIFI_HOTSPOT='no' WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg mesh_router_setup_script() { - # create a setup script for a mesh router - mesh_script_filename=$1 - echo "MY_USERNAME=${USERNAME}" > $mesh_script_filename - echo "DEFAULT_DOMAIN_NAME=${USERNAME}" >> $mesh_script_filename - echo 'SYSTEM_TYPE=mesh' >> $mesh_script_filename - echo 'INSTALLING_ON_BBB=no' >> $mesh_script_filename - echo 'USB_DRIVE=/dev/sda1' >> $mesh_script_filename - echo 'DDNS_PROVIDER=' >> $mesh_script_filename - echo 'DDNS_USERNAME=' >> $mesh_script_filename - echo 'DDNS_PASSWORD=' >> $mesh_script_filename - echo 'DEFAULT_LANGUAGE=en_GB.UTF-8' >> $mesh_script_filename - echo 'MY_EMAIL_ADDRESS=' >> $mesh_script_filename - echo 'ENABLE_CJDNS=no' >> $mesh_script_filename - echo 'ENABLE_BATMAN=yes' >> $mesh_script_filename - echo 'ENABLE_BABEL=no' >> $mesh_script_filename - echo 'DEBIAN_REPO=' >> $mesh_script_filename - echo 'NAMESERVER1=' >> $mesh_script_filename - echo 'NAMESERVER2=' >> $mesh_script_filename - echo 'BATMAN_CELLID=any' >> $mesh_script_filename - echo 'WIFI_CHANNEL=9' >> $mesh_script_filename + # create a setup script for a mesh router + mesh_script_filename=$1 + echo "MY_USERNAME=${USERNAME}" > $mesh_script_filename + echo "DEFAULT_DOMAIN_NAME=${USERNAME}" >> $mesh_script_filename + echo 'SYSTEM_TYPE=mesh' >> $mesh_script_filename + echo 'INSTALLING_ON_BBB=no' >> $mesh_script_filename + echo 'USB_DRIVE=/dev/sda1' >> $mesh_script_filename + echo 'DDNS_PROVIDER=' >> $mesh_script_filename + echo 'DDNS_USERNAME=' >> $mesh_script_filename + echo 'DDNS_PASSWORD=' >> $mesh_script_filename + echo 'DEFAULT_LANGUAGE=en_GB.UTF-8' >> $mesh_script_filename + echo 'MY_EMAIL_ADDRESS=' >> $mesh_script_filename + echo 'ENABLE_CJDNS=no' >> $mesh_script_filename + echo 'ENABLE_BATMAN=yes' >> $mesh_script_filename + echo 'ENABLE_BABEL=no' >> $mesh_script_filename + echo 'DEBIAN_REPO=' >> $mesh_script_filename + echo 'NAMESERVER1=' >> $mesh_script_filename + echo 'NAMESERVER2=' >> $mesh_script_filename + echo 'BATMAN_CELLID=any' >> $mesh_script_filename + echo 'WIFI_CHANNEL=9' >> $mesh_script_filename } while [[ $# > 1 ]] do - key="$1" + key="$1" - case $key in - -h|--help) - show_help - ;; - -c|--config) - shift - CONFIG_FILENAME="$1" - if [ ! -f $CONFIG_FILENAME ]; then - echo $"Config file $CONFIG_FILENAME not found" - exit 3 - fi - DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}') - ;; - -t|--target|--board) - shift - IMAGE_TYPE="$1" - ;; - -u|--user|--username) - shift - USERNAME="$1" - ;; - -p|--password) - shift - PASSWORD="$1" - if [ ${#PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then - echo $"Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters" - exit 3628 - fi - ;; - --sshkey|--sshpubkey|--pubkey) - shift - SSH_PUBKEY="$1" - ;; - -s|--size) - shift - IMAGE_SIZE="$1" - ;; - # Box static IP address on the LAN - --ip) - shift - BOX_IP_ADDRESS="$1" - ;; - # Router IP address on the LAN - --iprouter) - shift - ROUTER_IP_ADDRESS="$1" - ;; - # nameserver 1 - --ns1|--nameserver1) - shift - NAMESERVER1="$1" - ;; - # nameserver 2 - --ns2|--nameserver2) - shift - NAMESERVER2="$1" - ;; - -i|--interactive) - shift - INTERACTIVE="$1" - ;; - -g|--generic) - shift - GENERIC_IMAGE="$1" - ;; - --minimal) - shift - MINIMAL_INSTALL="$1" - ;; - --ssh|--sshport) - shift - SSH_PORT="$1" - ;; - -v|--variant) - shift - VARIANT="$1" - ;; - -o|--onion) - shift - ONION_ONLY="$1" - ;; - -r|--repo|--repository) - shift - PROJECT_REPO="$1" - ;; - -m|--mirror) - shift - MIRROR="$1" - ;; - --debianonly|--basic|--minimal) - shift - DEBIAN_INSTALL_ONLY="$1" - ;; - --interface|--if) + case $key in + -h|--help) + show_help + ;; + -c|--config) + shift + CONFIG_FILENAME="$1" + if [ ! -f $CONFIG_FILENAME ]; then + echo $"Config file $CONFIG_FILENAME not found" + exit 3 + fi + DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}') + ;; + -t|--target|--board) + shift + IMAGE_TYPE="$1" + ;; + -u|--user|--username) + shift + USERNAME="$1" + ;; + -p|--password) + shift + PASSWORD="$1" + if [ ${#PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then + echo $"Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters" + exit 3628 + fi + ;; + --sshkey|--sshpubkey|--pubkey) + shift + SSH_PUBKEY="$1" + ;; + -s|--size) + shift + IMAGE_SIZE="$1" + ;; + # Box static IP address on the LAN + --ip) + shift + BOX_IP_ADDRESS="$1" + ;; + # Router IP address on the LAN + --iprouter) + shift + ROUTER_IP_ADDRESS="$1" + ;; + # nameserver 1 + --ns1|--nameserver1) + shift + NAMESERVER1="$1" + ;; + # nameserver 2 + --ns2|--nameserver2) + shift + NAMESERVER2="$1" + ;; + -i|--interactive) + shift + INTERACTIVE="$1" + ;; + -g|--generic) + shift + GENERIC_IMAGE="$1" + ;; + --minimal) + shift + MINIMAL_INSTALL="$1" + ;; + --ssh|--sshport) + shift + SSH_PORT="$1" + ;; + -v|--variant) + shift + VARIANT="$1" + ;; + -o|--onion) + shift + ONION_ONLY="$1" + ;; + -r|--repo|--repository) + shift + PROJECT_REPO="$1" + ;; + -m|--mirror) + shift + MIRROR="$1" + ;; + --debianonly|--basic|--minimal) + shift + DEBIAN_INSTALL_ONLY="$1" + ;; + --interface|--if) shift WIFI_INTERFACE="$1" ;; - --ssid|--essid) + --ssid|--essid) shift WIFI_SSID="$1" ;; - --wifitype) + --wifitype) shift WIFI_TYPE="$1" ;; - --wifipass|--passphrase) + --wifipass|--passphrase) shift WIFI_PASSPHRASE="$1" ;; - --hotspot) + --hotspot) shift if [[ $"$1" == $'yes' || $"$1" == $'y' ]]; then WIFI_HOTSPOT='yes' - fi + fi ;; - --networks) + --networks) shift WIFI_NETWORKS_FILE="$1" ;; @@ -331,11 +331,15 @@ chown -R $CURR_USER:$CURR_USER $TEMPBUILD_DIR cd $TEMPBUILD_DIR if [[ $MINIMAL_INSTALL == "yes" ]]; then - IMAGE_NAME='min' + IMAGE_NAME=$'min' fi if [[ $ONION_ONLY != "no" ]]; then - IMAGE_NAME='onion' + IMAGE_NAME=$'onion' +fi + +if [[ $VARIANT == 'mesh' ]]; then + IMAGE_NAME=$'mesh' fi cd $TEMPBUILD_DIR @@ -366,7 +370,7 @@ make $IMAGE_TYPE \ WIFI_HOTSPOT="$WIFI_HOTSPOT" \ WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \ VARIANT="$VARIANT" - + if [ ! "$?" = "0" ]; then echo $'Build failed' rm -rf $TEMPBUILD_DIR