Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions deploy/auto-install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/bash

export DEBIAN_FRONTEND=noninteractive
export INSTALL_PATH=/opt/openwisp/docker-openwisp
export LOG_FILE=/opt/openwisp/autoinstall.log
export ENV_USER=/opt/openwisp/config.env
export ENV_BACKUP=/opt/openwisp/backup.env
export USER_INSTALL_PATH=/opt/openwisp
export GIT_PATH=${GIT_PATH:-https://github.com/openwisp/docker-openwisp.git}

# Terminal colors
Expand Down Expand Up @@ -72,8 +69,8 @@ setup_docker() {
if [ $? -eq 0 ]; then
report_ok
else
curl -fsSL 'https://get.docker.com' -o '/opt/openwisp/get-docker.sh' &>>$LOG_FILE
sh '/opt/openwisp/get-docker.sh' &>>$LOG_FILE
curl -fsSL 'https://get.docker.com' -o '${USER_INSTALL_PATH}/get-docker.sh' &>>$LOG_FILE
sh '${USER_INSTALL_PATH}/get-docker.sh' &>>$LOG_FILE
docker info &>/dev/null
check_status $? "Docker installation failed."
fi
Expand Down Expand Up @@ -249,15 +246,15 @@ init_setup() {
echo -e " - Supported systems"
echo -e " - Debian: 11, 12 & 13"
echo -e " - Ubuntu 22.04 & 24.04"
echo -e ${YLW}"\nYou can use -u\--upgrade if you are upgrading from an older version.\n"${NON}
echo -e ${YLW}"\nYou can use -u\--upgrade ${USER_INSTALL_PATH} if you are upgrading from an older version.\n"${NON}
fi

if [ "$EUID" -ne 0 ]; then
echo -e ${RED}"Please run with root privileges."${NON}
exit 1
fi

mkdir -p /opt/openwisp
mkdir -p ${USER_INSTALL_PATH}
echo "" >$LOG_FILE

start_step "Checking your system capabilities..."
Expand Down Expand Up @@ -297,8 +294,8 @@ init_help() {
echo -e " - Supported systems"
echo -e " - Debian: 11, 12 & 13"
echo -e " - Ubuntu 22.04 & 24.04\n"
echo -e " -i\--install : (default) Install OpenWISP"
echo -e " -u\--upgrade : Change OpenWISP version already setup with this script"
echo -e " -i\--install [install-path]: (default) Install OpenWISP. Default path is /opt/openwisp"
echo -e " -u\--upgrade [install-path]: Change OpenWISP version already setup with this script"
echo -e " -h\--help : See this help message"
echo -e ${NON}
}
Expand All @@ -311,9 +308,22 @@ while test $# != 0; do
-h | --help) action='help' ;;
*) action='help' ;;
esac
case "$1" in
-i | --install | -u | --upgrade)
if [[ -n "$2" ]]; then
USER_INSTALL_PATH=$(realpath -m "$2")
fi
shift
;;
esac
shift
done

export INSTALL_PATH=${USER_INSTALL_PATH}/docker-openwisp
export LOG_FILE=${USER_INSTALL_PATH}/autoinstall.log
export ENV_USER=${USER_INSTALL_PATH}/config.env
export ENV_BACKUP=${USER_INSTALL_PATH}/backup.env

## Init script
if [[ "$action" == "help" ]]; then
init_help
Expand Down
13 changes: 7 additions & 6 deletions docs/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,24 @@ script and execute it:
.. code-block:: bash

curl https://raw.githubusercontent.com/openwisp/docker-openwisp/master/deploy/auto-install.sh -o auto-install.sh
sudo bash auto-install.sh
sudo bash auto-install.sh [--install install-path]

The auto-install script maintains a log, which is useful for debugging or
checking the real-time output of the script. You can view the log by
running the following command:
The default installation path is ``/opt/openwisp``. The auto-install
script maintains a log, which is useful for debugging or checking the
real-time output of the script. You can view the log by running the
following command:

.. code-block:: bash

tail -n 50 -f /opt/openwisp/autoinstall.log
tail -n 50 -f <install-path>/autoinstall.log

The auto-install script can be used to upgrade installations that were
originally deployed using this script. You can upgrade your installation
by using the following command

.. code-block:: bash

sudo bash auto-install.sh --upgrade
sudo bash auto-install.sh --upgrade [install-path]

.. note::

Expand Down