install.sh: quiet apt install for Vagrant

Vagrant VM provisioning doesn't have any mechanism for user interaction.
For this reason, it is necessary to tell APT that we are in a
non-interactive session and any install question should be answered
automatically by its preset.

For this reason, according to issue #42 and GitHub PR #43, I propose to
add "quiet" option to install.sh. This option tells Debian-based systems
to run APT in non-interactive mode. In case of important questions
during install, we can update the preset list specified in quiet_install
subroutine.

Flag functionality can always be extended in the future to support
unexpected cases where Vagrant provision hangs due to user interaction
request by some other program.

Change-Id: Iab3ce5f9b19cd6bfcf2fa180c433fb5d5d521914
diff --git a/Vagrantfile b/Vagrantfile
index f3bb364..7095c07 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -13,7 +13,7 @@
   git clone --depth 1 https://github.com/named-data/mini-ndn.git
   pushd mini-ndn
 fi
-./install.sh -a
+./install.sh -qa
 
 SCRIPT
 
diff --git a/docs/install.rst b/docs/install.rst
index 391fdfa..9073622 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -67,6 +67,15 @@
 
     ./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.
 
 Installing Dependencies
diff --git a/install.sh b/install.sh
index 8a4f903..35071b1 100755
--- a/install.sh
+++ b/install.sh
@@ -109,6 +109,16 @@
     fi
 }
 
+function quiet_install {
+    if [[ $DIST == Ubuntu || $DIST == Debian ]]; then
+        update='sudo DEBIAN_FRONTEND=noninteractive apt-get update'
+        install='sudo DEBIAN_FRONTEND=noninteractive apt-get -y install'
+        remove='sudo DEBIAN_FRONTEND=noninteractive apt-get -y remove'
+
+        echo "wireshark-common wireshark-common/install-setuid boolean false" | sudo debconf-set-selections
+    fi
+}
+
 function ndn_install {
     mkdir -p $NDN_SRC
     name=$1
@@ -344,13 +354,14 @@
     printf -- ' -m: install mininet and dependencies\n' >&2
     printf -- ' -n: install NDN dependencies of mini-ndn including infoedit\n' >&2
     printf -- ' -p: patch ndn-cxx with dummy key chain\n' >&2
+    printf -- ' -q: quiet install (must be specified first)\n' >&2
     exit 2
 }
 
 if [[ $# -eq 0 ]]; then
     usage
 else
-    while getopts 'acdhimnp' OPTION
+    while getopts 'acdhimnpq' OPTION
     do
         case $OPTION in
         a)
@@ -367,6 +378,7 @@
         m)    mininet;;
         n)    ndn;;
         p)    patchDummy;;
+        q)    quiet_install;;
         ?)    usage;;
         esac
     done