added install.sh options for dev install
This commit is contained in:
parent
ace15636ac
commit
0d0862d29c
1 changed files with 72 additions and 29 deletions
101
install.sh
101
install.sh
|
@ -4,52 +4,95 @@
|
|||
set -e
|
||||
|
||||
function install_python_depencencies() {
|
||||
sudo python3 -m pip install -r daemon/requirements.txt
|
||||
sudo python3 -m pip install -r daemon/requirements.txt
|
||||
}
|
||||
|
||||
function install_python_dev_dependencies() {
|
||||
sudp pip install pipenv grpcio-tools
|
||||
}
|
||||
|
||||
function install_ospf_mdr() {
|
||||
git clone https://github.com/USNavalResearchLaboratory/ospf-mdr /tmp/ospf-mdr
|
||||
cd /tmp/ospf-mdr
|
||||
./bootstrap.sh
|
||||
./configure --disable-doc --enable-user=root --enable-group=root --with-cflags=-ggdb \
|
||||
--sysconfdir=/usr/local/etc/quagga --enable-vtysh \
|
||||
--localstatedir=/var/run/quagga
|
||||
make -j8
|
||||
sudo make install
|
||||
cd -
|
||||
rm -rf /tmp/ospf-mdr
|
||||
git clone https://github.com/USNavalResearchLaboratory/ospf-mdr /tmp/ospf-mdr
|
||||
cd /tmp/ospf-mdr
|
||||
./bootstrap.sh
|
||||
./configure --disable-doc --enable-user=root --enable-group=root --with-cflags=-ggdb \
|
||||
--sysconfdir=/usr/local/etc/quagga --enable-vtysh \
|
||||
--localstatedir=/var/run/quagga
|
||||
make -j8
|
||||
sudo make install
|
||||
cd -
|
||||
}
|
||||
|
||||
function build_core() {
|
||||
./bootstrap.sh
|
||||
./configure $1
|
||||
make -j8
|
||||
}
|
||||
|
||||
function install_core() {
|
||||
./bootstrap.sh
|
||||
./configure $1
|
||||
make -j8
|
||||
sudo make install
|
||||
sudo make install
|
||||
}
|
||||
|
||||
function install_dev_core() {
|
||||
cd daemon
|
||||
pipenv install --dev
|
||||
}
|
||||
|
||||
# detect os/ver for install type
|
||||
os=""
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
. /etc/os-release
|
||||
os=${NAME}
|
||||
. /etc/os-release
|
||||
os=${ID}
|
||||
fi
|
||||
|
||||
# parse arguments
|
||||
while getopts ":d" opt; do
|
||||
case ${opt} in
|
||||
d)
|
||||
dev=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid Option: $OPTARG" 1>&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# check install was found
|
||||
case ${os} in
|
||||
"Ubuntu")
|
||||
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk \
|
||||
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
|
||||
"ubuntu")
|
||||
echo "Installing CORE for Ubuntu"
|
||||
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables gawk iproute2 \
|
||||
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
|
||||
install_ospf_mdr
|
||||
if [[ -z ${dev} ]]; then
|
||||
echo "normal install"
|
||||
install_python_depencencies
|
||||
install_ospf_mdr
|
||||
build_core
|
||||
install_core
|
||||
;;
|
||||
"CentOS Linux")
|
||||
sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel bridge-utils iptables-ebtables gawk \
|
||||
python36 python36-devel python3-pip python3-tkinter tk ethtool libtool readline-devel autoconf
|
||||
else
|
||||
echo "dev install"
|
||||
install_python_dev_dependencies
|
||||
build_core
|
||||
install_dev_core
|
||||
fi
|
||||
;;
|
||||
"centos")
|
||||
sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ libev-devel bridge-utils iptables-ebtables iproute \
|
||||
python36 python36-devel python3-pip python3-tkinter tk ethtool libtool readline-devel autoconf gawk
|
||||
install_ospf_mdr
|
||||
if [[ -z ${dev} ]]; then
|
||||
install_python_depencencies
|
||||
install_ospf_mdr
|
||||
install_core --prefix=/usr
|
||||
;;
|
||||
build_core --prefix=/usr
|
||||
install_core
|
||||
else
|
||||
install_python_dev_dependencies
|
||||
build_core --prefix=/usr
|
||||
install_dev_core
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "unknown os ${os} cannot install"
|
||||
;;
|
||||
echo "unknown OS ID ${os} cannot install"
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue