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
echo "source /etc/pwrp_profile" >> $wrapper
echo "umask 002" >> $wrapper
echo "\$pwr_exe/rt_ini \$* &" >> $wrapper
chmod a+rx $wrapper
if [ ! -e $wrapper ] ;then
echo "$wrapper not writable, check permissions"
exit
fi
fi
}
create_killer() test -x $DAEMON || exit 5
{
echo "#!/bin/bash" > $killer
echo "source /etc/pwrp_profile" >> $killer
echo "umask 002" >> $killer
echo "`ps ax | grep "rt_" | awk '{ print "kill -9 "$1}'`" >> $killer LOCKFILE=/run/lock/pwrdate
echo "`ps ax | grep "rs_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "ra_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "sev_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "opc_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "plc_" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "`ps ax | grep "jpwr.rt" | awk '{ print "kill -9 "$1}'`" >> $killer
echo "eval `ipcs -s|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm sem %s;", $2}'`" >> $killer RUNASUSER=pwrp
echo "eval `ipcs -q|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm msg %s;", $2}'`" >> $killer UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
echo "eval `ipcs -m|grep ^0x|grep "[ \t]pwrp[ \t]"|awk '{printf "ipcrm shm %s;", $2}'`" >> $killer
node=`eval uname -n`
applfile=$pwrp_load"/ld_appl_"$node"_"$PWR_BUS_ID".txt"
if [ -e $applfile ]; then
stored_ifs=$IFS
IFS=' ,'
while read appid appname appload apprun appfile appprio appdebug apparg; do
if [ -n "$appid" ] && [ "${appid:0:1}" != "#" ]; then
if [ $appid != "pwr_neth" ] &&
[ $appid != "pwr_qmon" ] &&
[ $appid != "pwr_nacp" ] &&
[ $appid != "pwr_io" ] &&
[ $appid != "pwr_tmon" ] &&
[ $appid != "pwr_emon" ] &&
[ $appid != "pwr_alim" ] &&
[ $appid != "pwr_bck" ] &&
[ $appid != "pwr_linksup" ] &&
[ $appid != "pwr_trend" ] &&
[ $appid != "pwr_fast" ] &&
[ $appid != "pwr_remh" ] &&
[ $appid != "pwr_remlog" ] &&
[ $appid != "pwr_webmon" ] &&
[ $appid != "pwr_webmonmh" ] &&
[ $appid != "pwr_webmonelog" ] &&
[ $appid != "pwr_opc_server" ] &&
[ $appid != "pwr_post" ] &&
[ $appid != "pwr_report" ] &&
[ $appid != "pwr_sevhistmon" ] &&
[ $appid != "pwr_sev_server" ] &&
[ $appid != "pwr_powerlink" ] &&
[ $appid != "pwr_sim" ] &&
[ $appid != "pwr_plc" ] &&
[ "$appfile" != "rt_io_comm" ] &&
[ ${appid:0:8} != "pwr_plc_" ]; then
echo "killall $appname" >> $killer
fi
fi
done < $applfile
IFS=$stored_ifs
fi
echo "if [ -e $pwrp_exe/pwrp_stop.sh ]; then" >> $killer
echo " source $pwrp_exe/pwrp_stop.sh" >> $killer
echo "fi" >> $killer
echo "rm /tmp/pwr*\$PWR_BUS_ID" >> $killer
chmod a+rx $killer case $1 in
if [ ! -e $killer ] ;then start)
echo "$killer not writable, check permissions" echo ""
exit log_daemon_msg "Starting ProviewR Runtime" "rt_ini"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi fi
} (
flock -w 180 10
start-stop-daemon --start --oknodo --pidfile $PIDFILE --startas $DAEMON -- -D
sleep 5
) 10>$LOCKFILE
log_end_msg $?
;;
stop)
echo ""
log_daemon_msg "Stopping ProviewR Runtime" "rt_ini"
pwr_start() # Store PID of rt_ini before sending SIGTERM
{ PID=0
create_wrapper if [ -e $PIDFILE ]; then
if [ `whoami` == "pwrp" ];then read PID < $PIDFILE
$wrapper
else else
sudo -u pwrp $wrapper echo ""
log_daemon_msg "No pidfile present. Did you start ProviewR as a system service?" "rt_ini"
fi fi
}
pwr_stop() rt_ini -s &>/dev/null
{ # Sleep until process is gone
create_wrapper while kill -0 $PID &>/dev/null; do
if [ `whoami` == "pwrp" ];then sleep 1
$wrapper -s done
if [ -e $pwrp_exe/pwrp_stop.sh ]; then
source $pwrp_exe/pwrp_stop.sh # Did we manage to bring everything down correct? Check to see if there are IPCs still left for the process
fi if [ ! -z $PID ]; then
else ipcs -p | grep $PID &>/dev/null
sudo -u pwrp $wrapper -s if [ $? -eq 0 ]; then
if [ -e $pwrp_exe/pwrp_stop.sh ]; then echo ""
sudo -u pwrp source $pwrp_exe/pwrp_stop.sh log_daemon_msg "IPC objects still present (abnormal termination of ProviewR?) running kill script" "rt_ini"
fi . $pwr_exe/pwr_stop.sh &>/dev/null
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 fi
}
pwr_kill() # Check for the presence of pwr_* tmp files. If there are any something must have gone wrong in the closing of rt_ini
{ ls -1 /tmp/pwr_*_$PWR_BUS_ID &>/dev/null
create_killer if [ $? -eq 0 ]; then
if [ `whoami` == "pwrp" ];then echo "\n"
$killer log_daemon_msg "Temporary files still present (abnormal termination of ProviewR?) running kill script" "rt_ini"
else . $pwr_exe/pwr_stop.sh &>/dev/null
sudo -u pwrp $killer
fi fi
}
case "$1" log_end_msg $?
in rm -f $LOCKFILE
start)
echo "Start Proview Runtime Environment."
pwr_start
echo "Done."
;;
stop)
echo "Stop Proveiw Runtime Environment."
pwr_stop
echo "Done."
;; ;;
restart) restart)
echo "Restart Proview Runtime Environment." $0 stop && sleep 2 && $0 start
echo "Closing down..."
pwr_stop
sleep 1
echo "Starting..."
pwr_start
echo "Done."
;; ;;
reload) try-restart)
echo "Reload Proview Runtime Environment" if $0 status >/dev/null; then
pwr_reload $0 restart
echo "Done." else
exit 0
fi
;; ;;
kill) reload)
echo "Remove all processes and resources for Proview Runtime Environment" PID=0
pwr_kill if [ -e $PIDFILE ]; then
echo "Done." read PID < $PIDFILE
else
echo ""
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"
exit 1
fi
rt_ini -r &>/dev/null
;; ;;
reset) status)
echo "Remove all processes and resources for Proview Runtime Environment" status_of_proc $DAEMON "ProviewR Runtime"
pwr_kill
echo "Done."
;; ;;
*) *)
echo " pwr Start and stop Proview Runtime Environment" >&2 echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
echo "" >&2 exit 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 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