#!/bin/bash

. ./param_bash.ini

clear
START "Creating system links and system script $name_dir/exlibris" "$0"
if [ ! -w /etc/passwd ] ; then
	ERROR "Please run the script as root user only" "$0"
fi 

case $PATH in
    "") PATH=/bin:/usr/bin:/etc:.
        export PATH ;;
esac

K1=K10
S1=S96

b_dir=$1
echo $b_dir |sed 's/\//\\\//g' > /tmp/i.tmp; _b_dir=`cat /tmp/i.tmp`; rm /tmp/i.tmp

if [ ! -f $name_dir/exlibris ] ; then
   cat exlibris.tml | \
       sed -e s/@EXLIBRIS/$_b_dir/g \
       > $name_dir/exlibris
   chmod +x $name_dir/exlibris
else
   echo "The system script $name_dir/exlibris already exist in the server" >> $gen_log 2>&1
   echo "The system script $name_dir/exlibris already exist in the server" 	   
fi

for prg in ${name_ln}
do
     if [ ! -f "${prg}" ]; then
         ln -s $name_dir/exlibris ${prg}
     else
     	echo "The system link ${prg} already exist in the server" >> $gen_log 2>&1
   	echo "The system link ${prg} already exist in the server"    
     fi
done
DONE "System links and system script $name_dir/exlibris are created" "$0"
