Skip to content

Commit ce723af

Browse files
committed
addme is used to create user for all platforms, bashrc_template is used to omi build environment setting
1 parent c7fb86a commit ce723af

File tree

2 files changed

+214
-0
lines changed

2 files changed

+214
-0
lines changed

addme

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#/bin/bash
2+
3+
#set -x
4+
5+
OS=`uname -s`
6+
mygid=7903
7+
myuid="556"
8+
myuname="jeffcof"
9+
mygrpname=scxdev
10+
11+
while [ $# -ne 0 ]; do
12+
case "$1" in
13+
-uid )
14+
myuid=$2
15+
shift
16+
;;
17+
18+
-uname )
19+
myuname=$2
20+
shift
21+
;;
22+
23+
* )
24+
echo "addme -uid <uid> -uname <username>"
25+
exit 2
26+
;;
27+
28+
esac
29+
30+
shift
31+
32+
done
33+
34+
myhome=/home/$myuname
35+
36+
if [ "$myuid" = "<UID GOES HERE>" -o "$myuname" = "<USERNAME GOES HERE>" ]; then
37+
echo "You need to modify the script with your information"
38+
echo "or supply the information on the command line..."
39+
exit 1
40+
fi
41+
42+
# Override default for Solaris
43+
if [ "$OS" = "SunOS" ]; then
44+
myhome=/export/home/$myuname
45+
fi
46+
47+
# Is my group already here?
48+
grep :${mygid}: /etc/group > /dev/null
49+
50+
if [ $? -eq 0 ]; then
51+
echo "group already exists..."
52+
else
53+
if [ "$OS" = "AIX" ]; then
54+
mkgroup -A id=$mygid $mygrpname
55+
else
56+
groupadd -g $mygid $mygrpname
57+
fi
58+
fi
59+
60+
# Check for my username
61+
pwdentrybyname=`grep $myuname /etc/passwd`
62+
63+
if [ -n "$pwdentry" ]; then
64+
65+
echo "Username already exists, checking uid."
66+
67+
// Get the entry by UID...
68+
pwdentrybyuid=`grep $myuid /etc/passwd`
69+
70+
if [ -z "$pwentrybyuid" ] && ["$pwdentrybyname" != "pwdentrybyuid" ]; then
71+
echo "uid already in use and it's not you..."
72+
exit 2
73+
fi
74+
fi
75+
76+
77+
case "$OS" in
78+
"SunOS"|"AIX" )
79+
useradd -g $mygid -u $myuid -d $myhome -s /bin/bash $myuname
80+
usermod -G staff $myuname
81+
;;
82+
83+
* )
84+
useradd -g $mygrpname -u $myuid -d $myhome -s /bin/bash $myuname
85+
usermod -G users $myuname
86+
;;
87+
esac
88+
89+
90+
# SLES9 seems to ignore the create directory step, for some reason..
91+
if [ ! -d $myhome ]; then
92+
mkdir $myhome
93+
if [ $? -ne 0 ]; then
94+
echo "Unable to create home directory..."
95+
exit 99
96+
fi
97+
fi
98+
99+
100+
101+
chown $myuname $myhome
102+
chgrp $mygrpname $myhome
103+
chmod 755 $myhome
104+
105+
passwd $myuname

bashrc_template

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# .bashrc login initialization script for serviceb account
2+
#
3+
# Configure the system properly for UNIX builds of CM, OM, OMI, etc.
4+
# In general, PATH data belongs in .bashrc; all else belongs in .bash_profile.
5+
#
6+
# IMPORTANT: This file is checked into git! Any edits should be done there!
7+
8+
# Note: Build systems don't use 'tf' anymore, so don't deal with that
9+
10+
# Save paths so, if we re-run ourselves, the path doesn't get needlessly long
11+
12+
if [ "${SAVED_PATH:-==Unset==}" = "==Unset==" ]; then
13+
export SAVED_PATH="${PATH}"
14+
else
15+
export PATH="${SAVED_PATH}"
16+
fi
17+
18+
if [ "${SAVED_LD_LIBRARY_PATH:-==Unset==}" = "==Unset==" ]; then
19+
export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
20+
else
21+
export LD_LIBRARY_PATH="${SAVED_LD_LIBRARY_PATH}"
22+
fi
23+
24+
# Generic settings by O/S
25+
26+
case `uname -s` in
27+
AIX)
28+
PATH=/usr/bin:/usr/local/bin:/usr/sbin:/usr/vacpp/bin:/opt/freeware/bin:$PATH
29+
PATH=$PATH:/opt/pware/samba/3.0.26a/bin:/usr/java5/jre/bin
30+
export PATH
31+
32+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/dt/lib:/usr/local/lib
33+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
34+
35+
# Make sure artificial limits don't cause problems
36+
ulimit -m unlimited -n unlimited -s hard
37+
;;
38+
39+
Darwin)
40+
# Not currently building on Mac OS/X systems
41+
;;
42+
43+
HP-UX)
44+
PATH=$PATH:/usr/sbin:/opt/samba/bin:/opt/java1.5/jre/bin:/opt/aCC/bin:/opt/ansic/bin:/usr/local/bin
45+
export PATH
46+
47+
# HP utilities are very sensitive to locale, and some don't work with utf8
48+
LANG=C
49+
export LANG
50+
51+
# Bash alias won't work in configure scripts; set path for make instead
52+
if [ ! -f ~/bin/make ]; then
53+
mkdir -p ~/bin
54+
ln -s /usr/local/bin/gmake ~/bin/make
55+
fi
56+
export PATH=~/bin:$PATH
57+
58+
# Deal with OpenSSL linkages properly with pkg-config
59+
60+
case `uname -m` in
61+
ia64) # ia64
62+
export PKG_CONFIG_PATH=/opt/openssl/lib/hpux32/pkgconfig
63+
;;
64+
65+
9000/800) # pa-risc
66+
export PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig
67+
;;
68+
69+
*)
70+
echo "ERROR: Unknown platform, check output of uname -m"
71+
exit 1
72+
;;
73+
esac
74+
;;
75+
76+
Linux)
77+
# Support Bullseye if installed (Note: Bullseye needs to be at start of path)
78+
if [ -d /opt/Bullseye/bin ]; then
79+
export PATH=/opt/Bullseye/bin:$PATH
80+
fi
81+
82+
export PATH=$PATH:/usr/bin:/usr/local/bin:/usr/sbin
83+
;;
84+
85+
SunOS)
86+
# Sun systems put software in an unusual spot (generally not on path)
87+
if [ `uname -r` == '5.11' ]; then
88+
export MANPATH="/usr/share/man:/opt/solstudio12.2/man"
89+
export PATH="$PATH:/usr/bin:/usr/local/bin:/usr/sbin:/usr/gnu/bin:/opt/solstudio12.2/bin:/opt/csw/bin"
90+
else
91+
# Support Bullseye if installed (Note: Bullseye needs to be at start of path)
92+
if [ -d /opt/Bullseye/bin ]; then
93+
export PATH=/opt/Bullseye/bin:$PATH
94+
fi
95+
96+
export MANPATH="/usr/share/man:/usr/sfw/man:/opt/sfw/man:/opt/SUNWspro/man:/usr/local/man"
97+
export PATH="$PATH:/usr/sbin:/usr/local/bin:/usr/sfw/bin:/opt/sfw/bin"
98+
export PATH="$PATH:/opt/SUNWspro/bin:/opt/SUNWspro/prod/bin:/opt/csw/bin"
99+
fi
100+
101+
if [ `uname -r` == '5.8' -o `uname -r` == '5.9' ]; then
102+
# Fix up LD_LIBRARY_PATH so we can run openssl ...
103+
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/local/ssl/lib
104+
fi
105+
;;
106+
107+
*)
108+
;;
109+
esac

0 commit comments

Comments
 (0)