install: fix git error and support Ubuntu 22.04
refs #5204
Change-Id: Ic6e2ce789746a18cdb8b97e5a4e8175a89ad2e8d
diff --git a/docs/install.rst b/docs/install.rst
index 1697699..cd66d68 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -7,6 +7,7 @@
Mini-NDN is tested on the following Linux distributions:
- Ubuntu 20.04 (recommended)
+- Ubuntu 22.04
- Debian 11 (WiFi scenario does not work)
- Fedora 33 (WiFi scenario does not work)
diff --git a/util/pkgdep/common.sh b/util/pkgdep/common.sh
index 9105fa2..60749ef 100644
--- a/util/pkgdep/common.sh
+++ b/util/pkgdep/common.sh
@@ -1,6 +1,6 @@
# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2015-2021, The University of Memphis,
+# Copyright (C) 2015-2022, The University of Memphis,
# Arizona Board of Regents,
# Regents of the University of California.
#
@@ -21,7 +21,7 @@
# along with Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.
-# needed by Python version detection logic in Mininet & Mininet-WiFi install script
+# needed by Python version detection logic in Mininet install script
export PYTHON=python3
# DEP_INFO key should match *_VERSION variable name.
@@ -75,15 +75,28 @@
$SUDO cp /usr/local/bin/mn /usr/local/bin/mn.mininet
}
build_MNWIFI() {
+ # issue: git repository is not owned by root, causing "unsafe repository" error
+ # workaround: chown the git repository to root
+ $SUDO chown -R 0:0 .
+
# issue: util/install.sh attempts to patch hostap every time, causing "Assume -R?" prompt
# during reinstalls
- # workaround: revert hostap repository to clean state
+ # workaround: revert hostap submodule to clean state
$SUDO git -C hostap clean -fdx || true
$SUDO git -C hostap checkout -- . || true
- # issue: util/install.sh is not using 'sudo' where needed
- # solution: run whole script in 'sudo'
- $SUDO env PYTHON="$PYTHON" ./util/install.sh -Wl
+ # issue: util/install.sh is not setting noninteractive mode for apt-get
+ # workaround: temporarily disable needrestart
+ if [[ -d /etc/needrestart/conf.d ]]; then
+ $SUDO tee /etc/needrestart/conf.d/99-disabled-by-minindn.conf > /dev/null <<'EOT'
+$nrconf{restart} = 'l';
+$nrconf{kernelhints} = 0;
+EOT
+ fi
+
+ # issue: util/install.sh is not using 'sudo' where needed such as 'make install'
+ # workaround: run whole script in 'sudo'
+ $SUDO env PYTHON=$PYTHON ./util/install.sh -Wl
# issue: setup.py reports "Cannot load backend 'TkAgg' which requires the 'tk' interactive
# framework, as 'headless' is currently running" when running over SSH
@@ -95,6 +108,14 @@
if [[ -x /usr/local/bin/mn.mininet ]]; then
$SUDO cp /usr/local/bin/mn.mininet /usr/local/bin/mn
fi
+
+ # chown the git repository to current user, so that user can modify code without root
+ if [[ $(id -u) -ne 0 ]]; then
+ $SUDO chown -R $(id -u):$(id -g) .
+ fi
+
+ # re-enable needrestart
+ $SUDO rm -f /etc/needrestart/conf.d/99-disabled-by-minindn.conf
}
# Waf configure options
diff --git a/util/pkgdep/fedora.sh b/util/pkgdep/fedora.sh
index b48dac2..a6876e8 100644
--- a/util/pkgdep/fedora.sh
+++ b/util/pkgdep/fedora.sh
@@ -1,6 +1,6 @@
# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2015-2021, The University of Memphis,
+# Copyright (C) 2015-2022, The University of Memphis,
# Arizona Board of Regents,
# Regents of the University of California.
#
@@ -45,7 +45,7 @@
}
prepare_ld() {
- if ! $SUDO ldconfig -v 2>/dev/null | grep -q /usr/local/lib64; then
+ if ! $SUDO ldconfig -v 2>/dev/null | grep -q /usr/local/lib64; then
echo 'Enabling /usr/local/lib64 in dynamic linker'
$SUDO mkdir -p /etc/ld.so.conf.d
echo /usr/local/lib64 | $SUDO tee /etc/ld.so.conf.d/usr-local-lib64.conf >/dev/null
diff --git a/util/pkgdep/ubuntu.sh b/util/pkgdep/ubuntu.sh
index 91abc29..456ce40 100644
--- a/util/pkgdep/ubuntu.sh
+++ b/util/pkgdep/ubuntu.sh
@@ -1,6 +1,6 @@
# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
-# Copyright (C) 2015-2021, The University of Memphis,
+# Copyright (C) 2015-2022, The University of Memphis,
# Arizona Board of Regents,
# Regents of the University of California.
#
@@ -30,8 +30,16 @@
source "$PKGDEPDIR/debian-like.sh"
-APT_PKGS+=(
- libigraph0-dev
-)
+if [[ $VERSION_ID == '20.04' ]]; then
+ APT_PKGS+=(
+ libigraph0-dev
+ )
+else
+ APT_PKGS+=(
+ libigraph-dev
+ )
+fi
-PPA_AVAIL=1
+if [[ $VERSION_ID == '20.04' ]] || [[ $VERSION_ID == '21.10' ]]; then
+ PPA_AVAIL=1
+fi