Commit 1d4f1ae7 authored by Lionel Gauthier's avatar Lionel Gauthier

ok for hss build (tested ubuntu14.04x64) kernel 3.17.0-031700-lowlatency

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6335 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 2f240bb4
...@@ -306,7 +306,6 @@ check_install_freediamter(){ ...@@ -306,7 +306,6 @@ check_install_freediamter(){
} }
check_epc_s6a_certificate() { check_epc_s6a_certificate() {
cnt=0
if [ -d /usr/local/etc/freeDiameter ] if [ -d /usr/local/etc/freeDiameter ]
then then
if [ -f /usr/local/etc/freeDiameter/user.cert.pem ] if [ -f /usr/local/etc/freeDiameter/user.cert.pem ]
...@@ -323,35 +322,34 @@ check_epc_s6a_certificate() { ...@@ -323,35 +322,34 @@ check_epc_s6a_certificate() {
echo_warning "EPC S6A: generatting new certificate in /usr/local/etc/freeDiameter..." echo_warning "EPC S6A: generatting new certificate in /usr/local/etc/freeDiameter..."
cd $OPENAIRCN_DIR/S6A/freediameter cd $OPENAIRCN_DIR/S6A/freediameter
./make_certs.sh ${1:-'eur'} ./make_certs.sh ${1:-'eur'}
if [ $cnt = 0 ] ; then if [ $# -lt 2 ] ; then
cnt=1 check_epc_s6a_certificate ${1:-'eur'} 2
check_epc_s6a_certificate ${1:-'eur'}
fi fi
return 1 exit 1
} }
check_s6a_certificate() { check_hss_s6a_certificate() {
cnt=0
if [ -d /usr/local/etc/freeDiameter ]; then if [ -d /usr/local/etc/freeDiameter ]; then
if [ -f /usr/local/etc/freeDiameter/hss.cert.pem ]; then if [ -f /usr/local/etc/freeDiameter/hss.cert.pem ]; then
full_hostname=`cat /usr/local/etc/freeDiameter/hss.cert.pem | grep "Subject" | grep "CN" | cut -d '=' -f6` full_hostname=`cat /usr/local/etc/freeDiameter/hss.cert.pem | grep "Subject" | grep "CN" | cut -d '=' -f6`
# if [ $full_hostname = `hostname`.eur ]; then if [ a$full_hostname == a`hostname`.${1:-'eur'} ]
if [ $full_hostname = hss.eur ]; then then
echo_success "S6A: Found valid certificate in /usr/local/etc/freeDiameter" echo_success "HSS S6A: Found valid certificate in /usr/local/etc/freeDiameter"
return 0 return 0
else
echo_error "Bad hss hostname found in cert file: "$full_hostname " hostname is "`hostname`
fi fi
fi fi
fi fi
echo_error "S6A: Did not find valid certificate in /usr/local/etc/freeDiameter" echo_error "S6A: Did not find valid certificate in /usr/local/etc/freeDiameter"
echo_warning "S6A: generatting new certificate in /usr/local/etc/freeDiameter..." echo_warning "S6A: generatting new certificate in /usr/local/etc/freeDiameter..."
cd $OPENAIRCN_DIR/S6A/freediameter cd $OPENAIRCN_DIR/OPENAIRHSS/conf
make_certs ./make_certs.sh ${1:-'eur'}
if [ $cnt = 0 ] ; then if [ $# -lt 2 ] ; then
cnt=1 check_hss_s6a_certificate ${1:-'eur'} 2
check_s6a_certificate
fi fi
return 1 exit 1
} }
check_install_usrp_uhd_driver(){ check_install_usrp_uhd_driver(){
...@@ -632,10 +630,12 @@ check_install_asn1c(){ ...@@ -632,10 +630,12 @@ check_install_asn1c(){
################################################ ################################################
compile_hss() { compile_hss() {
cd $OPENAIRCN_DIR/OPENAIRHSS cd $OPENAIRCN_DIR/OPENAIRHSS
pwd
OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*` OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*`
if [ $1 = 1 ]; then if [ $1 -eq 1 ]; then
echo_info "build a clean EPC" echo_info "build a clean EPC"
bash_exec "rm -rf obj" bash_exec "rm -rf obj*"
bash_exec "rm configure"
fi fi
if [ ! -n "$OBJ_DIR" ]; then if [ ! -n "$OBJ_DIR" ]; then
OBJ_DIR="objs" OBJ_DIR="objs"
...@@ -644,32 +644,36 @@ compile_hss() { ...@@ -644,32 +644,36 @@ compile_hss() {
else else
OBJ_DIR=`basename $OBJ_DIR` OBJ_DIR=`basename $OBJ_DIR`
fi fi
if [ ! -f $OBJ_DIR/Makefile ]; then if [ ! -f $OBJ_DIR/Makefile ]; then
if [ ! -n "m4" ]; then if [ ! -d "m4" ]; then
mkdir -m 777 m4 mkdir -m 777 m4
fi fi
echo_success "Invoking autogen" echo_success "Invoking autogen"
bash_exec "./autogen.sh" ./autogen.sh
cd ./$OBJ_DIR if [ $? -ne 0 ]; then
echo_success "Invoking configure" return 1
fi
cd $OBJ_DIR
echo_success "Invoking configure from "`pwd`
../configure ../configure
else else
cd ./$OBJ_DIR cd $OBJ_DIR
fi fi
if [ -f Makefile ]; then if [ -f Makefile ]; then
echo_success "Compiling..." echo_success "Compiling..."pwd
make -j $NUM_CPU make ; #-j $NUM_CPU
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo_error "Build failed, exiting" echo_error "Build failed, exiting"
return 1 return 1
else else
cp -pf ./openair-hss $OPENAIR_TARGETS/bin cp -pfv ./openair-hss $OPENAIR_TARGETS/bin
return 0 return 0
fi fi
else else
echo_error "Configure failed, exiting" echo_error "Configure failed, aborting"
return 1
fi fi
return 1
} }
...@@ -850,6 +854,7 @@ check_for_hss_executable() { ...@@ -850,6 +854,7 @@ check_for_hss_executable() {
if [ ! -f $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss ]; then if [ ! -f $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss ]; then
echo_error "Cannot find openair-hss executable object in directory $OPENAIRCN_DIR/OPENAIRHSS/objs/" echo_error "Cannot find openair-hss executable object in directory $OPENAIRCN_DIR/OPENAIRHSS/objs/"
echo_error "Please make sure you have compiled OAI HSS" echo_error "Please make sure you have compiled OAI HSS"
exit 1
fi fi
} }
......
...@@ -172,6 +172,7 @@ fi ...@@ -172,6 +172,7 @@ fi
BUILD_LTE=$2 BUILD_LTE=$2
echo "setting top-level build target to: $2" echo "setting top-level build target to: $2"
shift 2; shift 2;
echo > bin/install_log.txt
;; ;;
-h | --help) -h | --help)
print_help print_help
...@@ -555,14 +556,15 @@ build_epc(){ ...@@ -555,14 +556,15 @@ build_epc(){
exit 1 exit 1
fi fi
rm -f /tmp/source.txt TEMP_FILE=`tempfile`
VARIABLES=" S6A_CONF\|\ VARIABLES=" S6A_CONF\|\
REALM" REALM"
VARIABLES=$(echo $VARIABLES | sed -e 's/\\r//g') VARIABLES=$(echo $VARIABLES | sed -e 's/\\r//g')
VARIABLES=$(echo $VARIABLES | tr -d ' ') VARIABLES=$(echo $VARIABLES | tr -d ' ')
cat $CONFIG_FILE | grep -w "$VARIABLES"| tr -d " " | tr -d ";" > /tmp/source.txt cat $CONFIG_FILE | grep -w "$VARIABLES"| tr -d " " | tr -d ";" > $TEMP_FILE
source /tmp/source.txt source $TEMP_FILE
rm -f $TEMP_FILE
if [ x"$REALM" == "x" ]; then if [ x"$REALM" == "x" ]; then
echo_error "Your config file do not contain a REALM for S6A configuration" echo_error "Your config file do not contain a REALM for S6A configuration"
...@@ -594,7 +596,7 @@ build_hss(){ ...@@ -594,7 +596,7 @@ build_hss(){
hss_compiled=1 hss_compiled=1
echo_info "Note: this scripts works only for Ubuntu 12.04" echo_info "Note: this script tested only for Ubuntu 12.04 x64 -> 14.04 x64"
###################################### ######################################
# CHECK MISC SOFTWARES AND LIBS # # CHECK MISC SOFTWARES AND LIBS #
...@@ -607,13 +609,10 @@ build_hss(){ ...@@ -607,13 +609,10 @@ build_hss(){
if [ $OAI_CLEAN -eq 1 ]; then if [ $OAI_CLEAN -eq 1 ]; then
check_install_freediamter check_install_freediamter
else else
if [ ! -d /usr/local/etc/freeDiameter ]; then if [ ! -d /usr/local/etc/freeDiameter ]; then
check_install_freediamter check_install_freediamter
fi fi
fi fi
$(make_certs >> bin/install_log.txt 2>&1)
output=$(check_s6a_certificate >> bin/install_log.txt 2>&1)
hss_certificate_generated=$?
###################################### ######################################
# compile HSS # # compile HSS #
...@@ -622,9 +621,29 @@ build_hss(){ ...@@ -622,9 +621,29 @@ build_hss(){
output=$(compile_hss $OAI_CLEAN >> bin/install_log.txt 2>&1 ) output=$(compile_hss $OAI_CLEAN >> bin/install_log.txt 2>&1 )
hss_compiled=$? hss_compiled=$?
if [ $hss_compiled -eq 1 ]; then
echo_error "Failed in compiling hss target: check the installation log file bin/install_log.txt"
exit 1
fi
check_for_hss_executable check_for_hss_executable
echo_info "finished hss target: check the installation log file bin/install_log.txt" echo_info "finished hss target: check the installation log file bin/install_log.txt"
######################################
# Check certificates #
######################################
TEMP_FILE=`tempfile`
cat $OPENAIRCN_DIR/OPENAIRHSS/conf/hss_fd.conf | grep -w "Identity" | tr -d " " | tr -d ";" > $TEMP_FILE
source $TEMP_FILE
rm -f $TEMP_FILE
if [ x"$Identity" == "x" ]; then
echo_error "Your config file do not contain a host identity for S6A configuration"
exit 1
fi
HSS_REALM=$(echo $Identity | sed 's/.*\.//')
check_hss_s6a_certificate $HSS_REALM
###################################### ######################################
# fill the HSS DB # fill the HSS DB
###################################### ######################################
...@@ -635,7 +654,7 @@ build_hss(){ ...@@ -635,7 +654,7 @@ build_hss(){
output=$(create_hss_database $USER $PW ) output=$(create_hss_database $USER $PW )
hss_db_created=$? hss_db_created=$?
if [ $hss_db_created = 0 ]; then if [ $hss_db_created = 0 ]; then
echo_warning "hss DB not created" echo_warning "hss DB not created"
fi fi
###################################### ######################################
# install hss # install hss
...@@ -646,14 +665,16 @@ build_hss(){ ...@@ -646,14 +665,16 @@ build_hss(){
echo_success "target hss built, DB created and installed in the bin directory" echo_success "target hss built, DB created and installed in the bin directory"
echo "target hss built, DB created, and installed in the bin directory" >> bin/${oai_build_date} echo "target hss built, DB created, and installed in the bin directory" >> bin/${oai_build_date}
cp -rf $OPENAIRCN_DIR/OPENAIRHSS/conf $OPENAIR_TARGETS/bin cp -rf $OPENAIRCN_DIR/OPENAIRHSS/conf $OPENAIR_TARGETS/bin
$SUDO cp $OPENAIR_TARGETS/bin/conf/hss_fd.local.conf /etc/openair-hss $SUDO cp $OPENAIR_TARGETS/bin/conf/hss_fd.local.conf /etc/openair-hss
rm -f $OPENAIR_TARGETS/bin/openair-hss
cp -pv $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss $OPENAIR_TARGETS/bin/
fi fi
###################################### ######################################
# LAUNCH HSS # # LAUNCH HSS #
###################################### ######################################
echo_info "8. run hss in bin/: ./openair-hss -c conf/hss.local.conf" echo_info "8. run hss in $OPENAIR_TARGETS/bin/: ./openair-hss -c conf/hss.local.conf"
cd bin cd $OPENAIR_TARGETS/bin
./openair-hss -c conf/hss.local.conf ./openair-hss -c conf/hss.local.conf
} }
...@@ -731,6 +752,7 @@ case "$BUILD_LTE" in ...@@ -731,6 +752,7 @@ case "$BUILD_LTE" in
build_epc build_epc
;; ;;
'HSS') 'HSS')
echo_warning "BUILD_LTE: $BUILD_LTE"
echo_warning "build HSS: Experimental" echo_warning "build HSS: Experimental"
build_hss build_hss
;; ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment