3
PATH=/bin:/usr/bin:/usr/ucb/bin:/opt/csw/bin
6
if [ -x $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
7
. $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
9
if [ -x $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
10
. $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
14
BOINCGROUP="`( groups ${BOINCUSER} 2>/dev/null || echo boinc ) | gawk '{print $1}'`"
16
MAJOR=`uname -r | gawk -F. '{print $1}'`
17
MINOR=`uname -r | gawk -F. '{print $2}'`
18
# find our run directory
19
if [ $MAJOR -gt 5 -o \( $MAJOR -eq 5 -a $MINOR -gt 9 \) ] ; then
20
BOINCDIR=$PKG_INSTALL_ROOT/var/lib/boinc
21
if [ -d $PKG_INSTALL_ROOT/var/opt/csw/boinc -a ! -d $PKG_INSTALL_ROOT/var/lib/boinc ] ; then
22
mv -f $PKG_INSTALL_ROOT/var/opt/csw/boinc $PKG_INSTALL_ROOT/var/lib/boinc
25
BOINCDIR=$PKG_INSTALL_ROOT/var/opt/csw/boinc
28
# find out if the group $BOINCGROUP exists
29
GROUPENT=`getent group $BOINCGROUP`
31
# if we need to create the boinc group, find the first unused group number
33
if [ -z "${GROUPENT}" ] ; then
34
getent group | gawk -F: '{print $3}' > /tmp/$$.grp
36
while [ ! -z "`grep \^$try /tmp/$$.grp`" ] ; do
40
GROUPENT="${BOINCGROUP}::${try}:"
41
cp $PKG_INSTALL_ROOT/etc/group $PKG_INSTALL_ROOT/etc/group.boinc_install.bak
42
echo ${GROUPENT} >> $PKG_INSTALL_ROOT/etc/group
45
GROUPNUM=`echo $GROUPENT | gawk -F: '{print $3}'`
48
# Now find out if the user ${BOINCUSER} exists.
49
USERENT=`getent passwd $BOINCUSER`
51
# if we need to create the boinc group, find the first unused user number
52
# ${BOINCGROUP} or highter
53
if [ -z "${USERENT}" ] ; then
54
getent passwd | gawk -F: '{print $3}' >/tmp/$$.user
56
while [ ! -z "`grep \^$try /tmp/$$.user`" ] ; do
59
USERENT="${BOINCUSER}:x:${try}:${GROUPNUM}:BOINC client user:${BOINCDIR}:/bin/ksh"
60
cp $PKG_INSTALL_ROOT/etc/passwd $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak
61
echo $USERENT >> $PKG_INSTALL_ROOT/etc/passwd
65
# Does our user entry point to the correct directory?
66
if [ -z "`echo $USERENT | grep $BOINCDIR`" ] ; then
67
# No. We need to correct it.
68
USERENT=`echo $USERENT | gawk -F: '{print $1":"$2":"$3":"$4":"$5":'$BOINCDIR':"$7}'`
69
grep -v \^${BOINCUSER}: $PKG_INSTALL_ROOT/etc/passwd > /tmp/passwd.$$
70
echo "$USERENT" >> /tmp/passwd.$$
71
if [ ! -f $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak ] ; then
72
cp $PKG_INSTALL_ROOT/etc/passwd $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak
74
mv -f /tmp/passwd.$$ $PKG_INSTALL_ROOT/etc/passwd
77
# check for our shadow entry
78
shadent="`grep \^$BOINCUSER: $PKG_INSTALL_ROOT/etc/shadow`"
79
if [ -z "$shadent" ] ; then
80
shadent="${BOINCUSER}:NP:16384::::::"
81
cp $PKG_INSTALL_ROOT/etc/shadow $PKG_INSTALL_ROOT/etc/shadow.boinc_install.bak
82
chmod 0400 $PKG_INSTALL_ROOT/etc/shadow.boinc_install.bak
83
echo $shadent >> $PKG_INSTALL_ROOT/etc/shadow
86
# Create the run directory and set permissions properly.
87
if [ ! -d $BOINCDIR ] ; then
90
chown -R $BOINCUSER:$BOINCGROUP $BOINCDIR