Allow installing specific NDN releases through installer

Adds a flag allowing sets of NDN software release versions to
be installed via source without manually specifying
commits or tags.

Change-Id: Ia19fa9de3ac77172f705a4d475331dc9b40e9376
diff --git a/docs/install.rst b/docs/install.rst
index cd66d68..3e5040c 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -182,3 +182,29 @@
 4. Issue the command:
    ``grep -c timeout /tmp/minindn/*/ping-data/*.txt``. Each file should
    report a count of 0.
+
+
+Release Versions
+----------------
+
+We provide a set of shortcuts to install major release versions of NDN
+dependencies from source.
+
+You can install the most recent release using:
+
+::
+
+    ./install.sh --source --release=current
+
+You can also select a specified release using:
+
+::
+
+    ./install.sh --source --release=[chosen version]
+
+
+Currently, the compatible versions include:
+
+- ``2024-08``: ndn-cxx 0.9.0, NFD 24.07, NLSR 24.08, PSync 0.5.0,
+  ndn-tools 24.07, and compatible versions of ndn-traffic-generator
+  and infoedit.
\ No newline at end of file
diff --git a/install.sh b/install.sh
index 1f795de..8d4ef9a 100755
--- a/install.sh
+++ b/install.sh
@@ -72,7 +72,7 @@
 PREFER_FROM=ppa
 PPA_PKGS=()
 
-ARGS=$(getopt -o 'hy' -l 'help,dir:,jobs:,no-wifi,ppa,source,cxx:,dummy-keychain,nfd:,psync:,nlsr:,tools:,traffic:,infoedit:,mininet:,mnwifi:,dl-only,ignore-existing' -- "$@")
+ARGS=$(getopt -o 'hy' -l 'help,dir:,jobs:,no-wifi,ppa,source,release:,cxx:,dummy-keychain,nfd:,psync:,nlsr:,tools:,traffic:,infoedit:,mininet:,mnwifi:,dl-only,ignore-existing' -- "$@")
 eval set -- "$ARGS"
 while true; do
   case $1 in
@@ -83,6 +83,7 @@
     --no-wifi) NO_WIFI=1; shift;;
     --ppa) PREFER_FROM=ppa; shift;;
     --source) PREFER_FROM=source; shift;;
+    --release) RELEASE_VERSION=$2; source util/releases/current_release.sh; NO_PPA=1; shift 2;;
     --cxx) CXX_VERSION=$2; NO_PPA=1; shift 2;;
     --dummy-keychain) CXX_DUMMY_KEYCHAIN=1; NO_PPA=1; shift;;
     --nfd) NFD_VERSION=$2; NO_PPA=1; shift 2;;
@@ -130,6 +131,9 @@
       Install all packages from source code.
 
 Source code version options:
+  --release=[RELEASE]
+      Use specified major release. To install the most recent, use 'current'. A list of
+      other possible values is located in the installation docs.
   --cxx=[VERSION]
       Set ndn-cxx version.
   --dummy-keychain
diff --git a/util/releases/2024-08.sh b/util/releases/2024-08.sh
new file mode 100644
index 0000000..453fb9e
--- /dev/null
+++ b/util/releases/2024-08.sh
@@ -0,0 +1,34 @@
+# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2015-2024, 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/>.
+
+# THIS FILE IS MEANT TO PROVIDE A QUICK SHORTCUT TO INSTALLING RELEASES OF NDN DEPENDENCIES
+# RELEASED IN JULY AND AUGUST OF 2024. REPOSITORIES WHICH HAVE NOT RECEIVED A MAJOR RELEASE
+# ARE INSTEAD GIVEN FIXED COMMITS.
+
+CXX_RELEASE="ndn-cxx-0.9.0"
+NFD_RELEASE="NFD-24.07"
+PSYNC_RELEASE="0.5.0"
+NLSR_RELEASE="NLSR-24.08"
+TOOLS_RELEASE="ndn-tools-24.07"
+TRAFFIC_RELEASE="9bec15ac63ae2ac225c4e514daa9fc1366889d62"
+INFOEDIT_RELEASE="cecfe583f5d2df974f5cbd50996f91b9d321be99"
\ No newline at end of file
diff --git a/util/releases/current_release.sh b/util/releases/current_release.sh
new file mode 100644
index 0000000..3f94bc3
--- /dev/null
+++ b/util/releases/current_release.sh
@@ -0,0 +1,58 @@
+# -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2015-2024, 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/>.
+
+RELEASE_FILE="util/releases/$RELEASE_VERSION.sh"
+
+
+if [[ $RELEASE_VERSION == current ]]; then
+    # THIS SHOULD BE UPDATED ON MAJOR RELEASES
+    RELEASE_FILE="util/releases/2024-08.sh"
+fi
+
+if [[ ! -e $RELEASE_FILE ]]; then
+    cat <<EOT
+No valid release version passed as argument. Please check
+documentation and your command for typos.
+
+Valid versions:
+ - current
+ - 2024-08
+
+Exiting...
+EOT
+    exit 1
+fi
+
+source "$RELEASE_FILE"
+
+# This prevents issues when manually overriden versions
+# are specified before the release by checking if these
+# vars are already set.
+
+: ${CXX_VERSION:=${CXX_RELEASE}}
+: ${NFD_VERSION:=${NFD_RELEASE}}
+: ${PSYNC_VERSION:=${PSYNC_RELEASE}}
+: ${NLSR_VERSION:=${NLSR_RELEASE}}
+: ${TOOLS_VERSION:=${TOOLS_RELEASE}}
+: ${TRAFFIC_VERSION:=${TRAFFIC_RELEASE}}
+: ${INFOEDIT_VERSION:=${INFOEDIT_RELEASE}}
\ No newline at end of file