install: rewrite install script

* set dependency versions: PPA, git repository & commit
* separate download and build+install steps
* don't reinstall package if it's already installed

refs #4630

Change-Id: I966fac5e1633cbabf78ce20cd151a35618efc345
diff --git a/docs/build.sh b/docs/build.sh
new file mode 100755
index 0000000..1b1594a
--- /dev/null
+++ b/docs/build.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2015-2021, The University of Memphis,
+#                          Arizona Board of Regents,
+#                          Regents of the University of California.
+#
+# This file is part of Mini-NDN.
+# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
+#
+# Mini-NDN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Mini-NDN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mini-NDN, e.g., in COPYING.md file.
+# If not, see <http://www.gnu.org/licenses/>.
+
+set -eo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+PIP='python3 -m pip'
+
+for PIPPKG in sphinx sphinx_rtd_theme; do
+  if ! $PIP show $PIPPKG >/dev/null; then
+    sudo $PIP install $PIPPKG
+  fi
+done
+
+make clean html
diff --git a/docs/install.rst b/docs/install.rst
index 9073622..40da6b3 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -4,11 +4,13 @@
 Prerequisites
 -------------
 
-For this guide, you will need a laptop/desktop with a recent version of
-a Linux distro that is supported by Mininet. For this guide, the *Ubuntu 18.04 LTS* release was used.
-Some tweaks maybe required to Mini-NDN's install.sh file for other distros.
-Note that you'll need administrative privileges in order to download and install
-extra packages and also to execute **Mini-NDN**.
+Mini-NDN is tested on the following Linux distributions:
+
+- Ubuntu 20.04 (recommended)
+- Debian 11 (WiFi scenario does not work)
+- Fedora 33 (WiFi scenario does not work)
+
+You must have sudo privileges to install and run Mini-NDN.
 
 Using Vagrantfile
 -----------------
@@ -21,66 +23,56 @@
 Using install.sh
 ----------------
 
-Mini-NDN depends on Mininet and NDN software to be installed in the system.
-If you have all the dependencies (see sections below) **installed in the system** simply
-clone this repository and run:
+Mini-NDN has the following dependencies:
+
+- `NDN Forwarding Daemon (NFD) <https://named-data.net/doc/NFD/>`_
+- `Named Data Link State Routing (NLSR) <https://named-data.net/doc/NLSR/>`_
+- `NDN Essential Tools (ndn-tools) <https://github.com/named-data/ndn-tools>`_
+- `NDN Traffic Generator <https://github.com/named-data/ndn-traffic-generator>`_
+- `infoedit <https://github.com/NDN-Routing/infoedit>`_
+- `Mininet <http://mininet.org/>`_
+- `Mininet-WiFi <https://mininet-wifi.github.io/>`_ (optional)
+
+To install Mini-NDN and its dependencies, clone this repository and run:
 
 ::
 
-    ./install.sh -i
+    ./install.sh
 
-The ``-i`` option uses ``setup.py develop`` to point the system install
-to the current directory. So any changes made to the cloned ``mini-ndn``
-folder will be used without having to install it again to the system.
-If you do not need to modify the core of Mini-NDN, then setup.py install (or pip install .)
-can be used directly. See :doc:`experiment <experiment>` for more information on running.
+The script accepts various command line flags.
+Some notable flags are:
 
-If you don't have the dependencies, the following command will
-install them from source along with Mini-NDN. The dependencies include
-Mininet, NDN core (ndn-cxx, NFD, Chronosync, PSync, NLSR), Infoedit,
-and NDN Common Client Libraries (CCL). If you do not wish to install
-the master versions of the NDN core or want to switch to specific versions,
-you can edit the install.sh with release tags/specific versions.
+- ``-y`` skips interactive confirmation before installation.
+- ``--ppa`` prefers installing NDN software from `named-data PPA <https://launchpad.net/~named-data/+archive/ubuntu/ppa>`_.
+  This shortens installation time by downloading binary packages, but is only available on Ubuntu.
+- ``--source`` prefers installing NDN software from source code.
+- ``--dummy-keychain`` patches ndn-cxx to use an in-memory dummy KeyChain, which reduces CPU overhead
+  and allows you to scale up Mini-NDN experiments. Large Mini-NDN experiments would run significantly
+  faster after applying this patch. However, your experiments cannot use any NDN security related
+  features (signatures, verifier, access control, etc).
+- ``--no-wifi`` skips Mininet-WiFi dependency.
+  Currently Mininet-WiFi only works on Ubuntu, so that you must specify this option when installing on other distros.
 
-.. _scaling-note:
-.. important::
-    If you wish to scale Mini-NDN experiments and do not have use for security extensions
-    in your emulations, you should apply the ndn-cxx patch given in the ``patches`` folder
-    using ``./install.sh -p`` before running the following commands. The ndn-cxx patch is
-    taken from ndnSIM which provides an in-memory dummy KeyChain to reduce CPU computations.
-    After these patches are applied sleep time after NFD, nfdc, NLSR, etc. is not required
-    making the startup **MUCH** faster and scaling of Mini-NDN **MUCH** better.
+You can see all command line flags by running:
 
 ::
 
-    ./install.sh -a
+    ./install.sh -h
 
-This pulls the NDN software from Github to ``ndn-src`` folder under the project.
+The script uses ``setup.py develop`` to point the system install of Python packages to the codebase
+directory. Therefore, you can modify ``mininet``, ``mininet-wifi``, and ``mini-ndn``, and the
+changes will be reflected immediately.
 
-.. note::
-    If any changes are made to ``ndn-src`` folder, please don't forgot to re-install
-    the sources to the system.
-
-To install without CCL, use:
-
-::
-
-    ./install.sh -mni
-
-To install in "quiet" mode (without user interaction), use:
-
-::
-    ./install.sh -qa
-
-.. note::
-    The order of the flag -q is important to ensure that the environment is ready for
-    a quiet install.
-
-See ``install.sh -h`` for detailed options.
+If NDN software is installed from source code (not PPA), the code is downloaded to ``dl`` directory
+under your ``mini-ndn`` clone. If you modify the source code, you need to manually recompile and
+reinstall the software (``./waf && sudo ./waf install``).
 
 Installing Dependencies
 -----------------------
 
+This section outlines how to install dependnecies manually.
+If you used ``install.sh``, you do not need to perform these steps.
+
 Mininet
 _______