Dynamic lib selection and deployment
[anna.git] / example / diameter / launcher / resources / scripts / select_dynlib.sh
1 #!/bin/bash
2 echo
3 echo "------------------------------------------------"
4 echo "Dynamic library selection for launcher procedure"
5 echo "------------------------------------------------"
6 cd $(dirname $0)
7 option=$1
8 rm -f libanna_dynamicLauncherProcedure.so
9 if [ -z "$option" ]
10 then
11   echo " (you could provide directly the path to the .so file)"
12   echo
13   echo "Available options:"
14   tmpfile=$(mktemp)
15   find . -name "*.so" > $tmpfile
16   echo
17   for line in $(cat $tmpfile); do echo "   $line" ; done
18   dflt=$(grep "^./default/" $tmpfile)
19   echo
20   echo -n "Paste your selection [$dflt]: "
21   read option
22   [ -z "$option" ] && option=$dflt
23   rm $tmpfile 
24 fi
25
26 [ ! -f $option ] && { echo -e "\nInvalid file !\n" ; exit 1 ; }
27 ln -sf $option libanna_dynamicLauncherProcedure.so  
28 echo
29 echo "Library enabled"
30 echo
31