2015-11-20 17:09:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# .---. . .
|
|
|
|
# | | |
|
|
|
|
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
|
|
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
|
|
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
|
|
#
|
|
|
|
# Freedom in the Cloud
|
|
|
|
#
|
|
|
|
# Creates a debian image using vmdebootstrap
|
|
|
|
#
|
2016-05-28 18:38:27 +02:00
|
|
|
# To shut down after error: fuser -mvk /tmp/tmpdir/build
|
|
|
|
#
|
2015-11-20 17:09:21 +01:00
|
|
|
# License
|
|
|
|
# =======
|
|
|
|
#
|
2018-02-21 20:32:13 +01:00
|
|
|
# Copyright (C) 2015-2018 Bob Mottram <bob@freedombone.net>
|
2015-11-20 17:09:21 +01:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2016-02-13 23:09:27 +01:00
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
2015-11-20 17:09:21 +01:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2016-02-13 23:09:27 +01:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
2015-11-20 17:09:21 +01:00
|
|
|
#
|
2016-02-13 23:09:27 +01:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2015-11-20 17:09:21 +01:00
|
|
|
|
2015-11-21 12:56:40 +01:00
|
|
|
PROJECT_NAME='freedombone'
|
2015-11-27 12:42:16 +01:00
|
|
|
|
2015-11-27 17:52:23 +01:00
|
|
|
export TEXTDOMAIN=${PROJECT_NAME}-image
|
2015-11-27 12:42:16 +01:00
|
|
|
export TEXTDOMAINDIR="/usr/share/locale"
|
|
|
|
|
2016-11-06 11:32:32 +01:00
|
|
|
USERHOME=$HOME
|
|
|
|
|
2016-11-05 19:22:45 +01:00
|
|
|
PROJECT_INSTALL_DIR=/usr/local/bin
|
|
|
|
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
|
|
|
PROJECT_INSTALL_DIR=/usr/bin
|
|
|
|
fi
|
|
|
|
|
2018-03-02 20:17:02 +01:00
|
|
|
source "$PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars"
|
2016-11-05 19:22:45 +01:00
|
|
|
|
2016-10-10 15:21:08 +02:00
|
|
|
#get the project repo
|
2016-01-25 18:45:37 +01:00
|
|
|
PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
|
2018-03-02 20:17:02 +01:00
|
|
|
UTILS_FILES="/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*"
|
2016-10-10 15:21:08 +02:00
|
|
|
for f in $UTILS_FILES
|
|
|
|
do
|
2018-03-02 20:17:02 +01:00
|
|
|
source "$f"
|
2016-10-10 15:21:08 +02:00
|
|
|
done
|
|
|
|
read_config_param PROJECT_REPO
|
2016-01-25 18:45:37 +01:00
|
|
|
|
2016-01-05 15:17:49 +01:00
|
|
|
# recommended RAM for virtual machines
|
|
|
|
VM_MEMORY='1G'
|
|
|
|
|
2015-12-24 20:04:17 +01:00
|
|
|
VARIANT='full'
|
|
|
|
|
2015-11-29 14:20:26 +01:00
|
|
|
# fixed username and password when the --generic option is used
|
|
|
|
GENERIC_IMAGE_USERNAME='fbone'
|
|
|
|
GENERIC_IMAGE_PASSWORD='freedombone'
|
|
|
|
|
2015-11-20 22:43:03 +01:00
|
|
|
IMAGE_TYPE='beaglebone'
|
2015-11-20 17:09:21 +01:00
|
|
|
CURR_DIR=$(pwd)
|
2018-03-02 23:41:58 +01:00
|
|
|
CURR_USER="$USER"
|
2016-03-10 17:31:43 +01:00
|
|
|
TEMPBUILD_DIR=~/.tmp_${PROJECT_NAME}_build
|
2015-11-20 22:43:03 +01:00
|
|
|
VMDEBOOTSTRAP_REPO=git://git.liw.fi/vmdebootstrap
|
|
|
|
VMDEBOOTSTRAP_VERSION=0.8
|
2015-11-21 12:21:56 +01:00
|
|
|
MAKEFILE=${PROJECT_NAME}-image-makefile
|
2017-12-04 18:50:07 +01:00
|
|
|
IMAGE_SIZE=7.9G
|
2016-05-30 21:47:40 +02:00
|
|
|
IMAGE_SIZE_SPECIFIED=
|
2016-01-05 22:19:02 +01:00
|
|
|
IMAGE_NAME='full'
|
2015-11-20 17:09:21 +01:00
|
|
|
|
2018-03-02 23:41:58 +01:00
|
|
|
USERNAME="$USER"
|
2015-11-21 13:23:46 +01:00
|
|
|
PASSWORD=
|
2015-11-20 22:43:03 +01:00
|
|
|
|
|
|
|
# IP address of the router (gateway)
|
|
|
|
ROUTER_IP_ADDRESS="192.168.1.254"
|
|
|
|
|
|
|
|
# The fixed IP address of the Beaglebone Black (or other SBC) on your local network
|
|
|
|
BOX_IP_ADDRESS="192.168.1.55"
|
|
|
|
|
|
|
|
# DNS
|
|
|
|
NAMESERVER1='213.73.91.35'
|
|
|
|
NAMESERVER2='85.214.20.141'
|
2016-12-07 17:57:57 +01:00
|
|
|
NAMESERVER3='213.73.91.35'
|
|
|
|
NAMESERVER4='85.214.73.63'
|
2017-10-15 11:09:18 +02:00
|
|
|
NAMESERVER5='84.200.69.80'
|
|
|
|
NAMESERVER6='84.200.70.40'
|
2015-11-20 22:43:03 +01:00
|
|
|
|
2015-11-21 12:56:40 +01:00
|
|
|
# An optional freedombone configuration file
|
|
|
|
CONFIG_FILENAME=
|
|
|
|
|
2017-06-22 12:55:28 +02:00
|
|
|
DEFAULT_DOMAIN_NAME="${LOCAL_NAME}.local"
|
2015-11-21 13:23:46 +01:00
|
|
|
|
2015-11-21 15:11:34 +01:00
|
|
|
# Minimum number of characters in a password
|
2018-03-02 20:17:02 +01:00
|
|
|
MINIMUM_PASSWORD_LENGTH=$(grep 'MINIMUM_PASSWORD_LENGTH=' "/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords" | head -n 1 | awk -F '=' '{print $2}')
|
2015-11-21 15:11:34 +01:00
|
|
|
|
2015-11-21 15:33:39 +01:00
|
|
|
# Optional ssh public key to allow
|
|
|
|
SSH_PUBKEY="no"
|
|
|
|
|
2015-11-21 16:44:59 +01:00
|
|
|
# interactive mode
|
|
|
|
INTERACTIVE="no"
|
|
|
|
|
2015-11-23 11:33:45 +01:00
|
|
|
# Whether this is a generic image for mass redistribution on the interwebs
|
2015-11-30 18:15:17 +01:00
|
|
|
GENERIC_IMAGE="yes"
|
2015-11-23 11:33:45 +01:00
|
|
|
|
2015-11-30 15:25:09 +01:00
|
|
|
# Whether to reduce the number of decisions during interactive install
|
|
|
|
MINIMAL_INSTALL="yes"
|
|
|
|
|
2015-12-04 13:09:07 +01:00
|
|
|
# default SSH port
|
|
|
|
SSH_PORT=2222
|
|
|
|
|
2015-12-31 13:00:55 +01:00
|
|
|
# Whether sites are accessible only within a Tor browser
|
|
|
|
ONION_ONLY="no"
|
|
|
|
|
2016-01-28 12:25:45 +01:00
|
|
|
# Where to fetch packages
|
2016-03-29 14:54:47 +02:00
|
|
|
#MIRROR='http://httpredir.debian.org/debian'
|
|
|
|
MIRROR='http://ftp.de.debian.org/debian'
|
2016-01-28 12:25:45 +01:00
|
|
|
|
2016-03-30 11:35:07 +02:00
|
|
|
# Whether to only install debian but nothing else
|
|
|
|
DEBIAN_INSTALL_ONLY='no'
|
|
|
|
|
2016-04-26 16:41:35 +02:00
|
|
|
# wifi settings
|
|
|
|
WIFI_INTERFACE='wlan0'
|
|
|
|
WIFI_SSID=
|
2016-05-13 19:19:34 +02:00
|
|
|
WIFI_TYPE='wpa2-psk'
|
2016-04-26 16:41:35 +02:00
|
|
|
WIFI_PASSPHRASE=
|
|
|
|
WIFI_HOTSPOT='no'
|
2016-04-26 23:38:03 +02:00
|
|
|
WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
|
2016-04-26 16:41:35 +02:00
|
|
|
|
2016-06-23 12:04:04 +02:00
|
|
|
# Whether to install non-free wifi drivers for the mesh client
|
|
|
|
INSECURE='no'
|
|
|
|
|
2016-07-22 14:15:18 +02:00
|
|
|
# for mesh installs whether to delete all data and generate
|
|
|
|
# a new identity at every shutdown/boot
|
|
|
|
AMNESIC='no'
|
|
|
|
|
2017-06-16 16:39:48 +02:00
|
|
|
# Is this a dedicated gnusocial or postactiv instance?
|
|
|
|
SOCIALINSTANCE=
|
|
|
|
|
2016-09-22 17:52:07 +02:00
|
|
|
# Versions used for Arch/Parabola setup
|
|
|
|
MBR_VERSION='1.1.11'
|
|
|
|
|
2016-11-06 11:32:32 +01:00
|
|
|
# version of cliapp to use with parabola
|
|
|
|
CLIAPP_COMMIT='cb17626e6441a5bf43a1d3f17a769f8e44ff4977'
|
|
|
|
|
|
|
|
# version of mbr to use with parabola
|
|
|
|
MBR_COMMIT='fb7ac88f251a1529b8aa759abc49acb2e99094b2'
|
|
|
|
|
|
|
|
# defining repo variables here ensures that they will be mirrored
|
|
|
|
MULTIPATH_TOOLS_REPO="https://aur.archlinux.org/multipath-tools.git"
|
|
|
|
MBR_REPO="https://aur.archlinux.org/mbr.git"
|
|
|
|
CLIAPP_REPO="git://git.liw.fi/cliapp"
|
|
|
|
|
2016-09-22 17:52:07 +02:00
|
|
|
function image_setup {
|
|
|
|
setup_type=$1
|
|
|
|
|
|
|
|
case $setup_type in
|
|
|
|
debian|ubuntu|trisquel|mint)
|
2017-12-26 11:52:41 +01:00
|
|
|
sudo apt-get -yq remove vmdebootstrap
|
2018-01-16 12:15:53 +01:00
|
|
|
sudo apt-get -yq install build-essential gcc-multilib g++-multilib libc6-dev
|
|
|
|
sudo apt-get -yq install libc6-dev-i386
|
2017-12-26 11:52:41 +01:00
|
|
|
sudo apt-get -yq install git python-docutils mktorrent xz-utils debootstrap
|
2016-10-23 20:38:14 +02:00
|
|
|
sudo apt-get -yq install dosfstools btrfs-tools extlinux python-distro-info mbr
|
|
|
|
sudo apt-get -yq install qemu-user-static binfmt-support u-boot-tools qemu
|
2018-01-31 21:31:37 +01:00
|
|
|
sudo apt-get -yq install python-cliapp kpartx
|
2018-01-31 21:26:23 +01:00
|
|
|
sudo cp /sbin/install-mbr /usr/bin/install-mbr
|
2016-09-22 17:52:07 +02:00
|
|
|
;;
|
|
|
|
parabola|arch)
|
|
|
|
sudo pacman -S --noconfirm libc++ git gcc gcc-libs python-docutils mktorrent patch
|
|
|
|
sudo pacman -S --noconfirm debootstrap xz dosfstools btrfs-progs syslinux python-pip
|
|
|
|
sudo pacman -S --noconfirm qemu-static binfmt-qemu-static uboot-tools qemu parted
|
2016-09-23 00:49:07 +02:00
|
|
|
sudo pacman -S --noconfirm dpkg-devtools bin86 arch-install-scripts qemu-arch-extra
|
2016-09-25 13:17:35 +02:00
|
|
|
sudo pacman -S --noconfirm syncthing
|
2018-03-02 20:17:02 +01:00
|
|
|
mkdir "$USERHOME/develop"
|
|
|
|
if [ -d "$USERHOME/develop/python-cliapp" ]; then
|
|
|
|
sudo rm -rf "$USERHOME/develop/python-cliapp"
|
2016-11-06 11:32:32 +01:00
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if ! git_clone "$CLIAPP_REPO" "$USERHOME/develop/python-cliapp"; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Failed to clone python-cliapp"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -d "$USERHOME/develop/python-cliapp" ]; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Couldn't clone python-cliapp"
|
|
|
|
return
|
2016-09-22 17:52:07 +02:00
|
|
|
fi
|
|
|
|
sudo pacman -S --noconfirm python2-coverage python2-pytest-cov python2-sphinx
|
|
|
|
sudo pacman -S --noconfirm autopep8 python2-pylint python2-yaml python2-xdg python2-pip
|
2018-03-02 20:17:02 +01:00
|
|
|
cd "$USERHOME/develop/python-cliapp" || exit 7824526242
|
2016-11-06 11:32:32 +01:00
|
|
|
git checkout $CLIAPP_COMMIT -b $CLIAPP_COMMIT
|
2016-09-22 17:52:07 +02:00
|
|
|
sudo python2 setup.py install
|
|
|
|
sudo pip2 install distro-info logging
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ -d "$USERHOME/develop/mbr" ]; then
|
|
|
|
sudo rm -rf "$USERHOME/develop/mbr"
|
2016-11-06 11:32:32 +01:00
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if ! git_clone $MBR_REPO "$USERHOME/develop/mbr"; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Failed to clone mbr"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -d "$USERHOME/develop/mbr" ]; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Couldn't clone mbr"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
cd "$USERHOME/develop/mbr" || exit 2468724524
|
2016-11-06 11:32:32 +01:00
|
|
|
git checkout $MBR_COMMIT -b $MBR_COMMIT
|
|
|
|
makepkg --force --noconfirm
|
|
|
|
if [ ! -f mbr-${MBR_VERSION}.tar.gz ]; then
|
|
|
|
echo $"mbr tarball was not found for version ${MBR_VERSION}"
|
|
|
|
return
|
2016-09-22 17:52:07 +02:00
|
|
|
fi
|
|
|
|
tar -xzvf mbr-${MBR_VERSION}.tar.gz
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -d "$USERHOME/develop/mbr/mbr-${MBR_VERSION}" ]; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"mbr tarball could not be extracted"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
cd "$USERHOME/develop/mbr/mbr-${MBR_VERSION}" || exit 13584584
|
2016-09-22 17:52:07 +02:00
|
|
|
cp ../*.patch .
|
|
|
|
patch -p0 < *.patch
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
if [ ! -f /usr/local/sbin/install-mbr ]; then
|
|
|
|
echo $'Failed to install mbr'
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sudo cp /usr/local/sbin/install-mbr /sbin
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ -d "$USERHOME/develop/multipath-tools" ]; then
|
|
|
|
sudo rm -rf "$USERHOME/develop/multipath-tools"
|
2016-11-06 11:32:32 +01:00
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if ! git_clone "$MULTIPATH_TOOLS_REPO" "$USERHOME/develop/multipath-tools"; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Failed to clone multipath-tools"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -d "$USERHOME/develop/multipath-tools" ]; then
|
2016-11-06 11:32:32 +01:00
|
|
|
echo $"Couldn't clone multipath-tools"
|
|
|
|
return
|
2016-09-22 17:52:07 +02:00
|
|
|
fi
|
2016-09-25 13:10:49 +02:00
|
|
|
sudo pacman -S --noconfirm device-mapper libaio liburcu fakeroot
|
2018-03-02 20:17:02 +01:00
|
|
|
cd "$USERHOME/develop/multipath-tools" || exit 27462454
|
2016-11-05 19:22:45 +01:00
|
|
|
makepkg --force --noconfirm
|
|
|
|
makepkg -i --force --noconfirm
|
2018-03-02 20:17:02 +01:00
|
|
|
sudo wget "https://raw.githubusercontent.com/bashrc/freedombone/master/image_build/debootstrap/scripts/${DEBIAN_VERSION}" -O /usr/share/debootstrap/scripts/debscript
|
|
|
|
sudo cp -f "/usr/share/debootstrap/scripts/debscript /usr/share/debootstrap/scripts/${DEBIAN_VERSION}"
|
|
|
|
if [ ! -f "/usr/share/debootstrap/scripts/${DEBIAN_VERSION}" ]; then
|
2016-11-05 20:22:43 +01:00
|
|
|
echo $"No debian debootstrap script was found for $DEBIAN_VERSION"
|
2016-11-05 20:20:26 +01:00
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
debian_script_hash=$(sha256sum "/usr/share/debootstrap/scripts/${DEBIAN_VERSION}" | awk -F ' ' '{print $1}')
|
2018-01-16 11:03:23 +01:00
|
|
|
expected_debian_script_hash='620fa84c7ef64d10349aed38fa9cc2e7f00a6fcd1bc425f33ca2b57cc946fd0c'
|
2016-11-06 11:32:32 +01:00
|
|
|
if [[ "$debian_script_hash" != "$expected_debian_script_hash" ]]; then
|
|
|
|
echo $"Invalid hash for debootstrap ${DEBIAN_VERSION} script"
|
|
|
|
return
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
sudo chmod +x "/usr/share/debootstrap/scripts/${DEBIAN_VERSION}"
|
2016-09-22 17:52:07 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $'Unkown operating system'
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo $'Setup complete'
|
|
|
|
}
|
|
|
|
|
|
|
|
function mesh_router_setup_script {
|
2016-08-15 10:30:34 +02:00
|
|
|
# create a setup script for a mesh router
|
|
|
|
mesh_script_filename=$1
|
2018-03-02 20:17:02 +01:00
|
|
|
{ echo "MY_USERNAME=${USERNAME}";
|
|
|
|
echo "DEFAULT_DOMAIN_NAME=${USERNAME}";
|
|
|
|
echo 'SYSTEM_TYPE=mesh';
|
|
|
|
echo 'INSTALLING_ON_BBB=no';
|
|
|
|
echo 'USB_DRIVE=/dev/sda1';
|
|
|
|
echo 'DDNS_PROVIDER=';
|
|
|
|
echo 'DDNS_USERNAME=';
|
|
|
|
echo 'DDNS_PASSWORD=';
|
|
|
|
echo 'DEFAULT_LANGUAGE=en_GB.UTF-8';
|
|
|
|
echo 'MY_EMAIL_ADDRESS=';
|
|
|
|
echo 'ENABLE_BATMAN=yes';
|
|
|
|
echo 'DEBIAN_REPO=';
|
|
|
|
echo 'NAMESERVER1=';
|
|
|
|
echo 'NAMESERVER2=';
|
|
|
|
echo 'NAMESERVER3=';
|
|
|
|
echo 'NAMESERVER4=';
|
|
|
|
echo 'NAMESERVER5=';
|
|
|
|
echo 'NAMESERVER6=';
|
|
|
|
echo 'BATMAN_CELLID=any';
|
|
|
|
echo 'WIFI_CHANNEL=9'; } > "$mesh_script_filename"
|
2015-12-24 20:04:17 +01:00
|
|
|
}
|
|
|
|
|
2018-02-25 12:04:13 +01:00
|
|
|
while [ $# -gt 1 ]
|
2015-11-20 22:43:03 +01:00
|
|
|
do
|
2016-08-15 10:30:34 +02:00
|
|
|
key="$1"
|
|
|
|
|
|
|
|
case $key in
|
|
|
|
-h|--help)
|
|
|
|
show_help
|
|
|
|
;;
|
|
|
|
-c|--config)
|
|
|
|
shift
|
|
|
|
CONFIG_FILENAME="$1"
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -f "$CONFIG_FILENAME" ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $"Config file $CONFIG_FILENAME not found"
|
|
|
|
exit 3
|
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
DEFAULT_DOMAIN_NAME=$(grep 'DEFAULT_DOMAIN_NAME' "$CONFIG_FILENAME" | awk -F '=' '{print $2}')
|
2016-08-15 10:30:34 +02:00
|
|
|
;;
|
|
|
|
-t|--target|--board)
|
|
|
|
shift
|
|
|
|
IMAGE_TYPE="$1"
|
|
|
|
;;
|
|
|
|
-u|--user|--username)
|
|
|
|
shift
|
|
|
|
USERNAME="$1"
|
|
|
|
;;
|
|
|
|
-p|--password)
|
|
|
|
shift
|
|
|
|
PASSWORD="$1"
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ${#PASSWORD} -lt "$MINIMUM_PASSWORD_LENGTH" ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
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"
|
|
|
|
IMAGE_SIZE_SPECIFIED=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"
|
|
|
|
;;
|
2016-12-07 17:57:57 +01:00
|
|
|
# nameserver 3
|
|
|
|
--ns3|--nameserver3)
|
|
|
|
shift
|
|
|
|
NAMESERVER2="$1"
|
|
|
|
;;
|
|
|
|
# nameserver 4
|
|
|
|
--ns4|--nameserver4)
|
|
|
|
shift
|
|
|
|
NAMESERVER4="$1"
|
|
|
|
;;
|
|
|
|
# nameserver 5
|
|
|
|
--ns5|--nameserver5)
|
|
|
|
shift
|
|
|
|
NAMESERVER5="$1"
|
|
|
|
;;
|
|
|
|
# nameserver 6
|
|
|
|
--ns6|--nameserver6)
|
|
|
|
shift
|
|
|
|
NAMESERVER6="$1"
|
|
|
|
;;
|
2016-08-15 10:30:34 +02:00
|
|
|
-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"
|
|
|
|
;;
|
2017-09-12 10:49:47 +02:00
|
|
|
-o|--onion|--onion-addresses|--onion-addresses-only)
|
2016-08-15 10:30:34 +02:00
|
|
|
shift
|
|
|
|
ONION_ONLY="$1"
|
|
|
|
;;
|
|
|
|
-a|--amnesic)
|
|
|
|
shift
|
|
|
|
AMNESIC="$1"
|
|
|
|
;;
|
|
|
|
-r|--repo|--repository)
|
|
|
|
shift
|
|
|
|
PROJECT_REPO="$1"
|
|
|
|
;;
|
2017-06-16 16:39:48 +02:00
|
|
|
--social|--instance)
|
|
|
|
shift
|
|
|
|
SOCIALINSTANCE="$1"
|
|
|
|
;;
|
2016-08-15 10:30:34 +02:00
|
|
|
-m|--mirror)
|
|
|
|
shift
|
|
|
|
MIRROR="$1"
|
|
|
|
;;
|
2018-03-02 20:17:02 +01:00
|
|
|
--debianonly|--basic)
|
2016-08-15 10:30:34 +02:00
|
|
|
shift
|
|
|
|
DEBIAN_INSTALL_ONLY="$1"
|
|
|
|
;;
|
|
|
|
--interface|--if)
|
|
|
|
shift
|
|
|
|
WIFI_INTERFACE="$1"
|
|
|
|
;;
|
|
|
|
--ssid|--essid)
|
|
|
|
shift
|
|
|
|
WIFI_SSID="$1"
|
|
|
|
;;
|
|
|
|
--wifitype)
|
|
|
|
shift
|
|
|
|
WIFI_TYPE="$1"
|
|
|
|
;;
|
|
|
|
--wifipass|--passphrase)
|
|
|
|
shift
|
|
|
|
WIFI_PASSPHRASE="$1"
|
|
|
|
;;
|
|
|
|
--hotspot)
|
|
|
|
shift
|
|
|
|
if [[ $"$1" == $'yes' || $"$1" == $'y' ]]; then
|
|
|
|
WIFI_HOTSPOT='yes'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--networks)
|
|
|
|
shift
|
|
|
|
WIFI_NETWORKS_FILE="$1"
|
|
|
|
;;
|
|
|
|
--insecure)
|
|
|
|
shift
|
|
|
|
INSECURE="$1"
|
|
|
|
;;
|
2016-09-22 17:52:07 +02:00
|
|
|
--setup)
|
|
|
|
shift
|
|
|
|
image_setup "$1"
|
|
|
|
exit 0
|
|
|
|
;;
|
2017-06-22 13:34:07 +02:00
|
|
|
--local|--localname)
|
|
|
|
shift
|
|
|
|
LOCAL_NAME="$1"
|
|
|
|
;;
|
2016-08-15 10:30:34 +02:00
|
|
|
*)
|
|
|
|
# unknown option
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
2015-11-20 22:43:03 +01:00
|
|
|
done
|
|
|
|
|
2015-11-21 16:44:59 +01:00
|
|
|
if [[ $INTERACTIVE == "yes" || $INTERACTIVE == "y" || $INTERACTIVE == "Yes" ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
${PROJECT_NAME}-config --minimal "$MINIMAL_INSTALL"
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ -f "$HOME/${PROJECT_NAME}.cfg" ]; then
|
2016-10-09 21:18:04 +02:00
|
|
|
CONFIG_FILENAME=$HOME/${PROJECT_NAME}.cfg
|
2018-03-02 20:17:02 +01:00
|
|
|
DEFAULT_DOMAIN_NAME=$(grep 'DEFAULT_DOMAIN_NAME' "$CONFIG_FILENAME" | awk -F '=' '{print $2}')
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2015-11-21 16:44:59 +01:00
|
|
|
fi
|
|
|
|
|
2015-11-29 14:20:26 +01:00
|
|
|
if [[ $GENERIC_IMAGE == "yes" ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
USERNAME=$GENERIC_IMAGE_USERNAME
|
|
|
|
PASSWORD=$GENERIC_IMAGE_PASSWORD
|
2015-11-29 14:20:26 +01:00
|
|
|
fi
|
|
|
|
|
2015-11-21 13:23:46 +01:00
|
|
|
if [ ! $PASSWORD ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
# generate a random password
|
2018-03-02 20:17:02 +01:00
|
|
|
PASSWORD=$(openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c "${MINIMUM_PASSWORD_LENGTH}")
|
2015-11-21 13:23:46 +01:00
|
|
|
fi
|
2015-11-20 22:43:03 +01:00
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
# Move any existing images into a build subdirectory
|
2016-01-14 12:07:40 +01:00
|
|
|
image_types=( xz img sig vdi qcow2 )
|
2015-12-01 15:13:23 +01:00
|
|
|
for im in "${image_types[@]}"
|
|
|
|
do
|
2018-03-02 20:17:02 +01:00
|
|
|
# shellcheck disable=SC2012,SC2086
|
2016-08-15 10:30:34 +02:00
|
|
|
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
|
|
|
if (( no_of_files > 0 )); then
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ ! -d "${CURR_DIR}/build" ]; then
|
|
|
|
mkdir "${CURR_DIR}/build"
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2018-03-02 20:17:02 +01:00
|
|
|
mv -f "${CURR_DIR}/${PROJECT_NAME}*.${im}" "${CURR_DIR}/build"
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2016-03-10 17:31:43 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# Delete anything which didn't move
|
|
|
|
for im in "${image_types[@]}"
|
|
|
|
do
|
2018-03-02 20:17:02 +01:00
|
|
|
# shellcheck disable=SC2012,SC2086
|
2016-08-15 10:30:34 +02:00
|
|
|
no_of_files=$(ls -afq ${CURR_DIR}/${PROJECT_NAME}*.${im} | wc -l)
|
|
|
|
if (( no_of_files > 0 )); then
|
2018-03-02 20:17:02 +01:00
|
|
|
rm -f "${CURR_DIR}/${PROJECT_NAME}*.${im}"
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2015-12-01 15:13:23 +01:00
|
|
|
done
|
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
# Remove any existing login credentials file
|
2018-03-02 20:17:02 +01:00
|
|
|
if [ -f "${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt" ]; then
|
|
|
|
rm "${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt"
|
2015-11-24 10:17:05 +01:00
|
|
|
fi
|
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
if [ -d $TEMPBUILD_DIR ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
rm -rf $TEMPBUILD_DIR
|
2015-11-20 17:09:21 +01:00
|
|
|
fi
|
2016-03-10 17:31:43 +01:00
|
|
|
mkdir -p $TEMPBUILD_DIR
|
2015-11-20 22:43:03 +01:00
|
|
|
if [ -f /usr/local/bin/$MAKEFILE ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
cp /usr/local/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
2015-11-20 17:09:21 +01:00
|
|
|
else
|
2016-08-15 10:30:34 +02:00
|
|
|
cp /usr/bin/$MAKEFILE $TEMPBUILD_DIR/Makefile
|
2015-11-20 17:09:21 +01:00
|
|
|
fi
|
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
cp -r /etc/${PROJECT_NAME}/* $TEMPBUILD_DIR
|
|
|
|
rm -rf $TEMPBUILD_DIR/vendor
|
2018-03-02 20:17:02 +01:00
|
|
|
chown -R "$CURR_USER":"$CURR_USER" $TEMPBUILD_DIR
|
|
|
|
cd $TEMPBUILD_DIR || exit 24729847
|
2015-11-20 17:09:21 +01:00
|
|
|
|
2016-01-05 15:54:32 +01:00
|
|
|
if [[ $MINIMAL_INSTALL == "yes" ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME=$'min'
|
2016-01-05 15:54:32 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $ONION_ONLY != "no" ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME=$'onion'
|
2016-05-28 18:52:13 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $VARIANT == 'mesh' ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME=$'mesh'
|
|
|
|
# typically not much disk space is needed for a mesh node
|
|
|
|
if [ ! $IMAGE_SIZE_SPECIFIED ]; then
|
2017-10-30 15:24:50 +01:00
|
|
|
IMAGE_SIZE=5G
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2016-01-05 15:54:32 +01:00
|
|
|
fi
|
|
|
|
|
2016-06-26 12:29:48 +02:00
|
|
|
if [[ $VARIANT == 'meshclient' || $VARIANT == 'meshusb' ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME=$'meshclient'
|
2016-08-31 15:25:29 +02:00
|
|
|
if [[ $INSECURE != 'no' ]]; then
|
|
|
|
IMAGE_NAME=$'meshclient-insecure'
|
|
|
|
fi
|
|
|
|
|
2016-08-15 10:30:34 +02:00
|
|
|
if [ ! $IMAGE_SIZE_SPECIFIED ]; then
|
2018-01-18 19:12:28 +01:00
|
|
|
IMAGE_SIZE=15.0G
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2016-06-26 12:29:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $VARIANT == 'usb' ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME=$'usb'
|
2016-06-26 12:29:48 +02:00
|
|
|
fi
|
|
|
|
|
2016-07-22 22:47:47 +02:00
|
|
|
# append amnesic to the image name if needed
|
|
|
|
if [[ $AMNESIC != 'no' ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
IMAGE_NAME="${IMAGE_NAME}-amnesic"
|
2016-07-22 22:47:47 +02:00
|
|
|
fi
|
|
|
|
|
2017-06-16 16:39:48 +02:00
|
|
|
if [[ "$SOCIALINSTANCE" == "gnusocial" || "$SOCIALINSTANCE" == "postactiv" ]]; then
|
|
|
|
IMAGE_NAME="${IMAGE_NAME}-${SOCIALINSTANCE}"
|
|
|
|
fi
|
|
|
|
|
2018-03-02 20:17:02 +01:00
|
|
|
cd $TEMPBUILD_DIR || exit 724245267
|
|
|
|
make "$IMAGE_TYPE" \
|
2016-08-15 10:30:34 +02:00
|
|
|
MYUSERNAME="$USERNAME" \
|
|
|
|
MYPASSWORD="$PASSWORD" \
|
|
|
|
ROUTER_IP_ADDRESS="$ROUTER_IP_ADDRESS" \
|
|
|
|
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
|
|
|
|
NAMESERVER1="$NAMESERVER1" \
|
|
|
|
NAMESERVER2="$NAMESERVER2" \
|
2016-12-07 17:57:57 +01:00
|
|
|
NAMESERVER3="$NAMESERVER3" \
|
|
|
|
NAMESERVER4="$NAMESERVER4" \
|
|
|
|
NAMESERVER5="$NAMESERVER5" \
|
|
|
|
NAMESERVER6="$NAMESERVER6" \
|
2016-08-15 10:30:34 +02:00
|
|
|
PROJECT_NAME="$PROJECT_NAME" \
|
|
|
|
CONFIG_FILENAME="$CONFIG_FILENAME" \
|
|
|
|
IMAGE_SIZE="$IMAGE_SIZE" \
|
|
|
|
SSH_PUBKEY="$SSH_PUBKEY" \
|
|
|
|
GENERIC_IMAGE="$GENERIC_IMAGE" \
|
|
|
|
MINIMAL_INSTALL="$MINIMAL_INSTALL" \
|
|
|
|
SSH_PORT="$SSH_PORT" \
|
|
|
|
ONION_ONLY="$ONION_ONLY" \
|
|
|
|
IMAGE_NAME="$IMAGE_NAME" \
|
|
|
|
PROJECT_REPO="$PROJECT_REPO" \
|
|
|
|
MIRROR="$MIRROR" \
|
|
|
|
BUILD_MIRROR="$MIRROR" \
|
|
|
|
DEBIAN_INSTALL_ONLY="$DEBIAN_INSTALL_ONLY" \
|
|
|
|
WIFI_INTERFACE="$WIFI_INTERFACE" \
|
|
|
|
WIFI_SSID="$WIFI_SSID" \
|
|
|
|
WIFI_TYPE="$WIFI_TYPE" \
|
|
|
|
WIFI_PASSPHRASE="$WIFI_PASSPHRASE" \
|
|
|
|
WIFI_HOTSPOT="$WIFI_HOTSPOT" \
|
|
|
|
WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE" \
|
|
|
|
VARIANT="$VARIANT" \
|
|
|
|
MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
|
|
|
|
INSECURE="$INSECURE" \
|
2017-06-16 16:39:48 +02:00
|
|
|
AMNESIC="$AMNESIC" \
|
2017-06-22 13:34:07 +02:00
|
|
|
SOCIALINSTANCE="$SOCIALINSTANCE" \
|
|
|
|
LOCAL_NAME="$LOCAL_NAME"
|
2016-05-28 18:52:13 +02:00
|
|
|
|
2018-03-02 20:17:02 +01:00
|
|
|
# shellcheck disable=SC2181
|
2015-11-24 10:37:53 +01:00
|
|
|
if [ ! "$?" = "0" ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $'Build failed'
|
|
|
|
rm -rf $TEMPBUILD_DIR
|
|
|
|
exit 1
|
2015-11-24 10:37:53 +01:00
|
|
|
fi
|
|
|
|
|
2016-01-17 23:08:54 +01:00
|
|
|
EXPECTED_EXTENSION='xz'
|
2015-11-24 10:17:05 +01:00
|
|
|
if [[ $IMAGE_TYPE == "qemu"* ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
EXPECTED_EXTENSION='qcow2'
|
2015-11-24 10:17:05 +01:00
|
|
|
fi
|
|
|
|
|
2015-11-21 11:29:10 +01:00
|
|
|
shopt -s nullglob
|
2018-03-02 20:17:02 +01:00
|
|
|
imgfiles=("build/${PROJECT_NAME}*.${EXPECTED_EXTENSION}")
|
2015-11-21 11:29:10 +01:00
|
|
|
if [ ${#imgfiles[@]} -eq 0 ]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $'Image was not created'
|
|
|
|
rm -rf $TEMPBUILD_DIR
|
|
|
|
exit 2
|
2015-11-21 11:29:10 +01:00
|
|
|
fi
|
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
# Move images from temporary directory to the current directory
|
2015-12-01 15:13:23 +01:00
|
|
|
for im in "${image_types[@]}"
|
|
|
|
do
|
2018-03-02 20:17:02 +01:00
|
|
|
# shellcheck disable=SC2012,SC2086
|
2016-08-15 10:30:34 +02:00
|
|
|
no_of_files=$(ls -afq build/${PROJECT_NAME}*.${im} | wc -l)
|
|
|
|
if (( no_of_files > 0 )); then
|
2018-03-02 20:17:02 +01:00
|
|
|
mv "build/${PROJECT_NAME}*.${im}" "${CURR_DIR}/"
|
|
|
|
sudo chown "${CURR_USER}":"${CURR_USER}" "${CURR_DIR}/*.${im}"
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
2015-12-01 15:13:23 +01:00
|
|
|
done
|
2015-12-01 13:31:49 +01:00
|
|
|
|
2016-03-10 17:31:43 +01:00
|
|
|
# Remove the temporary directory
|
|
|
|
rm -rf ${TEMPBUILD_DIR}
|
2015-11-21 21:41:58 +01:00
|
|
|
|
2018-03-02 20:17:02 +01:00
|
|
|
cd "${CURR_DIR}" || exit 2842845284
|
2015-11-20 17:09:21 +01:00
|
|
|
|
2015-11-21 11:29:10 +01:00
|
|
|
clear
|
2016-07-30 15:29:25 +02:00
|
|
|
if [[ $VARIANT != 'meshclient' && $VARIANT != 'meshusb' && $VARIANT != 'mesh' ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $"
|
2015-11-21 13:23:46 +01:00
|
|
|
Image was created.
|
|
|
|
|
|
|
|
You will be able to log into it with:
|
2015-11-25 15:04:48 +01:00
|
|
|
"
|
2016-10-14 17:13:58 +02:00
|
|
|
if [[ $IMAGE_TYPE != "qemu"* ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $" ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT
|
2015-11-21 13:23:46 +01:00
|
|
|
|
2016-04-26 16:41:35 +02:00
|
|
|
Password: $PASSWORD
|
2015-11-21 13:23:46 +01:00
|
|
|
"
|
2016-08-15 10:30:34 +02:00
|
|
|
else
|
|
|
|
if [[ $IMAGE_TYPE != "qemu"* ]]; then
|
|
|
|
echo $" Username: $USERNAME
|
2016-04-26 16:41:35 +02:00
|
|
|
Password: $PASSWORD
|
2015-11-25 15:04:48 +01:00
|
|
|
"
|
2016-08-15 10:30:34 +02:00
|
|
|
else
|
|
|
|
if [[ $IMAGE_TYPE != "qemu-x86_64"* && $IMAGE_TYPE != "qemu-amd64"* ]]; then
|
|
|
|
echo "qemu-system-i386 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
|
|
|
else
|
|
|
|
echo "qemu-system-x86_64 -m ${VM_MEMORY} $(ls ${PROJECT_NAME}*.qcow2)"
|
|
|
|
fi
|
|
|
|
echo $"
|
2016-04-26 16:41:35 +02:00
|
|
|
Username: $USERNAME
|
|
|
|
Password: $PASSWORD
|
2015-11-25 15:04:48 +01:00
|
|
|
"
|
2016-08-15 10:30:34 +02:00
|
|
|
fi
|
|
|
|
fi
|
2016-07-30 15:29:25 +02:00
|
|
|
else
|
2016-08-15 10:30:34 +02:00
|
|
|
echo $"
|
2016-07-30 15:29:25 +02:00
|
|
|
Image was created.
|
|
|
|
"
|
2015-11-25 15:04:48 +01:00
|
|
|
fi
|
2016-07-30 15:29:25 +02:00
|
|
|
|
2016-01-14 12:07:40 +01:00
|
|
|
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.xz ${PROJECT_NAME}*.vdi ${PROJECT_NAME}*.qcow2
|
2015-11-21 11:29:10 +01:00
|
|
|
|
2015-12-24 20:04:17 +01:00
|
|
|
# Remove the mesh script after use
|
|
|
|
if [[ $VARIANT == "mesh"* ]]; then
|
2018-03-02 20:17:02 +01:00
|
|
|
rm -f "$CONFIG_FILENAME"
|
2015-12-24 20:04:17 +01:00
|
|
|
fi
|
|
|
|
|
2015-11-21 13:23:46 +01:00
|
|
|
# record the default login credentials for later use
|
2015-11-27 16:29:43 +01:00
|
|
|
echo $"Username: $USERNAME
|
2018-03-02 20:17:02 +01:00
|
|
|
Password: $PASSWORD" > "${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt"
|
|
|
|
chmod 600 "${CURR_DIR}/${PROJECT_NAME}_login_credentials.txt"
|
2015-11-21 13:23:46 +01:00
|
|
|
|
2016-10-14 17:13:58 +02:00
|
|
|
if [[ $IMAGE_TYPE != "qemu"* ]]; then
|
2016-08-15 10:30:34 +02:00
|
|
|
echo ''
|
|
|
|
if [[ $VARIANT != 'meshclient' && $VARIANT != 'meshusb' ]]; then
|
|
|
|
echo $'You can copy the image to a microSD card with:'
|
|
|
|
else
|
|
|
|
echo $'You can copy the image to a USB drive with:'
|
|
|
|
fi
|
|
|
|
echo ''
|
|
|
|
echo " unxz -k ${PROJECT_NAME}*.img.xz"
|
2017-09-15 23:15:40 +02:00
|
|
|
echo ' sudo dd if=/dev/zero of=/dev/sdX bs=1M count=8'
|
2016-08-15 10:30:34 +02:00
|
|
|
echo " sudo dd bs=1M if=${PROJECT_NAME}*.img of=/dev/sdX conv=fdatasync"
|
|
|
|
echo ''
|
2015-11-25 12:43:57 +01:00
|
|
|
fi
|
|
|
|
|
2015-11-20 17:09:21 +01:00
|
|
|
exit 0
|