Commit f1afad6a authored by claes's avatar claes

getent used instead of search in passwd and group file

parent 7d621fd1
......@@ -15,16 +15,22 @@ fi
aroot="/usr/pwrp/adm"
# Create group pwrp
if ! grep -q "\bpwrp:" /etc/group; then
echo "-- Add group pwrp"
groupadd pwrp
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if ! grep -q "\bpwrp:" /etc/passwd; then
echo "-- Add user pwrp"
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -d /home/pwrp pwrp
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
fi
......
......@@ -17,52 +17,77 @@ aroot="/usr/pwrp/adm"
# Create users...
new_user=0
if ! grep -q "\bpwrp:" /etc/group; then
echo "-- Add group pwrp"
groupadd pwrp
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if ! grep -q "\bb55:" /etc/group; then
echo "-- Add group b55"
groupadd b55
if getent group b55 > /dev/null; then
echo "-- group b55 already exist"
else
if groupadd b55; then
echo "-- group b55 added"
fi
fi
if ! grep -q "\bb66:" /etc/group; then
echo "-- Add group b66"
groupadd b66
if getent group b66 > /dev/null; then
echo "-- group b66 already exist"
else
if groupadd b66; then
echo "-- group b66 added"
fi
fi
if ! grep -q "\bskiftel:" /etc/group; then
echo "-- Add group skiftel"
groupadd skiftel
if getent group skiftel > /dev/null; then
echo "-- group skiftel already exist"
else
if groupadd skiftel; then
echo "-- group skiftel added"
fi
fi
if ! grep -q "\bpwrp:" /etc/passwd; then
echo "-- Add user pwrp"
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -G b55,b66,skiftel -d /home/pwrp pwrp
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
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
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
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
# Add to group dialout
if grep -q "\bdialout:" /etc/group; then
if getent group dialout > /dev/null; then
usermod -a -G dialout pwrp
fi
fi
if ! grep -q "\bskiftel:" /etc/passwd; then
echo "-- Add user skiftel"
if getent passwd skiftel > /dev/null; then
echo "-- user skiftel already exist"
else
new_user=1
useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /home/skiftel skiftel
if useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /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
......@@ -79,17 +104,19 @@ if ! grep -q "\bskiftel:" /etc/passwd; then
fi
fi
if ! grep -q "\bb55:" /etc/passwd; then
echo "-- Add user b55"
if getent passwd b55 > /dev/null; then
new_user=1
# Check if group audio exist
if grep -q "\baudio:" /etc/group; then
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
useradd -s /bin/bash -p aaQPClsglxJP6 -g b55 -G $groups -d /home/b55 b55
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
......@@ -107,17 +134,19 @@ if ! grep -q "\bb55:" /etc/passwd; then
fi
fi
if ! grep -q "\bb66:" /etc/passwd; then
echo "-- Add user b66"
if getent passwd b66 > /dev/null; then
new_user=1
# Check if group audio exist
if grep -q "\baudio:" /etc/group; then
audio="-G audio"
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
audio=""
groups="pwrp"
fi
if useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66; then
echo "-- user b66 added"
fi
useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66
if [ ! -e /home/b66 ]; then
mkdir /home/b66
cp /usr/pwrrt/cnf/op/.bashrc /home/b66
......@@ -145,7 +174,7 @@ 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 grep -q "\bdialout:" /etc/group; then
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
......
......@@ -17,89 +17,117 @@ aroot="/usr/pwrp/adm"
# Create users...
new_user=0
if ! grep -q "\bpwrp:" /etc/group; then
echo "-- Add group pwrp"
groupadd pwrp
if getent group pwrp > /dev/null; then
echo "-- group pwrp already exist"
else
if groupadd pwrp; then
echo "-- group pwrp added"
fi
fi
if ! grep -q "\bb55:" /etc/group; then
echo "-- Add group b55"
groupadd b55
if getent group b55 > /dev/null; then
echo "-- group b55 already exist"
else
if groupadd b55; then
echo "-- group b55 added"
fi
fi
if ! grep -q "\bb66:" /etc/group; then
echo "-- Add group b66"
groupadd b66
if getent group b66 > /dev/null; then
echo "-- group b66 already exist"
else
if groupadd b66; then
echo "-- group b66 added"
fi
fi
if ! grep -q "\bskiftel:" /etc/group; then
echo "-- Add group skiftel"
groupadd skiftel
if getent group skiftel > /dev/null; then
echo "-- group skiftel already exist"
else
if groupadd skiftel; then
echo "-- group skiftel added"
fi
fi
if ! grep -q "\bpwrp:" /etc/passwd; then
echo "-- Add user pwrp"
if getent passwd pwrp > /dev/null; then
echo "-- user pwrp already exist"
else
new_user=1
useradd -s /bin/bash -p aaupl/kQs1p3U -g pwrp -G b55,b66,skiftel -d /home/pwrp pwrp
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
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
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
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
# Add to group dialout
if grep -q "\bdialout:" /etc/group; then
if getent group dialout > /dev/null; then
usermod -a -G dialout pwrp
fi
fi
if ! grep -q "\bskiftel:" /etc/passwd; then
echo "-- Add user skiftel"
if getent passwd skiftel > /dev/null; then
echo "-- user skiftel already exist"
else
new_user=1
useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /home/skiftel skiftel
if useradd -s /bin/bash -p aa6NzxS/aBgP6 -g skiftel -G pwrp -d /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
cp /usr/pwrrt/cnf/user/.rtt_start /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
cp /usr/pwrsev/cnf/user/.rtt_start /home/skiftel
chmod a+x /home/skiftel/.rtt_start
cp /usr/pwrrt/cnf/user/.xtt_start /home/skiftel
cp /usr/pwrsev/cnf/user/.xtt_start /home/skiftel
chmod a+x /home/skiftel/.xtt_start
cp /usr/pwrrt/cnf/user/.xsession /home/skiftel
cp /usr/pwrsev/cnf/user/.xsession /home/skiftel
chown -R pwrp /home/skiftel
chgrp -R pwrp /home/skiftel
fi
fi
if ! grep -q "\bb55:" /etc/passwd; then
echo "-- Add user b55"
if getent passwd b55 > /dev/null; then
new_user=1
# Check if group audio exist
if grep -q "\baudio:" /etc/group; then
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
groups="pwrp"
fi
useradd -s /bin/bash -p aaQPClsglxJP6 -g b55 -G $groups -d /home/b55 b55
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
cp /usr/pwrrt/cnf/op/.rtt_start /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
cp /usr/pwrsev/cnf/op/.rtt_start /home/b55
chmod a+x /home/b55/.rtt_start
cp /usr/pwrrt/cnf/op/.xtt_start /home/b55
cp /usr/pwrsev/cnf/op/.xtt_start /home/b55
chmod a+x /home/b55/.xtt_start
cp /usr/pwrrt/cnf/op/.xsession /home/b55
cp /usr/pwrsev/cnf/op/.xsession /home/b55
chown -R b55 /home/b55
chgrp -R pwrp /home/b55
......@@ -107,27 +135,29 @@ if ! grep -q "\bb55:" /etc/passwd; then
fi
fi
if ! grep -q "\bb66:" /etc/passwd; then
echo "-- Add user b66"
if getent passwd b66 > /dev/null; then
new_user=1
# Check if group audio exist
if grep -q "\baudio:" /etc/group; then
audio="-G audio"
if getent group audio > /dev/null; then
groups="pwrp,audio"
else
audio=""
groups="pwrp"
fi
if useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66; then
echo "-- user b66 added"
fi
useradd -s /bin/bash -p aae.nHgHbfUpw -g b66 -G $groups -d /home/b66 b66
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
cp /usr/pwrrt/cnf/op/.rtt_start /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
cp /usr/pwrsev/cnf/op/.rtt_start /home/b66
chmod a+x /home/b66/.rtt_start
cp /usr/pwrrt/cnf/op/.xtt_start /home/b66
cp /usr/pwrsev/cnf/op/.xtt_start /home/b66
chmod a+x /home/b66/.xtt_start
cp /usr/pwrrt/cnf/op/.xsession /home/b66
cp /usr/pwrsev/cnf/op/.xsession /home/b66
chown -R b66 /home/b66
chgrp -R pwrp /home/b66
......@@ -135,17 +165,17 @@ if ! grep -q "\bb66:" /etc/passwd; then
fi
fi
chown -R pwrp /usr/pwrrt
chgrp -R pwrp /usr/pwrrt
chown -R pwrp /usr/pwrsev
chgrp -R pwrp /usr/pwrsev
chmod u+s /usr/pwrrt/exe/sev_ini
chown root /usr/pwrrt/exe/rt_prio
chmod u+s /usr/pwrrt/exe/rt_prio
chmod u+s /usr/pwrsev/exe/sev_ini
chown root /usr/pwrsev/exe/rt_prio
chmod u+s /usr/pwrsev/exe/rt_prio
# Copy configuration files
new_cnf=0
if [ ! -e /etc/proview.cnf ]; then
cp /usr/pwrrt/cnf/proview.cnf /etc
cp /usr/pwrsev/cnf/proview.cnf /etc
new_cnf=1
fi
......@@ -196,79 +226,6 @@ if [ ! -e $aroot/db ]; then
chown -R pwrp $aroot
fi
# Copy jar-files to web directory
if [ -e /etc/proview.cnf ]; then
set +e
web_dir=`eval cat /etc/proview.cnf | grep "\\bwebDirectory\\b" | awk '{print $2}'`
set -e
if [ -e "$web_dir" ]; then
cp /usr/pwrrt/lib/pwr_rt_client.jar $web_dir
chown pwrp $web_dir/pwr_rt_client.jar
cp /usr/pwrrt/lib/pwr_jop.jar $web_dir
chown pwrp $web_dir/pwr_jop.jar
cp /usr/pwrrt/lib/pwr_jopc.jar $web_dir
chown pwrp $web_dir/pwr_jopc.jar
fi
fi
#
# Add proview web directories to Apache
#
if [ -e /etc/apache2/apache2.conf ]; then
if ! egrep -q "Alias[ ]+/pwrp_web/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwrp_web, added by Proview installation
#
Alias /pwrp_web/ /pwrp/common/web/
<Directory /pwrp/common/web>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
if ! egrep -q "Alias[ ]+/pwrp_log/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwrp_log, added by Proview installation
#
Alias /pwrp_log/ /pwrp/common/log/
<Directory /pwrp/common/log>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
if ! egrep -q "Alias[ ]+/pwr_doc/" /etc/apache2/apache2.conf; then
cat >> /etc/apache2/apache2.conf <<-EOF
#
# Proview alias pwr_doc, added by Proview installation
#
Alias /pwr_doc/ /usr/pwrrt/doc/
<Directory /usr/pwrrt/doc>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
EOF
fi
fi
#
changes=0
......
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