Option for starting PShell as e-account

This commit is contained in:
Gobbo Alexandre
2021-02-08 11:20:05 +01:00
parent c18f0fffcd
commit f4931e9905

53
pshell
View File

@@ -1,6 +1,55 @@
#!/bin/bash
#Check if running as e-account
for i in "$@"
do
case $i in
-ea|-ea=*)
export ea="${i#*=}"
export pars=""
export epars="-data=~/Data1"
echo "Running as e-account"
#Replace ea into eax
for j in "$@"
do
case $j in
-ea|-ea=*)
pars+='-eax '
;;
*) # unknown option
pars+=$j
pars+=' '
;;
esac
done
if [[ $ea == "-ea" ]] ; then
export cmd='read -p "Enter E-Account: " ea ; echo Authenticating user ${ea}...; su ${ea} -c'
else
export cmd='echo Authenticating user ${ea}...; su ${ea} -c'
fi
if [ -z "$DESKTOP_SESSION" ]
then
echo "SSH session"
cookie=$(xauth list $DISPLAY)
export cmd="${cmd} 'xauth add $cookie; ${BASH_SOURCE} ${pars} ${epars}; sleep 2'"
else
echo "Desktop session"
export cmd="${cmd} '${BASH_SOURCE} ${pars} ${epars}; sleep 2'"
fi
#echo $cmd
xterm -T "Run PShell as E-Account" -fa monaco -fs 14 -bg black -fg green -geometry 80x15+400+100 -e "${cmd}"
exit
;;
esac
done
#Parse JVM arguments, Pshell version and JEP option
export PSHELL_VER=default
@@ -94,7 +143,7 @@ if [[ $@ != **-py** ]] ; then
#if [[ $JEP == "" ]] ; then
if [[ $UCP == "" ]] ; then
#echo 'Standard launch'
${JAVA_VER}/bin/java ${JVM_EARGS} ${JVM_ARGS} -jar /opt/gfa/pshell/${PSHELL_VER} $@
${JAVA_VER}/bin/java ${JVM_EARGS} ${JVM_ARGS} -jar /opt/gfa/pshell/${PSHELL_VER} ${1+"$@"}
exit
fi
fi
@@ -151,5 +200,5 @@ if [[ $UCP != "" ]] ; then
fi
export PATH=${PYTHONHOME}/bin:$CLEAN_PATH
${JAVA_VER}/bin/java ${JVM_EARGS} ${JVM_ARGS} -cp ${UCP}/opt/gfa/pshell/${PSHELL_VER}:${JEP_JAR} ch.psi.pshell.ui.App $@
${JAVA_VER}/bin/java ${JVM_EARGS} ${JVM_ARGS} -cp ${UCP}/opt/gfa/pshell/${PSHELL_VER}:${JEP_JAR} ch.psi.pshell.ui.App ${1+"$@"}