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
This commit is contained in:
Giovanni Grieco committed 2020-03-24 12:18:22 +01:00
1 parent 1f1de1f87b
commit bb31ed2fcd
3 files changed
+23 -2

No files matched your search

Vendored
+1 -1
View File
@@ -13,7 +13,7 @@ else
git clone --depth 1 https://github.com/named-data/mini-ndn.git
pushd mini-ndn
fi
./install.sh -a
./install.sh -qa
SCRIPT
+9
View File
@@ -67,6 +67,15 @@ 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.
Installing Dependencies
+13 -1
View File
@@ -109,6 +109,16 @@ function patchDummy {
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 @@ function usage {
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 @@ else
m) mininet;;
n) ndn;;
p) patchDummy;;
q) quiet_install;;
?) usage;;
esac
done