Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
02be927b
Commit
02be927b
authored
Feb 28, 2020
by
Marcus Nordenberg
Committed by
Esteban Blanc
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: fix pwrrt package for debian x86_64
(cherry picked from commit 3c647fc3829441798185ec979420809cc6885f17)
parent
5a94f193
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
315 additions
and
510 deletions
+315
-510
src/tools/pkg/deb_x86_64/pwrrt/build.sh
src/tools/pkg/deb_x86_64/pwrrt/build.sh
+15
-21
src/tools/pkg/deb_x86_64/pwrrt/control
src/tools/pkg/deb_x86_64/pwrrt/control
+4
-4
src/tools/pkg/deb_x86_64/pwrrt/postinst
src/tools/pkg/deb_x86_64/pwrrt/postinst
+103
-175
src/tools/pkg/deb_x86_64/pwrrt/postrm
src/tools/pkg/deb_x86_64/pwrrt/postrm
+9
-0
src/tools/pkg/deb_x86_64/pwrrt/prerm
src/tools/pkg/deb_x86_64/pwrrt/prerm
+18
-93
src/tools/pkg/deb_x86_64/pwrrt/pwr
src/tools/pkg/deb_x86_64/pwrrt/pwr
+105
-203
src/tools/pkg/deb_x86_64/pwrrt/pwr.service
src/tools/pkg/deb_x86_64/pwrrt/pwr.service
+37
-0
src/tools/pkg/deb_x86_64/pwrrt/pwrp_profile
src/tools/pkg/deb_x86_64/pwrrt/pwrp_profile
+24
-14
No files found.
src/tools/pkg/deb_x86_64/pwrrt/build.sh
View file @
02be927b
...
...
@@ -43,10 +43,10 @@ fi
echo
""
echo
""
echo
""
echo
"<b>Proview V
${
version
:0:3
}
"
echo
"<b>Proview
R
V
${
version
:0:3
}
"
echo
"Version V
$version
"
echo
""
echo
"Copyright 2005-
${
d
:0:4
}
SSAB EMEA AB"
echo
"Copyright
�
2005-
${
d
:0:4
}
SSAB EMEA AB"
echo
""
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"
...
...
@@ -104,6 +104,7 @@ echo "-- Create package tree"
mkdir
-p
$pkgroot
/DEBIAN
mkdir
-p
$pkgroot
/usr/share/doc/pwrrt
mkdir
-p
$pkgroot
/etc/init.d
mkdir
-p
$pkgroot
/etc/systemd/system
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
/postinst
$pkgroot
/DEBIAN
cp
$pkgsrc
/prerm
$pkgroot
/DEBIAN
cp
$pkgsrc
/postrm
$pkgroot
/DEBIAN
chmod
755
$pkgroot
/DEBIAN/postinst
chmod
755
$pkgroot
/DEBIAN/prerm
chmod
755
$pkgroot
/DEBIAN/postrm
chmod
644
$pkgroot
/DEBIAN/control
# copyright
...
...
@@ -128,11 +131,9 @@ gzip -fq --best $pkgroot/usr/share/doc/pwrrt/changelog.Debian
# Startup files
cp
$pkgsrc
/pwrp_profile
$pkgroot
/etc
chmod
a+x
$pkgroot
/etc/pwrp_profile
cp
$pkgsrc
/pwr
$pkgroot
/etc/init.d
chmod
a+x
$pkgroot
/etc/init.d/pwr
#cp $pkgsrc/gdhserver $pkgroot/etc/init.d
#chmod a+x $pkgroot/etc/init.d/gdhserver
cp
$pkgsrc
/pwr.service
$pkgroot
/etc/systemd/system/
# Man pages
mkdir
-p
$pkgroot
/usr/share/man/man1
...
...
@@ -147,39 +148,32 @@ gzip -fq --best $pkgroot/usr/share/man/man1/rt_rtt.1
# Copy proview
mkdir
$pkgroot
/usr/pwrrt
currentdir
=
"
`
eval pwd
`
"
tarfile
=
$pwre_broot
/
$pwre_target
/bld/pkg/pwrtmp.tar
cd
$pwre_broot
/
$pwre_target
/exp
#
currentdir="`eval pwd`"
#
tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
#
cd $pwre_broot/$pwre_target/exp
echo
"-- Copy release to package tree"
tar
-cf
$tarfile
*
cd
$pkgroot
/usr/pwrrt
tar
-xf
$tarfile
rm
$tarfile
cp
-r
$pwre_broot
/
$pwre_target
/exp/
*
$pkgroot
/usr/pwrrt/
##tar -cf $tarfile *
#cd $pkgroot/usr/pwrrt
#tar -xf $tarfile
#rm $tarfile
rm
-r
$pkgroot
/usr/pwrrt/lib/
*
.a
rm
-r
$pkgroot
/usr/pwrrt/exe/wb
*
cp
$pwr_eexe
/wb_distr_keepboot.sh
$pkgroot
/usr/pwrrt/exe
cd
$currentdir
#
cd $currentdir
# Copy configuration files to cnf
cp
$pkgsrc
/proview.cnf
$pkgroot
/usr/pwrrt/cnf
# Copy op to cnf
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/.xtt_start
$pkgroot
/usr/pwrrt/cnf/op
#cp $pwre_sroot/tools/pkg/$hw/op/.xsession $pkgroot/usr/pwrrt/cnf/op
# Copy user to cnf
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/.xtt_start
$pkgroot
/usr/pwrrt/cnf/user
#cp $pwre_sroot/tools/pkg/$hw/user/.xsession $pkgroot/usr/pwrrt/cnf/user
# Create package
echo
"-- Building package"
...
...
src/tools/pkg/deb_x86_64/pwrrt/control
View file @
02be927b
Package: pwrrt
Version: 5.7.
2-1
Version: 5.7.
0-3
Section: base
Priority: optional
Architecture: amd64
...
...
@@ -17,6 +17,6 @@ Depends: libc6 (>= 2.28-10),
xterm,
xfonts-100dpi
Replaces: pwr34,pwr39,pwr40,pwr41,pwr42,pwr43,pwr44,pwr45,pwr46,pwr47,pwr48,pwr50,pwr51,pwr52,pwr53,pwr54,pwr55,pwr56
Maintainer: Proview
R
<postmaster@proview.se>
Description:
ProviewR runtime package
5.7.
2-1
Base release
Maintainer: Proview <postmaster@proview.se>
Description:
5.7.
0-3
Base release
src/tools/pkg/deb_x86_64/pwrrt/postinst
View file @
02be927b
...
...
@@ -16,176 +16,125 @@ proot="/pwrp"
aroot
=
"/usr/pwrp/adm"
# Create users...
new_user
=
0
if
getent group pwrp
>
/dev/null
;
then
echo
"-- group pwrp already exist
"
else
if
groupadd pwrp
;
then
echo
"-- group pwrp added
"
echo
"-- Creating users/groups..."
for
grp
in
pwrp b55 b66 skiftel
;
do
if
getent group
${
grp
}
>
/dev/null
;
then
echo
"-- Group
${
grp
}
already exist. OK!
"
else
if
groupadd
${
grp
}
;
then
echo
"-- Group
${
grp
}
added...
"
fi
fi
if
getent group b55
>
/dev/null
;
then
echo
"-- group b55 already exist"
else
if
groupadd b55
;
then
echo
"-- group b55 added"
fi
fi
done
if
getent group b66
>
/dev/null
;
then
echo
"-- group b66 already exist"
# Do we have a pwrp user already?
if
getent passwd pwrp
>
/dev/null
;
then
echo
"-- User pwrp already exist. OK!"
else
if
groupadd b66
;
then
echo
"--
group b66 added
"
if
useradd
--create-home
--shell
/bin/bash
--password
aaupl/kQs1p3U
--gid
pwrp
--groups
b55,b66,skiftel
--home-dir
/home/pwrp pwrp
;
then
echo
"--
User pwrp added...
"
fi
fi
if
getent group skiftel
>
/dev/null
;
then
echo
"-- group skiftel already exist"
else
if
groupadd skiftel
;
then
echo
"-- group skiftel added"
fi
fi
if
getent passwd pwrp
>
/dev/null
;
then
echo
"-- user pwrp already exist"
else
new_user
=
1
if
useradd
-s
/bin/bash
-p
aaupl/kQs1p3U
-g
pwrp
-G
b55,b66,skiftel
-d
/home/pwrp pwrp
;
then
echo
"-- user pwrp added"
fi
if
[
!
-e
/home/pwrp
]
;
then
mkdir
/home/pwrp
cp
/usr/pwrrt/cnf/user/.bashrc /home/pwrp
cp
/usr/pwrrt/cnf/user/.bash_profile /home/pwrp
# cp /usr/pwrrt/cnf/user/.mwmrc /home/pwrp
# If all went well we copy proview specific startup scripts to the home folder
if
[
-e
/home/pwrp
]
;
then
cp
/usr/pwrrt/cnf/user/.rtt_start /home/pwrp
chmod
a+x /home/pwrp/.rtt_start
cp
/usr/pwrrt/cnf/user/.xtt_start /home/pwrp
chmod
a+x /home/pwrp/.xtt_start
# cp /usr/pwrrt/cnf/user/.xsession /home/pwrp
chown
-R
pwrp /home/pwrp
chgrp
-R
pwrp /home/pwrp
fi
# Add to group dialout
if
getent group dialout
>
/dev/null
;
then
usermod
-a
-G
dialout pwrp
# Add
pwrp
to group dialout
if
getent group dialout
>
/dev/null
;
then
usermod
-a
-G
dialout pwrp
&&
echo
"-- User 'pwrp' added to group 'dialout'..."
||
echo
"-- Unable to add user 'pwrp' to group 'dialout'!"
fi
fi
if
getent passwd skiftel
>
/dev/null
;
then
echo
"--
user skiftel already exist
"
if
getent passwd skiftel
>
/dev/null
;
then
echo
"--
User skiftel already exist. OK!
"
else
new_user
=
1
if
useradd
-s
/bin/bash
-p
aa6NzxS/aBgP6
-g
skiftel
-G
pwrp
-d
/home/skiftel skiftel
;
then
echo
"-- user skiftel added"
if
useradd
--create-home
--shell
/bin/bash
--password
aa6NzxS/aBgP6
--gid
skiftel
--groups
pwrp
--home-dir
/home/skiftel skiftel
;
then
echo
"-- User skiftel added..."
fi
if
[
!
-e
/home/skiftel
]
;
then
mkdir
/home/skiftel
cp
/usr/pwrrt/cnf/user/.bashrc /home/skiftel
cp
/usr/pwrrt/cnf/user/.bash_profile /home/skiftel
# cp /usr/pwrrt/cnf/user/.mwmrc /home/skiftel
# If all went well we copy proview specific startup scripts to the home folder
if
[
-e
/home/skiftel
]
;
then
cp
/usr/pwrrt/cnf/user/.rtt_start /home/skiftel
chmod
a+x /home/skiftel/.rtt_start
cp
/usr/pwrrt/cnf/user/.xtt_start /home/skiftel
chmod
a+x /home/skiftel/.xtt_start
# cp /usr/pwrrt/cnf/user/.xsession /home/skiftel
chown
-R
pwrp /home/skiftel
# And change group ownership of skiftel's home folder to pwrp
chgrp
-R
pwrp /home/skiftel
fi
fi
if
getent passwd b55
>
/dev/null
;
then
new_user
=
1
# Setup the operator group memberships
groups
=
"pwrp"
getent group audio
>
/dev/null
&&
groups
+
=
",audio"
# Check if group audio exist
if
getent group audio
>
/dev/null
;
then
groups
=
"pwrp,audio"
else
groups
=
"pwrp"
# Add the user b55
if
getent passwd b55
>
/dev/null
;
then
echo
"-- User b55 already exist. OK!"
else
if
useradd
--create-home
--shell
/bin/bash
--password
aaQPClsglxJP6
--gid
b55
--groups
$groups
--home-dir
/home/b55 b55
;
then
echo
"-- User b55 added..."
fi
if
useradd
-s
/bin/bash
-p
aaQPClsglxJP6
-g
b55
-G
$groups
-d
/home/b55 b55
;
then
echo
"-- user b55 added"
fi
if
[
!
-e
/home/b55
]
;
then
mkdir
/home/b55
cp
/usr/pwrrt/cnf/op/.bashrc /home/b55
cp
/usr/pwrrt/cnf/op/.bash_profile /home/b55
# cp /usr/pwrrt/cnf/op/.mwmrc /home/b55
if
[
-e
/home/b55
]
;
then
cp
/usr/pwrrt/cnf/op/.rtt_start /home/b55
chmod
a+x /home/b55/.rtt_start
cp
/usr/pwrrt/cnf/op/.xtt_start /home/b55
chmod
a+x /home/b55/.xtt_start
# cp /usr/pwrrt/cnf/op/.xsession /home/b55
chown
-R
b55 /home/b55
chgrp
-R
pwrp /home/b55
chmod
g+rw
x
/home/b55
chmod
g+rw
s
/home/b55
fi
fi
if
getent passwd b66
>
/dev/null
;
then
new_user
=
1
# Check if group audio exist
if
getent group audio
>
/dev/null
;
then
groups
=
"pwrp,audio"
else
groups
=
"pwrp"
if
getent passwd b66
>
/dev/null
;
then
echo
"-- User b66 already exist. OK!"
else
if
useradd
--create-home
--shell
/bin/bash
--password
1P4JdWA5HqSMQ
--gid
b66
--groups
$groups
--home-dir
/home/b66 b66
;
then
echo
"-- User b66 added..."
fi
if
useradd
-s
/bin/bash
-p
aae.nHgHbfUpw
-g
b66
-G
$groups
-d
/home/b66 b66
;
then
echo
"-- user b66 added"
fi
if
[
!
-e
/home/b66
]
;
then
mkdir
/home/b66
cp
/usr/pwrrt/cnf/op/.bashrc /home/b66
cp
/usr/pwrrt/cnf/op/.bash_profile /home/b66
# cp /usr/pwrrt/cnf/op/.mwmrc /home/b66
if
[
-e
/home/b66
]
;
then
cp
/usr/pwrrt/cnf/op/.rtt_start /home/b66
chmod
a+x /home/b
66
/.rtt_start
chmod
a+x /home/b
55
/.rtt_start
cp
/usr/pwrrt/cnf/op/.xtt_start /home/b66
chmod
a+x /home/b66/.xtt_start
# cp /usr/pwrrt/cnf/op/.xsession /home/b66
chmod
a+x /home/b55/.xtt_start
chown
-R
b66 /home/b66
chgrp
-R
pwrp /home/b66
chmod
g+rw
x
/home/b66
chmod
g+rw
s
/home/b66
fi
fi
chown
-R
pwrp /usr/pwrrt
chgrp
-R
pwrp /usr/pwrrt
chmod
u+s /usr/pwrrt/exe/rt_ini
chmod
u+s /usr/pwrrt/exe/rt_rtt
setcap cap_net_admin,cap_net_raw,cap_net_broadcast+eip /usr/pwrrt/exe/rt_ini
#chmod u+s /usr/pwrrt/exe/rt_ini
#chmod u+s /usr/pwrrt/exe/rt_rtt
#chmod u+s /usr/pwrrt/exe/rt_xtt
chmod
u+s /usr/pwrrt/exe/rt_bck
chmod
u+s /usr/pwrrt/exe/rt_gdhget
chown
root /usr/pwrrt/exe/rs_remote_alcm
chmod
u+s /usr/pwrrt/exe/rs_remote_alcm
if
getent group dialout
>
/dev/null
;
then
chgrp
dialout /usr/pwrrt/exe/rs_remote_serial
chmod
ug+s /usr/pwrrt/exe/rs_remote_serial
chgrp
dialout /usr/pwrrt/exe/rs_remote_3964r
chmod
ug+s /usr/pwrrt/exe/rs_remote_3964r
fi
if
[
-e
/usr/pwrrt/exe/rt_powerlink
]
;
then
chown
root /usr/pwrrt/exe/rt_powerlink
chmod
u+s /usr/pwrrt/exe/rt_powerlink
fi
chown
root /usr/pwrrt/exe/rt_mozilla
chmod
u+s /usr/pwrrt/exe/rt_mozilla
#
chmod u+s /usr/pwrrt/exe/rt_bck
#
chmod u+s /usr/pwrrt/exe/rt_gdhget
#
chown root /usr/pwrrt/exe/rs_remote_alcm
#
chmod u+s /usr/pwrrt/exe/rs_remote_alcm
#
if getent group dialout > /dev/null; then
#
chgrp dialout /usr/pwrrt/exe/rs_remote_serial
#
chmod ug+s /usr/pwrrt/exe/rs_remote_serial
#
chgrp dialout /usr/pwrrt/exe/rs_remote_3964r
#
chmod ug+s /usr/pwrrt/exe/rs_remote_3964r
#
fi
#
if [ -e /usr/pwrrt/exe/rt_powerlink ]; then
#
chown root /usr/pwrrt/exe/rt_powerlink
#
chmod u+s /usr/pwrrt/exe/rt_powerlink
#
fi
#
chown root /usr/pwrrt/exe/rt_mozilla
#
chmod u+s /usr/pwrrt/exe/rt_mozilla
# Copy configuration files
new_cnf
=
0
...
...
@@ -194,30 +143,30 @@ if [ ! -e /etc/proview.cnf ]; then
new_cnf
=
1
fi
# Add pwrp_profile to profile
if
!
grep
-q
"/etc/pwrp_profile
\b
"
/etc/profile
;
then
cat
>>
/etc/profile
<<-
EOF
if [ -e /etc/pwrp_profile ]; then
source /etc/pwrp_profile
# Source pwrp_profile from both profile and bash.bashrc
for
cnf_file
in
/etc/profile /etc/bash.bashrc
;
do
if
!
grep
-q
"/etc/pwrp_profile
\b
"
${
cnf_file
}
;
then
cat
>>
${
cnf_file
}
<<-
EOF
[[ -e /etc/pwrp_profile ]] && . /etc/pwrp_profile
EOF
fi
EOF
fi
done
# Create startup link
set
+e
checklink
=
`
eval ls
/etc/rc2.d/S90pwr 2>/dev/null
`
set
-e
if
[
"
$checklink
"
!=
""
]
;
then
rm
/etc/rc2.d/S90pwr
fi
ln
-s
/etc/init.d/pwr /etc/rc2.d/S90pwr
set
+e
checklink
=
`
eval ls
/etc/rc2.d/S91gdhserver 2>/dev/null
`
set
-e
if
[
"
$checklink
"
!=
""
]
;
then
rm
/etc/rc2.d/S91gdhserver
fi
#
set +e
#
checklink=`eval ls /etc/rc2.d/S90pwr 2>/dev/null`
#
set -e
#
if [ "$checklink" != "" ]; then
#
rm /etc/rc2.d/S90pwr
#
fi
#
ln -s /etc/init.d/pwr /etc/rc2.d/S90pwr
#
set +e
#
checklink=`eval ls /etc/rc2.d/S91gdhserver 2>/dev/null`
#
set -e
#
if [ "$checklink" != "" ]; then
#
rm /etc/rc2.d/S91gdhserver
#
fi
# Obsolete
#ln -s /etc/init.d/gdhserver /etc/rc2.d/S91gdhserver
...
...
@@ -324,8 +273,8 @@ EOF
fi
# Add directories to nginx
if
[
-e
/etc/nginx/sites-
enabled
/default
]
;
then
if
!
egrep
-q
"location /pwrp_web/"
/etc/nginx/sites-
enabled
/default
;
then
if
[
-e
/etc/nginx/sites-
available
/default
]
;
then
if
!
egrep
-q
"location /pwrp_web/"
/etc/nginx/sites-
available
/default
;
then
awk
'
BEGIN {
inserver = 0;
...
...
@@ -365,57 +314,36 @@ BEGIN {
}
else
printf( "%s\n", $0);
}'
/etc/nginx/sites-
enabled/default
>
/etc/nginx/sites-enabled
/default.new
}'
/etc/nginx/sites-
available/default
>
/etc/nginx/sites-available
/default.new
mv
/etc/nginx/sites-enabled/default.new /etc/nginx/sites-enabled/default
cp
/etc/nginx/sites-available/default /etc/nginx/sites-available/default.old
mv
/etc/nginx/sites-available/default.new /etc/nginx/sites-available/default
ln
-s
/etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
fi
fi
#
# Set owner on preinstalled I/O systems
#
if
[
-e
/lib/udev/devices/qbus
]
;
then
chown
pwrp:pwrp /lib/udev/devices/qbus
fi
if
[
-e
/lib/udev/devices/pbus1
]
;
then
chown
pwrp:pwrp /lib/udev/devices/pbus1
fi
if
[
-e
/lib/udev/devices/pbus2
]
;
then
chown
pwrp:pwrp /lib/udev/devices/pbus2
fi
changes
=
0
if
[
$new_user
-eq
1
]
;
then
changes
=
1
elif
[
$new_cnf
-eq
1
]
;
then
if
[
$new_cnf
-eq
1
]
;
then
changes
=
1
elif
[
$new_project
-eq
1
]
;
then
changes
=
1
fi
if
[
$changes
-ne
0
]
;
then
echo
""
echo
""
echo
"***********************************************************"
echo
" Don't forget to do this :"
echo
""
fi
echo
""
echo
"***********************************************************"
echo
" Don't forget to do this :"
echo
""
if
[
$new_cnf
-eq
1
]
;
then
echo
"-- Enter QcomBusId in /etc/proview.cnf"
fi
#if [ $new_user -eq 1 ]; then
# echo "-- Enter OpPlace object as argument to rt_xtt in /home/b55/.xtt_start"
#fi
if
[
$new_project
-eq
1
]
;
then
nodename
=
`
eval uname
-n
`
echo
"-- Distribute project to
$nodename
"
fi
if
[
$changes
-ne
0
]
;
then
echo
""
echo
"***********************************************************"
echo
""
fi
echo
"-- Once you have a project setup, enable the pwr service with:"
echo
" # systemctl enable pwr"
echo
"***********************************************************"
echo
""
src/tools/pkg/deb_x86_64/pwrrt/postrm
0 → 100755
View file @
02be927b
#!/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
src/tools/pkg/deb_x86_64/pwrrt/prerm
View file @
02be927b
...
...
@@ -12,109 +12,34 @@ fi
# End automatically added section
proot
=
"/pwrp"
aroot
=
"/usr/pwrp
/adm
"
aroot
=
"/usr/pwrp"
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
if
[
"
$remove_all
"
=
"y"
]
;
then
# Check that any user that is to be remoted isn't logged in
set
+e
user_found
=
0
currentusers
=
`
eval users
`
userstr
=
""
checkuser
=
`
eval echo
$currentusers
|
grep
"
\b
b55
\b
"
`
if
[
"
$checkuser
"
!=
""
]
;
then
user_found
=
1
userstr
=
$userstr
" b55"
fi
checkuser
=
`
eval echo
$currentusers
|
grep
"
\b
b66
\b
"
`
if
[
"
$checkuser
"
!=
""
]
;
then
user_found
=
1
userstr
=
$userstr
" b66"
fi
checkuser
=
`
eval echo
$currentusers
|
grep
"
\b
pwrp
\b
"
`
if
[
"
$checkuser
"
!=
""
]
;
then
user_found
=
1
userstr
=
$userstr
" pwrp"
fi
checkuser
=
`
eval echo
$currentusers
|
grep
"
\b
skiftel
\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
"
\b
b55:"
/etc/passwd
;
then
userdel b55
fi
if
[
-e
/home/b55
]
;
then
rm
-r
/home/b55
fi
echo
"-- Remove user b66"
if
grep
-q
"
\b
b66:"
/etc/passwd
;
then
userdel b66
fi
if
[
-e
/home/b66
]
;
then
rm
-r
/home/b66
fi
echo
"-- Remove user pwrp"
if
grep
-q
"
\b
pwrp:"
/etc/passwd
;
then
userdel pwrp
fi
if
[
-e
/home/pwrp
]
;
then
rm
-r
/home/pwrp
fi
echo
"-- Remove user skiftel"
if
grep
-q
"
\b
skiftel:"
/etc/passwd
;
then
userdel skiftel
fi
if
[
-e
/home/skiftel
]
;
then
rm
-r
/home/skiftel
fi
if
grep
-q
"
\b
b55:"
/etc/group
;
then
groupdel b55
fi
if
grep
-q
"
\b
b66:"
/etc/group
;
then
groupdel b66
fi
if
grep
-q
"
\b
pwrp:"
/etc/group
;
then
groupdel pwrp
fi
if
grep
-q
"
\b
skiftel:"
/etc/group
;
then
groupdel skiftel
fi
echo
"-- Remove project
$proot
"
for
user
in
pwrp skiftel b55 b66
;
do
getent passwd
${
user
}
>
/dev/null 2>&1
&&
userdel
-rf
${
user
}
2>/dev/null
echo
"-- Removed user
${
user
}
"
done
for
grp
in
pwrp skiftel b55 b66
;
do
getent group
${
grp
}
>
/dev/null 2>&1
&&
groupdel
${
grp
}
echo
"-- Removed group
${
grp
}
"
done
echo
"-- Removing projects..."
if
[
-e
$proot
]
;
then
rm
-r
$proot
rm
-r
$proot
&&
echo
"-- Removed project
$proot
"
fi
if
[
-e
$aroot
]
;
then
rm
-r
$aroot
rm
-r
$aroot
&&
echo
"-- Removed admin directory
$proot
"
fi
fi
# Remove startup
checklink
=
`
eval ls
/etc/rc2.d/S90pwr 2>/dev/null
`
if
[
"
$checklink
"
!=
""
]
;
then
rm
/etc/rc2.d/S90pwr
systemctl disable pwr 2>/dev/null
if
[
-e
/etc/systemd/system/pwr.service
]
;
then
rm
/etc/systemd/system/pwr.service
# Some symlinks are left in sysv after disabling pwr with systemd
update-rc.d pwr remove
>
/dev/null 2>&1
fi
# Remove jar-files on web directory
...
...
src/tools/pkg/deb_x86_64/pwrrt/pwr
View file @
02be927b
#!/bin/bash
#!/bin/sh
### BEGIN INIT INFO
# Provides: pwr
# Required-Start:
networkin
g
# Required-Stop:
networkin
g
# Required-Start:
$network $syslo
g
# Required-Stop:
$network $syslo
g
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Proview Runtime Environment.
# Description: Start Proview Runtime Environment.
# Default-Stop:
# Short-Description: Start ProviewR Runtime Environment
### 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
umask
002
.
/lib/lsb/init-functions
create_wrapper
()
{
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
}
DAEMON
=
$pwr_exe
/rt_ini
PIDFILE
=
/run/pwr/pwr.pid
create_killer
()
{
echo
"#!/bin/bash"
>
$killer
echo
"source /etc/pwrp_profile"
>>
$killer
echo
"umask 002"
>>
$killer
test
-x
$DAEMON
||
exit
5
echo
"
`
ps ax |
grep
"rt_"
|
awk
'{ print "kill -9 "$1}'
`
"
>>
$killer
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
LOCKFILE
=
/run/lock/pwrdate
echo
"eval
`
ipcs
-s
|grep ^0x|grep
"[
\t
]pwrp[
\t
]"
|awk
'{printf "ipcrm sem %s;", $2}'
`
"
>>
$killer
echo
"eval
`
ipcs
-q
|grep ^0x|grep
"[
\t
]pwrp[
\t
]"
|awk
'{printf "ipcrm msg %s;", $2}'
`
"
>>
$killer
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
RUNASUSER
=
pwrp
UGID
=
$(
getent passwd
$RUNASUSER
|
cut
-f
3,4
-d
:
)
||
true
chmod
a+rx
$killer
if
[
!
-e
$killer
]
;
then
echo
"
$killer
not writable, check permissions"
exit
case
$1
in
start
)
echo
""
log_daemon_msg
"Starting ProviewR Runtime"
"rt_ini"
if
[
-z
"
$UGID
"
]
;
then
log_failure_msg
"user
\"
$RUNASUSER
\"
does not exist"
exit
1
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
()
{
create_wrapper
if
[
`
whoami
`
==
"pwrp"
]
;
then
$wrapper
# Store PID of rt_ini before sending SIGTERM
PID
=
0
if
[
-e
$PIDFILE
]
;
then
read
PID <
$PIDFILE
else
sudo
-u
pwrp
$wrapper
echo
""
log_daemon_msg
"No pidfile present. Did you start ProviewR as a system service?"
"rt_ini"
fi
}
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
rt_ini
-s
&>/dev/null
# Sleep until process is gone
while
kill
-0
$PID
&>/dev/null
;
do
sleep
1
done
# Did we manage to bring everything down correct? Check to see if there are IPCs still left for the process
if
[
!
-z
$PID
]
;
then
ipcs
-p
|
grep
$PID
&>/dev/null
if
[
$?
-eq
0
]
;
then
echo
""
log_daemon_msg
"IPC objects still present (abnormal termination of ProviewR?) running kill script"
"rt_ini"
.
$pwr_exe
/pwr_stop.sh &>/dev/null
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
# 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
if
[
$?
-eq
0
]
;
then
echo
"
\n
"
log_daemon_msg
"Temporary files still present (abnormal termination of ProviewR?) running kill script"
"rt_ini"
.
$pwr_exe
/pwr_stop.sh &>/dev/null
fi
}
case
"
$1
"
in
start
)
echo
"Start Proview Runtime Environment."
pwr_start
echo
"Done."
;;
stop
)
echo
"Stop Proveiw Runtime Environment."
pwr_stop
echo
"Done."
log_end_msg
$?
rm
-f
$LOCKFILE
;;
restart
)
echo
"Restart Proview Runtime Environment."
echo
"Closing down..."
pwr_stop
sleep
1
echo
"Starting..."
pwr_start
echo
"Done."
$0
stop
&&
sleep
2
&&
$0
start
;;
reload
)
echo
"Reload Proview Runtime Environment"
pwr_reload
echo
"Done."
try-restart
)
if
$0
status
>
/dev/null
;
then
$0
restart
else
exit
0
fi
;;
kill
)
echo
"Remove all processes and resources for Proview Runtime Environment"
pwr_kill
echo
"Done."
reload
)
PID
=
0
if
[
-e
$PIDFILE
]
;
then
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
)
echo
"Remove all processes and resources for Proview Runtime Environment"
pwr_kill
echo
"Done."
status
)
status_of_proc
$DAEMON
"ProviewR Runtime"
;;
*
)
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
echo
"Usage:
$0
{start|stop|restart|try-restart|reload|status}"
exit
2
;;
esac
exit
0
esac
src/tools/pkg/deb_x86_64/pwrrt/pwr.service
0 → 100644
View file @
02be927b
[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
src/tools/pkg/deb_x86_64/pwrrt/pwrp_profile
View file @
02be927b
bus_id=""
if [ -e /etc/proview.cnf ]; then
bus_id=`eval cat /etc/proview.cnf | grep "\\bqcomBusId\\b" | awk '{print $2}'`
...
...
@@ -20,10 +19,20 @@ export pwr_load=$pwrb_root/load
export pwr_lis=$pwrb_root/lis
export pwr_doc=$pwrb_root/doc
export pwrp_exe=$pwrp_root/x86_64_linux/exe
export pwrp_lib=$pwrp_root/x86_64_linux/lib
export pwrp_obj=$pwrp_root/x86_64_linux/obj
export pwrp_lis=$pwrp_root/x86_64_linux/lis
# Fetch arch
if [ -e /pwrp ]; then
for dir in `ls -1 /pwrp`; do
[[ "${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_load=$pwrp_root/common/load
export pwrp_log=$pwrp_root/common/log
...
...
@@ -32,19 +41,19 @@ export pwrp_web=$web_dir
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`
# Check if any JRE is present in /usr/local
if [ -z "$jdk" ]; then
jdk=`eval ls -1 /usr/local | sort -r | grep ^jre | head -1`
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
# 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 [ -e /usr/lib/jvm/default-java ]; then
jdk=`eval realpath -qe /usr/lib/jvm/default-java`
el
se
el
if [ -e /usr/lib/jvm ]; then
jdk_name=`eval ls -1 /usr/lib/jvm | sort -r | grep ^java | head -1`
jdk=`eval realpath -qe /usr/lib/jvm/$jdk_name`
unset jdk_name
...
...
@@ -64,11 +73,12 @@ fi
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwr stop'
alias pwr_stop.sh="/etc/init.d/pwr stop"
alias pwr_start="/etc/init.d/pwr start"
alias pwr="/etc/init.d/pwr"
alias boot="/usr/bin/sudo /sbin/reboot"
alias pwr_stop='pwr stop'
alias pwr_start="pwr start"
pwr() {
systemctl "$1" pwr.service
}
if [ -e $pwrp_exe/profile ]; then
source $pwrp_exe/profile
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment