ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Vince Lehman | b8b1806 | 2015-07-14 13:07:22 -0500 | [diff] [blame] | 2 | # -*- Mode:bash; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 3 | # |
Ashlesh Gawande | f5f304b | 2016-06-16 16:42:41 -0500 | [diff] [blame] | 4 | # Copyright (C) 2015-2017, The University of Memphis, |
Ashlesh Gawande | 0cccdb8 | 2016-08-15 12:58:06 -0500 | [diff] [blame] | 5 | # Arizona Board of Regents, |
| 6 | # Regents of the University of California. |
Vince Lehman | b8b1806 | 2015-07-14 13:07:22 -0500 | [diff] [blame] | 7 | # |
| 8 | # This file is part of Mini-NDN. |
| 9 | # See AUTHORS.md for a complete list of Mini-NDN authors and contributors. |
| 10 | # |
| 11 | # Mini-NDN is free software: you can redistribute it and/or modify |
| 12 | # it under the terms of the GNU General Public License as published by |
| 13 | # the Free Software Foundation, either version 3 of the License, or |
| 14 | # (at your option) any later version. |
| 15 | # |
| 16 | # Mini-NDN is distributed in the hope that it will be useful, |
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | # GNU General Public License for more details. |
| 20 | # |
| 21 | # You should have received a copy of the GNU General Public License |
| 22 | # along with Mini-NDN, e.g., in COPYING.md file. |
| 23 | # If not, see <http://www.gnu.org/licenses/>. |
| 24 | # |
| 25 | # This file incorporates work covered by the following copyright and |
| 26 | # permission notice: |
| 27 | # |
Ashlesh Gawande | f5f304b | 2016-06-16 16:42:41 -0500 | [diff] [blame] | 28 | # Mininet 2.3.0d1 License |
Vince Lehman | b8b1806 | 2015-07-14 13:07:22 -0500 | [diff] [blame] | 29 | # |
Ashlesh Gawande | f5f304b | 2016-06-16 16:42:41 -0500 | [diff] [blame] | 30 | # Copyright (c) 2013-2016 Open Networking Laboratory |
Vince Lehman | b8b1806 | 2015-07-14 13:07:22 -0500 | [diff] [blame] | 31 | # Copyright (c) 2009-2012 Bob Lantz and The Board of Trustees of |
| 32 | # The Leland Stanford Junior University |
| 33 | # |
| 34 | # Original authors: Bob Lantz and Brandon Heller |
| 35 | # |
| 36 | # We are making Mininet available for public use and benefit with the |
| 37 | # expectation that others will use, modify and enhance the Software and |
| 38 | # contribute those enhancements back to the community. However, since we |
| 39 | # would like to make the Software available for broadest use, with as few |
| 40 | # restrictions as possible permission is hereby granted, free of charge, to |
| 41 | # any person obtaining a copy of this Software to deal in the Software |
| 42 | # under the copyrights without restriction, including without limitation |
| 43 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 44 | # and/or sell copies of the Software, and to permit persons to whom the |
| 45 | # Software is furnished to do so, subject to the following conditions: |
| 46 | # |
| 47 | # The above copyright notice and this permission notice shall be included |
| 48 | # in all copies or substantial portions of the Software. |
| 49 | # |
| 50 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 51 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 52 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 53 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 54 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 55 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 56 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 57 | # |
| 58 | # The name and trademarks of copyright holder(s) may NOT be used in |
| 59 | # advertising or publicity pertaining to the Software or any derivatives |
| 60 | # without specific, written prior permission. |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 61 | |
| 62 | test -e /etc/debian_version && DIST="Debian" |
| 63 | grep Ubuntu /etc/lsb-release &> /dev/null && DIST="Ubuntu" |
| 64 | |
| 65 | if [[ $DIST == Ubuntu || $DIST == Debian ]]; then |
| 66 | update='sudo apt-get update' |
| 67 | install='sudo apt-get -y install' |
| 68 | remove='sudo apt-get -y remove' |
| 69 | pkginst='sudo dpkg -i' |
| 70 | # Prereqs for this script |
| 71 | if ! which lsb_release &> /dev/null; then |
| 72 | $install lsb-release |
| 73 | fi |
| 74 | fi |
| 75 | |
| 76 | test -e /etc/fedora-release && DIST="Fedora" |
| 77 | if [[ $DIST == Fedora ]]; then |
| 78 | update='sudo yum update' |
| 79 | install='sudo yum -y install' |
| 80 | remove='sudo yum -y erase' |
| 81 | pkginst='sudo rpm -ivh' |
| 82 | # Prereqs for this script |
| 83 | if ! which lsb_release &> /dev/null; then |
| 84 | $install redhat-lsb-core |
| 85 | fi |
| 86 | fi |
| 87 | |
| 88 | function forwarder { |
| 89 | if [[ $cxx != true ]]; then |
| 90 | ndncxx |
| 91 | cxx="true" |
| 92 | fi |
| 93 | |
| 94 | if [[ $DIST == Ubuntu || $DIST == Debian ]]; then |
| 95 | $install libpcap-dev pkg-config |
| 96 | fi |
| 97 | |
| 98 | if [[ $DIST == Fedora ]]; then |
| 99 | $install libpcap-devel |
| 100 | fi |
| 101 | |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 102 | git clone https://github.com/named-data/NFD |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 103 | cd NFD |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 104 | current=$(git rev-parse HEAD) |
| 105 | if [[ $current != "f4056d0242536f85b7d7b4de1b5ac50dad65c233" ]]; then |
| 106 | git checkout f4056d0242536f85b7d7b4de1b5ac50dad65c233 |
| 107 | git checkout -b fix-commit |
| 108 | fi |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 109 | ./waf configure --without-websocket |
| 110 | ./waf |
| 111 | sudo ./waf install |
| 112 | cd ../ |
| 113 | } |
| 114 | |
| 115 | function routing { |
| 116 | if [[ $cxx != true ]]; then |
| 117 | ndncxx |
| 118 | cxx="true" |
| 119 | fi |
| 120 | |
| 121 | if [[ $DIST == Ubuntu ]]; then |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 122 | $install liblog4cxx10-dev |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 123 | fi |
| 124 | |
| 125 | if [[ $DIST == Fedora ]]; then |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 126 | $install log4cxx log4cxx-devel openssl-devel |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 127 | fi |
| 128 | |
Ashlesh Gawande | 02852a0 | 2017-07-28 20:42:28 -0500 | [diff] [blame] | 129 | git clone https://github.com/named-data/ChronoSync |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 130 | cd ChronoSync |
Ashlesh Gawande | 02852a0 | 2017-07-28 20:42:28 -0500 | [diff] [blame] | 131 | current=$(git rev-parse HEAD) |
| 132 | if [[ $current != "097bb448f46b8bd9a5c1f431e824f8f6a169b650" ]]; then |
| 133 | git checkout 097bb448f46b8bd9a5c1f431e824f8f6a169b650 |
| 134 | git checkout -b fix-commit |
| 135 | fi |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 136 | ./waf configure |
| 137 | ./waf |
| 138 | sudo ./waf install |
dmcoomes | 9850d65 | 2017-09-28 16:43:23 -0500 | [diff] [blame] | 139 | sudo ldconfig |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 140 | cd ../ |
| 141 | |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 142 | git clone --depth 1 https://github.com/named-data/NLSR |
| 143 | cd NLSR |
| 144 | ./waf configure |
| 145 | ./waf |
| 146 | sudo ./waf install |
| 147 | cd ../ |
| 148 | } |
| 149 | |
| 150 | function ndncxx { |
| 151 | if [[ updated != true ]]; then |
| 152 | $update |
| 153 | updated="true" |
| 154 | fi |
| 155 | |
| 156 | if [[ $DIST == Ubuntu || $DIST == Debian ]]; then |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 157 | $install git libsqlite3-dev libboost-all-dev make g++ libssl-dev libcrypto++-dev |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 158 | fi |
| 159 | |
| 160 | if [[ $DIST == Fedora ]]; then |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 161 | $install gcc-c++ sqlite-devel boost-devel openssl-devel cryptopp-devel |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 162 | fi |
| 163 | |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 164 | git clone https://github.com/named-data/ndn-cxx |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 165 | cd ndn-cxx |
Ashlesh Gawande | ec08483 | 2017-06-23 17:47:25 -0500 | [diff] [blame] | 166 | current=$(git rev-parse HEAD) |
| 167 | if [[ $current != "b555b00c280b9c9ed46f24a1fbebc73b720601af" ]]; then |
| 168 | git checkout b555b00c280b9c9ed46f24a1fbebc73b720601af |
| 169 | git checkout -b fix-commit |
| 170 | fi |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 171 | ./waf configure |
| 172 | ./waf |
| 173 | sudo ./waf install |
Vince Lehman | 68b0815 | 2015-10-23 10:15:36 -0500 | [diff] [blame] | 174 | sudo ldconfig |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 175 | cd ../ |
| 176 | } |
| 177 | |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 178 | function tools { |
| 179 | if [[ $cxx != true ]]; then |
| 180 | ndncxx |
| 181 | cxx="true" |
| 182 | fi |
| 183 | |
| 184 | git clone --depth 1 https://github.com/named-data/ndn-tools |
| 185 | cd ndn-tools |
Ashlesh Gawande | 02852a0 | 2017-07-28 20:42:28 -0500 | [diff] [blame] | 186 | ./waf configure --enable-dump --enable-ping |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 187 | ./waf |
| 188 | sudo ./waf install |
| 189 | cd ../ |
| 190 | } |
| 191 | |
| 192 | function mininet { |
| 193 | if [[ updated != true ]]; then |
| 194 | $update |
| 195 | updated="true" |
| 196 | fi |
| 197 | |
| 198 | if [[ $pysetup != true ]]; then |
| 199 | pysetup="true" |
| 200 | fi |
| 201 | |
| 202 | git clone --depth 1 https://github.com/mininet/mininet |
| 203 | cd mininet |
| 204 | sudo ./util/install.sh -fnv |
| 205 | cd ../ |
| 206 | } |
| 207 | |
Saurab Dulal | 5d9ba60 | 2017-11-29 21:31:13 +0000 | [diff] [blame^] | 208 | function infoedit { |
| 209 | git clone --depth 1 https://github.com/NDN-Routing/infoedit.git |
| 210 | cd infoedit |
| 211 | sudo make install |
| 212 | cd ../ |
| 213 | } |
| 214 | |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 215 | function minindn { |
| 216 | if [[ updated != true ]]; then |
Ashlesh Gawande | 52e47e1 | 2016-08-09 16:30:42 -0500 | [diff] [blame] | 217 | if [ ! -d "build" ]; then |
| 218 | $update |
| 219 | updated="true" |
| 220 | fi |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 221 | fi |
| 222 | |
| 223 | if [[ $pysetup != true ]]; then |
| 224 | $install python-setuptools |
| 225 | pysetup="true" |
| 226 | fi |
Ashlesh Gawande | 20f7076 | 2015-06-17 15:18:19 -0500 | [diff] [blame] | 227 | install_dir="/usr/local/etc/mini-ndn/" |
| 228 | |
| 229 | sudo mkdir -p "$install_dir" |
Ashlesh Gawande | 20f7076 | 2015-06-17 15:18:19 -0500 | [diff] [blame] | 230 | sudo cp ndn_utils/topologies/default-topology.conf "$install_dir" |
Ashlesh Gawande | 5f47020 | 2017-02-25 12:02:53 -0600 | [diff] [blame] | 231 | sudo cp ndn_utils/topologies/minindn.caida.conf "$install_dir" |
| 232 | sudo cp ndn_utils/topologies/minindn.ucla.conf "$install_dir" |
Ashlesh Gawande | 20f7076 | 2015-06-17 15:18:19 -0500 | [diff] [blame] | 233 | sudo cp ndn_utils/topologies/minindn.testbed.conf "$install_dir" |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 234 | sudo python setup.py clean --all install |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 235 | } |
| 236 | |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 237 | function usage { |
| 238 | printf '\nUsage: %s [-mfrti]\n\n' $(basename $0) >&2 |
| 239 | |
| 240 | printf 'options:\n' >&2 |
Saurab Dulal | 5d9ba60 | 2017-11-29 21:31:13 +0000 | [diff] [blame^] | 241 | printf -- ' -e: install infoedit\n' >&2 |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 242 | printf -- ' -f: install NFD\n' >&2 |
| 243 | printf -- ' -i: install mini-ndn\n' >&2 |
| 244 | printf -- ' -m: install mininet and dependencies\n' >&2 |
| 245 | printf -- ' -r: install NLSR\n' >&2 |
| 246 | printf -- ' -t: install tools\n' >&2 |
| 247 | exit 2 |
| 248 | } |
| 249 | |
| 250 | if [[ $# -eq 0 ]]; then |
| 251 | usage |
| 252 | else |
Saurab Dulal | 5d9ba60 | 2017-11-29 21:31:13 +0000 | [diff] [blame^] | 253 | while getopts 'emfrti' OPTION |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 254 | do |
| 255 | case $OPTION in |
Saurab Dulal | 5d9ba60 | 2017-11-29 21:31:13 +0000 | [diff] [blame^] | 256 | e) infoedit;; |
ashu | 2ad32e2 | 2015-05-29 13:37:40 -0500 | [diff] [blame] | 257 | f) forwarder;; |
| 258 | i) minindn;; |
| 259 | m) mininet;; |
| 260 | r) routing;; |
| 261 | t) tools;; |
| 262 | ?) usage;; |
| 263 | esac |
| 264 | done |
| 265 | shift $(($OPTIND - 1)) |
| 266 | fi |