boinc/packages/solaris/CSW/boincclient/preinstall

92 lines
3.0 KiB
Plaintext
Raw Normal View History

- Added checks for net/*.h, arpa/*.h, netinet/*.h and code to figure out which of those files to include - Modified MAC address check to work on some non-Linux unixes. (mac_address.cpp) - Added suggested change to "already attached to project" checking. (ProjectInfoPage.cpp) - changed includes of standard c header files to their c++ equivalents (i.e. replaced <stdio.h> with <cstdio>) for namespace protection. - replaced "using namespace std;" with more explicit "using std::function" in several files. - Fixed bug in checking whether the os is OS/2 and added conditional OS_OS2 to the build environment. (boinc_platform.m4,configure.ac) - Changed build environment to not use -nostandardlibs unless we are using G++ and static linkage is specified. (configure.ac) - Added makefiles and package building files for solaris CSW package manager. - Fixed bug with attempting to find login name using logname. (configure.ac) - Added ifdef HAVE_* protection around some include files commonly found in sys. - Added support for unified binary for x86_64/i686-pc-solaris. (cs_platforms.cpp) - generate_host_cpid() now uses MAC address on non-linux unix. (hostinfo_network.cpp) - Macro BOINC_SET_COMPILE_FLAGS now doesn't check gcc only flags on non-gcc compilers. (boinc_set_compile_flags.m4) - Library compiles no longer depend upon the library extension or require the library to be prefixed with lib. - More fixes for fcgi builds. - Added declaration of "struct ether_addr" and ether_ntoa(). Have not yet implemented ether_ntoa() for machines that don't have it, or where it is buggy. (unix_util.h) - Added FCGI::perror() which calls FCGI_perror(). (boinc_fcgi.{h,cpp}) - Fixed library Makefiles so that all required headers get installed. svn path=/trunk/boinc/; revision=17388
2009-02-26 00:23:23 +00:00
#! /bin/sh
PATH=/bin:/usr/bin:/usr/ucb/bin:/opt/csw/bin
export PATH
if [ -x $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
. $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
fi
if [ -x $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
. $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
fi
BOINCUSER=boinc
BOINCGROUP="`( groups ${BOINCUSER} 2>/dev/null || echo boinc ) | gawk '{print $1}'`"
MAJOR=`uname -r | gawk -F. '{print $1}'`
MINOR=`uname -r | gawk -F. '{print $2}'`
# find our run directory
if [ $MAJOR -gt 5 -o \( $MAJOR -eq 5 -a $MINOR -gt 9 \) ] ; then
BOINCDIR=$PKG_INSTALL_ROOT/var/lib/boinc
if [ -d $PKG_INSTALL_ROOT/var/opt/csw/boinc -a ! -d $PKG_INSTALL_ROOT/var/lib/boinc ] ; then
mv -f $PKG_INSTALL_ROOT/var/opt/csw/boinc $PKG_INSTALL_ROOT/var/lib/boinc
fi
else
BOINCDIR=$PKG_INSTALL_ROOT/var/opt/csw/boinc
fi
# find out if the group $BOINCGROUP exists
GROUPENT=`getent group $BOINCGROUP`
# if we need to create the boinc group, find the first unused group number
# 2316 or highter
if [ -z "${GROUPENT}" ] ; then
getent group | gawk -F: '{print $3}' > /tmp/$$.grp
try=2316
while [ ! -z "`grep \^$try /tmp/$$.grp`" ] ; do
try=`expr $try + 1`
done
GROUPNUM=${try}
GROUPENT="${BOINCGROUP}::${try}:"
cp $PKG_INSTALL_ROOT/etc/group $PKG_INSTALL_ROOT/etc/group.boinc_install.bak
echo ${GROUPENT} >> $PKG_INSTALL_ROOT/etc/group
/bin/rm /tmp/$$.grp
else
GROUPNUM=`echo $GROUPENT | gawk -F: '{print $3}'`
fi
# Now find out if the user ${BOINCUSER} exists.
USERENT=`getent passwd $BOINCUSER`
# if we need to create the boinc group, find the first unused user number
# ${BOINCGROUP} or highter
if [ -z "${USERENT}" ] ; then
getent passwd | gawk -F: '{print $3}' >/tmp/$$.user
try="${GROUPNUM}"
while [ ! -z "`grep \^$try /tmp/$$.user`" ] ; do
try=`expr $try + 1`
done
USERENT="${BOINCUSER}:x:${try}:${GROUPNUM}:BOINC client user:${BOINCDIR}:/bin/ksh"
cp $PKG_INSTALL_ROOT/etc/passwd $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak
echo $USERENT >> $PKG_INSTALL_ROOT/etc/passwd
/bin/rm /tmp/$$.user
fi
# Does our user entry point to the correct directory?
if [ -z "`echo $USERENT | grep $BOINCDIR`" ] ; then
# No. We need to correct it.
USERENT=`echo $USERENT | gawk -F: '{print $1":"$2":"$3":"$4":"$5":'$BOINCDIR':"$7}'`
grep -v \^${BOINCUSER}: $PKG_INSTALL_ROOT/etc/passwd > /tmp/passwd.$$
echo "$USERENT" >> /tmp/passwd.$$
if [ ! -f $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak ] ; then
cp $PKG_INSTALL_ROOT/etc/passwd $PKG_INSTALL_ROOT/etc/passwd.boinc_install.bak
fi
mv -f /tmp/passwd.$$ $PKG_INSTALL_ROOT/etc/passwd
fi
# check for our shadow entry
shadent="`grep \^$BOINCUSER: $PKG_INSTALL_ROOT/etc/shadow`"
if [ -z "$shadent" ] ; then
shadent="${BOINCUSER}:NP:16384::::::"
cp $PKG_INSTALL_ROOT/etc/shadow $PKG_INSTALL_ROOT/etc/shadow.boinc_install.bak
chmod 0400 $PKG_INSTALL_ROOT/etc/shadow.boinc_install.bak
echo $shadent >> $PKG_INSTALL_ROOT/etc/shadow
fi
# Create the run directory and set permissions properly.
if [ ! -d $BOINCDIR ] ; then
mkdir -p $BOINCDIR
fi
chown -R $BOINCUSER:$BOINCGROUP $BOINCDIR