Commit e74a3b7f authored by Marcus Nordenberg's avatar Marcus Nordenberg Committed by Esteban Blanc

pkg: fixed some issues with the pwrsev package

(cherry picked from commit 2324d74bbcc0fdb4adbd5245a806b16ccde227a9)
parent ab1e6d83
......@@ -108,8 +108,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
......
......@@ -16,158 +16,122 @@ 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"
fi
fi
if getent group b55 > /dev/null; then
echo "-- group b55 already exist"
else
if groupadd b55; then
echo "-- group b55 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 b66 > /dev/null; then
echo "-- group b66 already exist"
else
if groupadd b66; then
echo "-- group b66 added"
fi
fi
done
if getent group skiftel > /dev/null; then
echo "-- group skiftel 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 skiftel; then
echo "-- group skiftel 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 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/pwrsev/cnf/user/.bashrc /home/pwrp
cp /usr/pwrsev/cnf/user/.bash_profile /home/pwrp
# cp /usr/pwrsev/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/pwrsev/cnf/user/.rtt_start /home/pwrp
chmod a+x /home/pwrp/.rtt_start
cp /usr/pwrsev/cnf/user/.xtt_start /home/pwrp
chmod a+x /home/pwrp/.xtt_start
# cp /usr/pwrsev/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/pwrsev/cnf/user/.bashrc /home/skiftel
cp /usr/pwrsev/cnf/user/.bash_profile /home/skiftel
# cp /usr/pwrsev/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/pwrsev/cnf/user/.rtt_start /home/skiftel
chmod a+x /home/skiftel/.rtt_start
cp /usr/pwrsev/cnf/user/.xtt_start /home/skiftel
chmod a+x /home/skiftel/.xtt_start
# cp /usr/pwrsev/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/pwrsev/cnf/op/.bashrc /home/b55
cp /usr/pwrsev/cnf/op/.bash_profile /home/b55
# cp /usr/pwrsev/cnf/op/.mwmrc /home/b55
if [ -e /home/b55 ]; then
cp /usr/pwrsev/cnf/op/.rtt_start /home/b55
chmod a+x /home/b55/.rtt_start
cp /usr/pwrsev/cnf/op/.xtt_start /home/b55
chmod a+x /home/b55/.xtt_start
# cp /usr/pwrsev/cnf/op/.xsession /home/b55
chown -R b55 /home/b55
chgrp -R pwrp /home/b55
chmod g+rwx /home/b55
chmod g+rws /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"
# Add the user b66
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/pwrsev/cnf/op/.bashrc /home/b66
cp /usr/pwrsev/cnf/op/.bash_profile /home/b66
# cp /usr/pwrsev/cnf/op/.mwmrc /home/b66
if [ -e /home/b66 ]; then
cp /usr/pwrsev/cnf/op/.rtt_start /home/b66
chmod a+x /home/b66/.rtt_start
chmod a+x /home/b55/.rtt_start
cp /usr/pwrsev/cnf/op/.xtt_start /home/b66
chmod a+x /home/b66/.xtt_start
# cp /usr/pwrsev/cnf/op/.xsession /home/b66
chmod a+x /home/b55/.xtt_start
chown -R b66 /home/b66
chgrp -R pwrp /home/b66
chmod g+rwx /home/b66
chmod g+rws /home/b66
fi
fi
chown -R pwrp /usr/pwrsev
chgrp -R pwrp /usr/pwrsev
chmod u+s /usr/pwrsev/exe/sev_ini
setcap cap_net_admin,cap_net_raw,cap_net_broadcast+eip /usr/pwrsev/exe/sev_ini
# Source pwrp_profile in login shells
if [ ! -e /etc/profile/pwrp_profile.sh ]; then
# profile.d should always exist on a modern debian system. BUT if it doesn't we create it :)
if [ ! -e /etc/profile.d ]; then mkdir /etc/profile.d; fi
echo "[[ -e /etc/pwrp_profile ]] && . /etc/pwrp_profile" > /etc/profile.d/pwrp_profile.sh
fi
# 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
# done
# Copy configuration files
new_cnf=0
......@@ -176,15 +140,6 @@ 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
fi
EOF
fi
# Create startup link
set +e
checklink=`eval ls /etc/rc2.d/S90pwrsev 2>/dev/null`
......@@ -226,16 +181,13 @@ 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 :"
......@@ -246,10 +198,6 @@ 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"
......
#!/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
if [ -e /etc/profile.d/pwrp_profile.sh ]; then rm /etc/profile.d/pwrp_profile.sh; fi
......@@ -8,102 +8,29 @@ fi
# End automatically added section
proot="/pwrp"
aroot="/usr/pwrp/adm"
echo ""
echo -n "Do you wan't 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 "\bb55\b"`
if [ "$checkuser" != "" ]; then
user_found=1
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"
aroot="/usr/pwrp"
if [ ! "$1" = "upgrade" ]; then
echo ""
echo -n "Do you want to remove project and users (y/n) [n] "
read remove_all
if [ "$remove_all" = "y" ]; then
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 $aroot"
fi
fi
fi
......
......@@ -63,7 +63,7 @@ fi
PATH=$PATH:$pwr_exe:$pwrp_exe:$jdk_home
#symbols to define start/stop commands for PWR
alias pwr_stop='/etc/init.d/pwrsvestop'
alias pwr_stop='/etc/init.d/pwrsev stop'
alias pwr_stop.sh="/etc/init.d/pwrsev stop"
alias pwr_start="/etc/init.d/pwrsev start"
alias pwrsev="/etc/init.d/pwrsev"
......
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