-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_dealer.bash
executable file
·92 lines (82 loc) · 3.05 KB
/
install_dealer.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# File install.bash -- JGM -- 2022-03-11
# Version 2024-06-30 Changed ROOTDIR to /usr/local/games and re-orged the directory structure
#set -x
DISTRODIR="$PWD"
HOMEDIR="${HOME}/"
ROOTDIR="/usr/local/games/"
#ROOTDIR="/tmp/games/"
RUNDIR="/usr/local/bin/" # put symlinks to pgms in /usr/local/games/DEALERV2_4/bin here
#RUNDIR="/tmp/local/bin/"
PGMVER="DealerV2_4/"
PGMDIR="${ROOTDIR}${PGMVER}"
OPCDIR="${ROOTDIR}DOP/"
EXEDIR="${PGMDIR}bin/"
LIBDIR="${PGMDIR}lib/"
DIRLIST="bin dat Debug DebugExamples docs DOP Examples exe include lib Prod Regression src stdlib UserEval"
SUDO_USER=$USER
#copy the repo files to $PGMDIR
echo "Debug: User=${SUDO_USER} is installing from $DISTRODIR to $PGMDIR with symlinks in ${RUNDIR}"
if [[ -d ${PGMDIR} ]]; then echo Found "${PGMDIR}"
else
echo Making "${PGMDIR}"
mkdir -p ${PGMDIR}
fi
if [[ -d ${RUNDIR} ]]; then echo Found "${RUNDIR}"
else
echo Making "${RUNDIR}"
mkdir -p ${RUNDIR}
fi
cd ${DISTRODIR}
DIRLIST="bin dat Debug DebugExamples docs DOP Examples include lib Prod Regression src stdlib UserEval"
# Copy the Relevant Repo Contents to the Install Dir; preserve permission bits
echo "Processing realdir=${DISTRODIR} to Destdir=${PGMDIR}"
cp -pd ${DISTRODIR}/* ${PGMDIR} 2>/dev/null #copy the files in the main distro dir; omit subdirs for now.
for subdir in ${DIRLIST} ; do
echo "Processing subdir=${subdir} realdir=${DISTRODIR}/${subdir}/"
cp -pRd ${DISTRODIR}/${subdir} ${PGMDIR}
done
chown -R ${SUDO_USER}:${SUDO_USER} ${PGMDIR}
# setup the DOP/OPC Perl external program
if [[ -d ${OPCDIR} ]] ; then echo Found "$OPCDIR"
else
echo Making "$OPCDIR"
mkdir -p ${OPCDIR}
fi
cd ${OPCDIR}
tar -xvf ${PGMDIR}DOP_distkit.tar.gz
chown -R ${SUDO_USER}:${SUDO_USER} ${OPCDIR}/*
chmod +x ${OPCDIR}dop ${OPCDIR}*.pl
cd - # back to $DISTRODIR
pwd
# now make sure that EXEDIR contains copies of all the binaries the user is likely to need
# and setup symlinks to them in the RUNDIR
echo "Setting up ${EXEDIR} and ${RUNDIR} "
for exe in Prod/dealerv2 Debug/dealdbg UserEval/DealerServer UserEval/DealerSrvdbg ; do
progname=$( basename $exe )
cp -p $exe ${EXEDIR}${progname}
chmod +x ${EXEDIR}${progname}
ln -s ${EXEDIR}${progname} ${RUNDIR}${progname}
done
# make logical links in RUNDIR and EXEDIR to executables in OPCDIR and LIBDIR
ln -s ${OPCDIR}/dop ${RUNDIR}/dop
ln -s ${LIBDIR}gibcli ${RUNDIR}/gibcli
ln -s ${LIBDIR}fdp ${RUNDIR}/fdp
ln -s ${LIBDIR}fdpi ${RUNDIR}fdpi
ln -s ${OPCDIR}/dop ${EXEDIR}/dop
ln -s ${LIBDIR}fdp ${EXEDIR}/fdp
ln -s ${LIBDIR}fdpi ${EXEDIR}fdpi
# /make sure that $RUNDIR is in the users path
append=0
if echo $PATH | grep -q "${RUNDIR}" ; then
echo RUNDIR found >/dev/null
else
PATH="${RUNDIR}:${PATH}"
append=1
fi
if [[ $append -gt 0 ]] ; then
echo $append :: Appending[ $PATH ] to ${HOMEDIR}/.bashrc
echo PATH=$PATH >>${HOMEDIR}/.bashrc
fi
echo "installed the OPC Perl script(s) in $OPCDIR"
echo "Complete $PGMVER set of files in $PGMDIR including the fdpi and fdp Perl script(s) in $LIBDIR"