From 24b7389c2165e1d8da7c113e7b6ae1f8bb4cee05 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Wed, 16 Apr 2014 13:37:53 +0000
Subject: [PATCH] required packages

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5250 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../PROJECTS/GENERIC-LTE-EPC/start_enb.bash   | 62 +++++++++++++----
 .../PROJECTS/GENERIC-LTE-EPC/start_epc.bash   | 66 ++++++++++++++-----
 targets/PROJECTS/GENERIC-LTE-EPC/utils.bash   | 33 +++-------
 3 files changed, 107 insertions(+), 54 deletions(-)

diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash
index f6d52173f5..10b22c088c 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash
@@ -93,7 +93,7 @@
 ###########################################################
 # Parameters
 ###########################################################
-declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1 ASN_DEBUG=1 EMIT_ASN_DEBUG=1"
+declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1 ASN_DEBUG=1 EMIT_ASN_DEBUG=1"
 declare MAKE_IP_DRIVER_TARGET="ue_ip.ko"
 declare IP_DRIVER_NAME="ue_ip"
 declare LTEIF="oip1"
@@ -101,7 +101,7 @@ declare UE_IPv4="10.0.0.8"
 declare UE_IPv6="2001:1::8"
 declare UE_IPv6_CIDR=$UE_IPv6"/64"
 declare UE_IPv4_CIDR=$UE_IPv4"/24"
-
+PACKAGE_LIST=
 
 ###########################################################
 THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
@@ -119,16 +119,54 @@ else
 fi
 
 
-test_command_install_package "tshark"   "tshark" "--force-yes"
-test_command_install_package "gccxml"   "gccxml" "--force-yes"
-test_command_install_package "vconfig"  "vlan"
-test_command_install_package "iptables" "iptables"
-test_command_install_package "iperf"    "iperf"
-test_command_install_package "ip"       "iproute"
-#test_command_install_script  "ovs-vsctl" "$OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash"
-test_command_install_package "tunctl"  "uml-utilities"
-#test_command_install_lib     "/usr/lib/libconfig.so"  "libconfig-dev"
-
+test_install_package libxml2
+test_install_package libxml2-dev
+test_install_package libforms-bin
+test_install_package libforms-dev
+test_install_package openssl
+test_install_package libatlas-base-dev
+test_install_package libatlas-dev
+test_install_package autoconf
+test_install_package automake
+test_install_package gawk
+test_install_package cmake
+test_install_package make
+test_install_package gcc
+test_install_package flex
+test_install_package bison
+test_install_package libsctp1
+test_install_package libsctp-dev
+test_install_package libidn2-0-dev
+test_install_package libidn11-dev
+test_install_package libmysqlclient-dev
+test_install_package libxml2-dev
+test_install_package swig
+test_install_package python-dev
+test_install_package cmake-curses-gui
+test_install_package valgrind
+test_install_package guile-2.0-dev
+test_install_package libgmp-dev
+test_install_package libgcrypt11-dev
+test_install_package gdb 
+test_install_package unzip
+test_install_package libtasn1-3-dev
+test_install_package g++
+test_install_package linux-headers-`uname -r`
+test_install_package build-essential
+test_install_package libblas
+test_install_package libblas-dev
+test_install_package libgtk-3-dev
+test_install_package tshark
+test_install_package gccxml
+test_install_package vlan
+test_install_package iptables
+test_install_package iperf
+test_install_package iproute
+test_install_package uml-utilities
+test_install_package libconfig-dev
+test_install_package libsctp-dev
+test_install_package libsctp1
+test_install_package libpthread-stubs0-dev
 
 test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash"
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
index c94af52aa9..436390d1c4 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
@@ -112,24 +112,54 @@ else
 fi
 
 
-test_command_install_package "tshark"   "tshark" "--force-yes"
-test_command_install_package "gccxml"   "gccxml" "--force-yes"
-test_command_install_package "gcc"      "gcc"      "--force-yes"
-test_command_install_package "g++"      "g++"      "--force-yes"
-test_command_install_package "automake" "automake" "--force-yes"
-test_command_install_package "vconfig"  "vlan" "--force-yes"
-test_command_install_package "iptables" "iptables"
-test_command_install_package "iperf"    "iperf" "--force-yes"
-test_command_install_package "ip"       "iproute"
-test_command_install_script   "ovs-vsctl" "$OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash"
-test_command_install_package  "tunctl"  "uml-utilities"
-test_command_install_package "bison"    "bison"     "--force-yes"
-test_command_install_package "flex"     "flex"      "--force-yes"
-test_command_install_package "libtool"  "libtool"   "--force-yes"
-#test_command_install_lib     "/usr/lib/libconfig.so"      "libconfig-dev"  "--force-yes"
-#test_command_install_lib     "/usr/lib/libsctp-dev.so"    "libsctp-dev"    "--force-yes"
-#test_command_install_lib     "/usr/lib/libsctp.so"        "libsctp1"       "--force-yes"
-#test_command_install_lib     "/usr/lib/libpthread-stubs0-dev.so" "libpthread-stubs0-dev"    "--force-yes"
+test_install_package libxml2
+test_install_package libxml2-dev
+test_install_package libforms-bin
+test_install_package libforms-dev
+test_install_package openssl
+test_install_package libatlas-base-dev
+test_install_package libatlas-dev
+test_install_package autoconf
+test_install_package automake
+test_install_package gawk
+test_install_package cmake
+test_install_package make
+test_install_package gcc
+test_install_package flex
+test_install_package bison
+test_install_package libsctp1
+test_install_package libsctp-dev
+test_install_package libidn2-0-dev
+test_install_package libidn11-dev
+test_install_package libmysqlclient-dev
+test_install_package libxml2-dev
+test_install_package swig
+test_install_package python-dev
+test_install_package cmake-curses-gui
+test_install_package valgrind
+test_install_package guile-2.0-dev
+test_install_package libgmp-dev
+test_install_package libgcrypt11-dev
+test_install_package gdb 
+test_install_package unzip
+test_install_package libtasn1-3-dev
+test_install_package g++
+test_install_package linux-headers-`uname -r`
+test_install_package build-essential
+test_install_package libblas
+test_install_package libblas-dev
+test_install_package libgtk-3-dev
+test_install_package tshark
+test_install_package gccxml
+test_install_package vlan
+test_install_package iptables
+test_install_package iperf
+test_install_package iproute
+test_install_package uml-utilities
+test_install_package libconfig-dev
+test_install_package libsctp-dev
+test_install_package libsctp1
+test_install_package libpthread-stubs0-dev
 if [ ! -d /usr/local/etc/freeDiameter ]
     then
         # This script make certificates also
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash b/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
index 97e3c64d0b..151c715b64 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
@@ -302,31 +302,16 @@ assert() {
 }
 
 
-test_command_install_lib() {
-  # usage: test_command_install_package searched_binary package_to_be_installed_if_binary_not_found optional_option_to_apt_get_install
-  if [ ! -f $1 ]; then
-      echo_warning "$2 seems to be not installed, trying..."
-      apt-get install $3 $2 -y
-      if [ ! -f $1 ]; then
-          echo_fatal "$1 unavailable"
-      fi
+test_install_package() {
+  # usage: test_install_package package_name
+  if [ $# -eq 1 ]; then
+      dpkg -s "$1" > /dev/null 2>&1 && {
+          echo "$1 is installed."
+      } || {
+          echo "$1 is not installed."
+          apt-get install $1 --force-yes
+      }
   fi
-  echo_success "$1 available"
-}
-
-
-test_command_install_package() {
-  # usage: test_command_install_package searched_binary package_to_be_installed_if_binary_not_found optional_option_to_apt_get_install
-  if [ $# -eq 2 ]; then
-      command -v $1 >/dev/null 2>&1 || { echo_warning "Program $1 is not installed. Trying installing it." >&2; apt-get install $2 -y; command -v $1 >/dev/null 2>&1 || { echo_fatal "Program $1 is not installed. Aborting." >&2;};}
-  else
-      if [ $# -eq 3 ]; then
-          command -v $1 >/dev/null 2>&1 || { echo_warning "Program $1 is not installed. Trying installing it (apt-get install $3 $2)." >&2; apt-get install $3 $2 -y; command -v $1 >/dev/null 2>&1 || { echo_fatal "Program $1 is not installed. Aborting." >&2; };}
-      else
-          echo_fatal "test_command_install_package: BAD PARAMETER"
-      fi
-  fi
-  echo_success "$1 available"
 }
 
 test_command_install_script() {
-- 
GitLab