Commit 02be927b authored by Marcus Nordenberg's avatar Marcus Nordenberg Committed by Esteban Blanc

pkg: fix pwrrt package for debian x86_64

(cherry picked from commit 3c647fc3829441798185ec979420809cc6885f17)
parent 5a94f193
...@@ -43,10 +43,10 @@ fi ...@@ -43,10 +43,10 @@ fi
echo "" echo ""
echo "" echo ""
echo "" echo ""
echo "<b>Proview V${version:0:3}" echo "<b>ProviewR V${version:0:3}"
echo "Version V$version" echo "Version V$version"
echo "" echo ""
echo "Copyright 2005-${d:0:4} SSAB EMEA AB" echo "Copyright 2005-${d:0:4} SSAB EMEA AB"
echo "" echo ""
echo "This program is free software; you can redistribute it and/or" echo "This program is free software; you can redistribute it and/or"
echo "modify it under the terms of the GNU General Public License as" echo "modify it under the terms of the GNU General Public License as"
...@@ -104,6 +104,7 @@ echo "-- Create package tree" ...@@ -104,6 +104,7 @@ echo "-- Create package tree"
mkdir -p $pkgroot/DEBIAN mkdir -p $pkgroot/DEBIAN
mkdir -p $pkgroot/usr/share/doc/pwrrt mkdir -p $pkgroot/usr/share/doc/pwrrt
mkdir -p $pkgroot/etc/init.d mkdir -p $pkgroot/etc/init.d
mkdir -p $pkgroot/etc/systemd/system
find $pkgroot -type d | xargs chmod 755 find $pkgroot -type d | xargs chmod 755
...@@ -111,8 +112,10 @@ find $pkgroot -type d | xargs chmod 755 ...@@ -111,8 +112,10 @@ find $pkgroot -type d | xargs chmod 755
cp $pkgsrc/control $pkgroot/DEBIAN cp $pkgsrc/control $pkgroot/DEBIAN
cp $pkgsrc/postinst $pkgroot/DEBIAN cp $pkgsrc/postinst $pkgroot/DEBIAN
cp $pkgsrc/prerm $pkgroot/DEBIAN cp $pkgsrc/prerm $pkgroot/DEBIAN
cp $pkgsrc/postrm $pkgroot/DEBIAN
chmod 755 $pkgroot/DEBIAN/postinst chmod 755 $pkgroot/DEBIAN/postinst
chmod 755 $pkgroot/DEBIAN/prerm chmod 755 $pkgroot/DEBIAN/prerm
chmod 755 $pkgroot/DEBIAN/postrm
chmod 644 $pkgroot/DEBIAN/control chmod 644 $pkgroot/DEBIAN/control
# copyright # copyright
...@@ -128,11 +131,9 @@ gzip -fq --best $pkgroot/usr/share/doc/pwrrt/changelog.Debian ...@@ -128,11 +131,9 @@ gzip -fq --best $pkgroot/usr/share/doc/pwrrt/changelog.Debian
# Startup files # Startup files
cp $pkgsrc/pwrp_profile $pkgroot/etc cp $pkgsrc/pwrp_profile $pkgroot/etc
chmod a+x $pkgroot/etc/pwrp_profile
cp $pkgsrc/pwr $pkgroot/etc/init.d cp $pkgsrc/pwr $pkgroot/etc/init.d
chmod a+x $pkgroot/etc/init.d/pwr chmod a+x $pkgroot/etc/init.d/pwr
#cp $pkgsrc/gdhserver $pkgroot/etc/init.d cp $pkgsrc/pwr.service $pkgroot/etc/systemd/system/
#chmod a+x $pkgroot/etc/init.d/gdhserver
# Man pages # Man pages
mkdir -p $pkgroot/usr/share/man/man1 mkdir -p $pkgroot/usr/share/man/man1
...@@ -147,39 +148,32 @@ gzip -fq --best $pkgroot/usr/share/man/man1/rt_rtt.1 ...@@ -147,39 +148,32 @@ gzip -fq --best $pkgroot/usr/share/man/man1/rt_rtt.1
# Copy proview # Copy proview
mkdir $pkgroot/usr/pwrrt mkdir $pkgroot/usr/pwrrt
currentdir="`eval pwd`" #currentdir="`eval pwd`"
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar #tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
cd $pwre_broot/$pwre_target/exp #cd $pwre_broot/$pwre_target/exp
echo "-- Copy release to package tree" echo "-- Copy release to package tree"
tar -cf $tarfile * cp -r $pwre_broot/$pwre_target/exp/* $pkgroot/usr/pwrrt/
cd $pkgroot/usr/pwrrt ##tar -cf $tarfile *
tar -xf $tarfile #cd $pkgroot/usr/pwrrt
rm $tarfile #tar -xf $tarfile
#rm $tarfile
rm -r $pkgroot/usr/pwrrt/lib/*.a rm -r $pkgroot/usr/pwrrt/lib/*.a
rm -r $pkgroot/usr/pwrrt/exe/wb* rm -r $pkgroot/usr/pwrrt/exe/wb*
cp $pwr_eexe/wb_distr_keepboot.sh $pkgroot/usr/pwrrt/exe cp $pwr_eexe/wb_distr_keepboot.sh $pkgroot/usr/pwrrt/exe
cd $currentdir #cd $currentdir
# Copy configuration files to cnf # Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwrrt/cnf cp $pkgsrc/proview.cnf $pkgroot/usr/pwrrt/cnf
# Copy op to cnf # Copy op to cnf
mkdir $pkgroot/usr/pwrrt/cnf/op mkdir $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/$hw/op/.bashrc $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/$hw/op/.bash_profile $pkgroot/usr/pwrrt/cnf/op
#cp $pwre_sroot/tools/pkg/$hw/op/.mwmrc $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/$hw/op/.rtt_start $pkgroot/usr/pwrrt/cnf/op cp $pwre_sroot/tools/pkg/$hw/op/.rtt_start $pkgroot/usr/pwrrt/cnf/op
cp $pwre_sroot/tools/pkg/$hw/op/.xtt_start $pkgroot/usr/pwrrt/cnf/op cp $pwre_sroot/tools/pkg/$hw/op/.xtt_start $pkgroot/usr/pwrrt/cnf/op
#cp $pwre_sroot/tools/pkg/$hw/op/.xsession $pkgroot/usr/pwrrt/cnf/op
# Copy user to cnf # Copy user to cnf
mkdir $pkgroot/usr/pwrrt/cnf/user mkdir $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/$hw/user/.bashrc $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/$hw/user/.bash_profile $pkgroot/usr/pwrrt/cnf/user
#cp $pwre_sroot/tools/pkg/$hw/user/.mwmrc $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/$hw/user/.rtt_start $pkgroot/usr/pwrrt/cnf/user cp $pwre_sroot/tools/pkg/$hw/user/.rtt_start $pkgroot/usr/pwrrt/cnf/user
cp $pwre_sroot/tools/pkg/$hw/user/.xtt_start $pkgroot/usr/pwrrt/cnf/user cp $pwre_sroot/tools/pkg/$hw/user/.xtt_start $pkgroot/usr/pwrrt/cnf/user
#cp $pwre_sroot/tools/pkg/$hw/user/.xsession $pkgroot/usr/pwrrt/cnf/user
# Create package # Create package
echo "-- Building package" echo "-- Building package"
......
Package: pwrrt Package: pwrrt
Version: 5.7.2-1 Version: 5.7.0-3
Section: base Section: base
Priority: optional Priority: optional
Architecture: amd64 Architecture: amd64
...@@ -17,6 +17,6 @@ Depends: libc6 (>= 2.28-10), ...@@ -17,6 +17,6 @@ Depends: libc6 (>= 2.28-10),
xterm, xterm,
xfonts-100dpi xfonts-100dpi
Replaces: pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45,pwr46,pwr47,pwr48,pwr50,pwr51,pwr52,pwr53,pwr54,pwr55,pwr56 Replaces: pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45,pwr46,pwr47,pwr48,pwr50,pwr51,pwr52,pwr53,pwr54,pwr55,pwr56
Maintainer: ProviewR <postmaster@proview.se> Maintainer: Proview <postmaster@proview.se>
Description: ProviewR runtime package Description:
5.7.2-1 Base release 5.7.0-3 Base release
This diff is collapsed.
#!/bin/sh
set -e
# Remove proview.cnf if we are purging
if [ "$1" = "purge" -a -e /etc/proview.cnf ]; then
rm /etc/proview.cnf
echo "-- Purged /etc/proview.cnf"
fi
...@@ -12,109 +12,34 @@ fi ...@@ -12,109 +12,34 @@ fi
# End automatically added section # End automatically added section
proot="/pwrp" proot="/pwrp"
aroot="/usr/pwrp/adm" aroot="/usr/pwrp"
echo "" echo ""
echo -n "Do you wan't to remove project and users (y/n) [n] " echo -n "Do you want to remove project and users (y/n) [n] "
read remove_all read remove_all
if [ "$remove_all" = "y" ]; then if [ "$remove_all" = "y" ]; then
for user in pwrp skiftel b55 b66; do
# Check that any user that is to be remoted isn't logged in getent passwd ${user} >/dev/null 2>&1 && userdel -rf ${user} 2>/dev/null
set +e echo "-- Removed user ${user}"
user_found=0 done
currentusers=`eval users` for grp in pwrp skiftel b55 b66; do
userstr="" getent group ${grp} >/dev/null 2>&1 && groupdel ${grp}
checkuser=`eval echo $currentusers | grep "\bb55\b"` echo "-- Removed group ${grp}"
if [ "$checkuser" != "" ]; then done
user_found=1 echo "-- Removing projects..."
userstr=$userstr" b55"
fi
checkuser=`eval echo $currentusers | grep "\bb66\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" b66"
fi
checkuser=`eval echo $currentusers | grep "\bpwrp\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" pwrp"
fi
checkuser=`eval echo $currentusers | grep "\bskiftel\b"`
if [ "$checkuser" != "" ]; then
user_found=1
userstr=$userstr" skiftel"
fi
if [ $user_found -eq 1 ]; then
echo "-- Current users: $currentusers"
echo "** Remove user will fail. Logout user $userstr first."
exit -1;
fi
set -e
echo "-- Remove user b55"
if grep -q "\bb55:" /etc/passwd; then
userdel b55
fi
if [ -e /home/b55 ]; then
rm -r /home/b55
fi
echo "-- Remove user b66"
if grep -q "\bb66:" /etc/passwd; then
userdel b66
fi
if [ -e /home/b66 ]; then
rm -r /home/b66
fi
echo "-- Remove user pwrp"
if grep -q "\bpwrp:" /etc/passwd; then
userdel pwrp
fi
if [ -e /home/pwrp ]; then
rm -r /home/pwrp
fi
echo "-- Remove user skiftel"
if grep -q "\bskiftel:" /etc/passwd; then
userdel skiftel
fi
if [ -e /home/skiftel ]; then
rm -r /home/skiftel
fi
if grep -q "\bb55:" /etc/group; then
groupdel b55
fi
if grep -q "\bb66:" /etc/group; then
groupdel b66
fi
if grep -q "\bpwrp:" /etc/group; then
groupdel pwrp
fi
if grep -q "\bskiftel:" /etc/group; then
groupdel skiftel
fi
echo "-- Remove project $proot"
if [ -e $proot ]; then if [ -e $proot ]; then
rm -r $proot rm -r $proot && echo "-- Removed project $proot"
fi fi
if [ -e $aroot ]; then if [ -e $aroot ]; then
rm -r $aroot rm -r $aroot && echo "-- Removed admin directory $proot"
fi fi
fi fi
# Remove startup systemctl disable pwr 2>/dev/null
checklink=`eval ls /etc/rc2.d/S90pwr 2>/dev/null` if [ -e /etc/systemd/system/pwr.service ]; then
if [ "$checklink" != "" ]; then rm /etc/systemd/system/pwr.service
rm /etc/rc2.d/S90pwr # Some symlinks are left in sysv after disabling pwr with systemd
update-rc.d pwr remove >/dev/null 2>&1
fi fi
# Remove jar-files on web directory # Remove jar-files on web directory
......
#!/bin/bash #!/bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: pwr # Provides: pwr
# Required-Start: networking # Required-Start: $network $syslog
# Required-Stop: networking # Required-Stop: $network $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop:
# Short-Description: Start Proview Runtime Environment. # Short-Description: Start ProviewR Runtime Environment
# Description: Start Proview Runtime Environment.
### END INIT INFO ### END INIT INFO
#
# Start script for Proview runtime
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
wrapper="/tmp/rt_ini_wrapper"
killer="/tmp/pwr_killer"
. /etc/pwrp_profile . /etc/pwrp_profile
umask 002 . /lib/lsb/init-functions
create_wrapper() DAEMON=$pwr_exe/rt_ini
{ PIDFILE=/run/pwr/pwr.pid
if [ ! -e $wrapper ] ; then
echo "#!/bin/bash" > $wrapper test -x $DAEMON || exit 5
echo "source /etc/pwrp_profile" >> $wrapper
echo "umask 002" >> $wrapper LOCKFILE=/run/lock/pwrdate
echo "\$pwr_exe/rt_ini \$* &" >> $wrapper
chmod a+rx $wrapper RUNASUSER=pwrp
if [ ! -e $wrapper ] ;then UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
echo "$wrapper not writable, check permissions"
exit case $1 in
fi start)
fi echo ""
} log_daemon_msg "Starting ProviewR Runtime" "rt_ini"
if [ -z "$UGID" ]; then
create_killer() log_failure_msg "user \"$RUNASUSER\" does not exist"
{ exit 1
echo "#!/bin/bash" > $killer fi
echo "source /etc/pwrp_profile" >> $killer (
echo "umask 002" >> $killer flock -w 180 10
start-stop-daemon --start --oknodo --pidfile $PIDFILE --startas $DAEMON -- -D
echo "`ps ax | grep "rt_" | awk '{ print "kill -9 "$1}'`" >> $killer sleep 5
echo "`ps ax | grep "rs_" | awk '{ print "kill -9 "$1}'`" >> $killer ) 10>$LOCKFILE
echo "`ps ax | grep "ra_" | awk '{ print "kill -9 "$1}'`" >> $killer log_end_msg $?
echo "`ps ax | grep "sev_" | awk '{ print "kill -9 "$1}'`" >> $killer ;;
echo "`ps ax | grep "opc_" | awk '{ print "kill -9 "$1}'`" >> $killer stop)
echo "`ps ax | grep "plc_" | awk '{ print "kill -9 "$1}'`" >> $killer echo ""
echo "`ps ax | grep "jpwr.rt" | awk '{ print "kill -9 "$1}'`" >> $killer log_daemon_msg "Stopping ProviewR Runtime" "rt_ini"
echo "eval `ipcs -s|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`" >> $killer # Store PID of rt_ini before sending SIGTERM
echo "eval `ipcs -q|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`" >> $killer PID=0
echo "eval `ipcs -m|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`" >> $killer if [ -e $PIDFILE ]; then
read PID < $PIDFILE
node=`eval uname -n` else
applfile=$pwrp_load"/ld_appl_"$node"_"$PWR_BUS_ID".txt" echo ""
log_daemon_msg "No pidfile present. Did you start ProviewR as a system service?" "rt_ini"
if [ -e $applfile ]; then fi
stored_ifs=$IFS
IFS=' ,' rt_ini -s &>/dev/null
while read appid appname appload apprun appfile appprio appdebug apparg; do # Sleep until process is gone
if [ -n "$appid" ] && [ "${appid:0:1}" != "#" ]; then while kill -0 $PID &>/dev/null; do
if [ $appid != "pwr_neth" ] && sleep 1
[ $appid != "pwr_qmon" ] && done
[ $appid != "pwr_nacp" ] &&
[ $appid != "pwr_io" ] && # Did we manage to bring everything down correct? Check to see if there are IPCs still left for the process
[ $appid != "pwr_tmon" ] && if [ ! -z $PID ]; then
[ $appid != "pwr_emon" ] && ipcs -p | grep $PID &>/dev/null
[ $appid != "pwr_alim" ] && if [ $? -eq 0 ]; then
[ $appid != "pwr_bck" ] && echo ""
[ $appid != "pwr_linksup" ] && log_daemon_msg "IPC objects still present (abnormal termination of ProviewR?) running kill script" "rt_ini"
[ $appid != "pwr_trend" ] && . $pwr_exe/pwr_stop.sh &>/dev/null
[ $appid != "pwr_fast" ] && fi
[ $appid != "pwr_remh" ] && fi
[ $appid != "pwr_remlog" ] &&
[ $appid != "pwr_webmon" ] && # Check for the presence of pwr_* tmp files. If there are any something must have gone wrong in the closing of rt_ini
[ $appid != "pwr_webmonmh" ] && ls -1 /tmp/pwr_*_$PWR_BUS_ID &>/dev/null
[ $appid != "pwr_webmonelog" ] && if [ $? -eq 0 ]; then
[ $appid != "pwr_opc_server" ] && echo "\n"
[ $appid != "pwr_post" ] && log_daemon_msg "Temporary files still present (abnormal termination of ProviewR?) running kill script" "rt_ini"
[ $appid != "pwr_report" ] && . $pwr_exe/pwr_stop.sh &>/dev/null
[ $appid != "pwr_sevhistmon" ] && fi
[ $appid != "pwr_sev_server" ] &&
[ $appid != "pwr_powerlink" ] && log_end_msg $?
[ $appid != "pwr_sim" ] && rm -f $LOCKFILE
[ $appid != "pwr_plc" ] && ;;
[ "$appfile" != "rt_io_comm" ] && restart)
[ ${appid:0:8} != "pwr_plc_" ]; then $0 stop && sleep 2 && $0 start
echo "killall $appname" >> $killer ;;
fi try-restart)
fi if $0 status >/dev/null; then
done < $applfile $0 restart
IFS=$stored_ifs else
fi exit 0
echo "if [ -e $pwrp_exe/pwrp_stop.sh ]; then" >> $killer fi
echo " source $pwrp_exe/pwrp_stop.sh" >> $killer ;;
echo "fi" >> $killer reload)
echo "rm /tmp/pwr*\$PWR_BUS_ID" >> $killer PID=0
if [ -e $PIDFILE ]; then
chmod a+rx $killer read PID < $PIDFILE
if [ ! -e $killer ] ;then else
echo "$killer not writable, check permissions" echo ""
exit log_daemon_msg "No pidfile present, ProviewR doesn't seem to be running or you are running ProviewR as a standard user with -P" "rt_ini"
fi exit 1
} fi
pwr_start() rt_ini -r &>/dev/null
{ ;;
create_wrapper status)
if [ `whoami` == "pwrp" ];then status_of_proc $DAEMON "ProviewR Runtime"
$wrapper ;;
else *)
sudo -u pwrp $wrapper echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
fi exit 2
} ;;
esac
pwr_stop()
{
create_wrapper
if [ `whoami` == "pwrp" ];then
$wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh
fi
else
sudo -u pwrp $wrapper -s
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
sudo -u pwrp source $pwrp_exe/pwrp_stop.sh
fi
fi
while [ "`ps aux | grep -v grep | grep rt_`" != "" ] ; do sleep 1; done
}
pwr_reload()
{
if [ `whoami` == "pwrp" ];then
$pwr_exe/rt_ini_wrapper -r
else
sudo -u pwrp $pwr_exe/rt_ini_wrapper -r
fi
}
pwr_kill()
{
create_killer
if [ `whoami` == "pwrp" ];then
$killer
else
sudo -u pwrp $killer
fi
}
case "$1"
in
start)
echo "Start Proview Runtime Environment."
pwr_start
echo "Done."
;;
stop)
echo "Stop Proveiw Runtime Environment."
pwr_stop
echo "Done."
;;
restart)
echo "Restart Proview Runtime Environment."
echo "Closing down..."
pwr_stop
sleep 1
echo "Starting..."
pwr_start
echo "Done."
;;
reload)
echo "Reload Proview Runtime Environment"
pwr_reload
echo "Done."
;;
kill)
echo "Remove all processes and resources for Proview Runtime Environment"
pwr_kill
echo "Done."
;;
reset)
echo "Remove all processes and resources for Proview Runtime Environment"
pwr_kill
echo "Done."
;;
*)
echo " pwr Start and stop Proview Runtime Environment" >&2
echo "" >&2
echo " Usage:" >&2
echo " pwr start|stop|restart|reload|reset" >&2
echo "" >&2
echo " start Start Runtime environment" >&2
echo " stop Stop Runtime environment" >&2
echo " restart First stop and then start Runtime environment" >&2
echo " reload Soft restart of Runtime environment" >&2
echo " reset Remove all processes and resources" >&2
echo "" >&2
exit 1
;;
esac
exit 0
[Unit]
Documentation=man:pwr(1)
Description=ProviewR Runtime Environment
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=-/pwrp/common/load/pwr_environment
Type=forking
Restart=no
TimeoutSec=15
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BROADCAST
# TODO Share private tmp with rt_xtt
PrivateTmp=no
KillMode=control-group
GuessMainPID=no
PIDFile=/run/pwr/pwr.pid
RemainAfterExit=no
RuntimeDirectory=pwr
RemoveIPC=yes
ExecStart=/etc/init.d/pwr start
ExecStop=/etc/init.d/pwr stop
# The reload function is not to be trusted, if for instance, you're running profibus/profinet.
# There are probably more cases in which this is cheesy...
ExecReload=/etc/init.d/pwr reload
User=pwrp
Group=pwrp
StandardOutput=journal
StandardError=inherit
SyslogIdentifier=ProviewR
LimitCORE=infinity
LimitRTPRIO=infinity
IOSchedulingClass=best-effort
IOSchedulingPriority=3
[Install]
WantedBy=multi-user.target
bus_id="" bus_id=""
if [ -e /etc/proview.cnf ]; then if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'` bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
...@@ -20,10 +19,20 @@ export pwr_load=$pwrb_root/load ...@@ -20,10 +19,20 @@ export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis export pwr_lis=$pwrb_root/lis
export pwr_doc=$pwrb_root/doc export pwr_doc=$pwrb_root/doc
export pwrp_exe=$pwrp_root/x86_64_linux/exe # Fetch arch
export pwrp_lib=$pwrp_root/x86_64_linux/lib if [ -e /pwrp ]; then
export pwrp_obj=$pwrp_root/x86_64_linux/obj for dir in `ls -1 /pwrp`; do
export pwrp_lis=$pwrp_root/x86_64_linux/lis [[ "${dir}" == "common" ]] && continue
arch=${dir}
break
done
# Set arch specific env variables
for env in exe obj lis lib; do
export pwrp_${env}=${pwrp_root}/${arch}/${env}
done
fi
export pwrp_inc=$pwrp_root/common/inc export pwrp_inc=$pwrp_root/common/inc
export pwrp_load=$pwrp_root/common/load export pwrp_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log export pwrp_log=$pwrp_root/common/log
...@@ -32,19 +41,19 @@ export pwrp_web=$web_dir ...@@ -32,19 +41,19 @@ export pwrp_web=$web_dir
export pwra_db=/usr/pwrp/adm/db export pwra_db=/usr/pwrp/adm/db
# Check /usr/local first since it ought to have priority # Check /usr/local first since it ought to have priority
jdk=`eval ls -1 /usr/local | sort -r | grep ^jdk | head -1` jdk=`eval ls -1 /usr/local | sort -r | grep ^jdk | head -1`
# Check if any JRE is present in /usr/local # Check if any JRE is present in /usr/local
if [ -z "$jdk" ]; then if [ -z "$jdk" ]; then
jdk=`eval ls -1 /usr/local | sort -r | grep ^jre | head -1` jdk=`eval ls -1 /usr/local | sort -r | grep ^jre | head -1`
fi fi
# If no local jdk/jres were found check for openjdk. Debian can have a default-java # If no local jdk/jres were found check for openjdk. Debian should have a default-java
# symlink in /usr/lib/jvm which can be changed with update-java-alternatives if openjdk # symlink in /usr/lib/jvm which can be changed with update-java-alternatives if openjdk
# is in use. If no default-java excists try to use the one with the highest version # is in use. If no default-java excists use the one with the highest version
if [ -z "$jdk" ]; then if [ -z "$jdk" ]; then
if [ -e /usr/lib/jvm/default-java ]; then if [ -e /usr/lib/jvm/default-java ]; then
jdk=`eval realpath -qe /usr/lib/jvm/default-java` jdk=`eval realpath -qe /usr/lib/jvm/default-java`
else elif [ -e /usr/lib/jvm ]; then
jdk_name=`eval ls -1 /usr/lib/jvm | sort -r | grep ^java | head -1` jdk_name=`eval ls -1 /usr/lib/jvm | sort -r | grep ^java | head -1`
jdk=`eval realpath -qe /usr/lib/jvm/$jdk_name` jdk=`eval realpath -qe /usr/lib/jvm/$jdk_name`
unset jdk_name unset jdk_name
...@@ -64,11 +73,12 @@ fi ...@@ -64,11 +73,12 @@ fi
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#symbols to define start/stop commands for PWR #symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwr stop' alias pwr_stop='pwr stop'
alias pwr_stop.sh="/etc/init.d/pwr stop" alias pwr_start="pwr start"
alias pwr_start="/etc/init.d/pwr start"
alias pwr="/etc/init.d/pwr" pwr() {
alias boot="/usr/bin/sudo /sbin/reboot" systemctl "$1" pwr.service
}
if [ -e $pwrp_exe/profile ]; then if [ -e $pwrp_exe/profile ]; then
source $pwrp_exe/profile source $pwrp_exe/profile
......
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