e776f33209
PR: ports/166873 Submitted by: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
36 lines
1 KiB
Bash
36 lines
1 KiB
Bash
#!/bin/sh
|
|
|
|
PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin
|
|
|
|
user=%%BOINC_CLIENT_USER%%
|
|
group=%%BOINC_CLIENT_GROUP%%
|
|
home=%%BOINC_CLIENT_HOME%%
|
|
shell=/bin/sh
|
|
|
|
case $2 in
|
|
POST-INSTALL)
|
|
if ! pw usershow ${user} >/dev/null 2>&1; then
|
|
if ! pw useradd ${user} -g ${group} -c "BOINC client user" -d ${home} -s ${shell}; then
|
|
err=$?
|
|
echo "WARNING: Unable to create user ${user}. pw returned ${err}"
|
|
echo "You will need to create a BOINC client user and"
|
|
echo "chown the BOINC client user directory."
|
|
exit ${err}
|
|
else
|
|
echo "BOINC client user created."
|
|
fi
|
|
else
|
|
echo "BOINC client user found. Using found account."
|
|
fi
|
|
mkdir -p ${home}
|
|
if [ ! -e ${home}/skins -a ! -L ${home}/skins ]; then
|
|
ln -s %%PREFIX%%/share/boinc/skins ${home}/skins
|
|
chown -h ${user}:${group} ${home}/skins
|
|
fi
|
|
if [ ! -e ${home}/ca-bundle.crt -a ! -L ${home}/ca-bundle.crt ]; then
|
|
ln -s %%LOCALBASE%%/share/certs/ca-root-nss.crt ${home}/ca-bundle.crt
|
|
chown -h ${user}:${group} ${home}/ca-bundle.crt
|
|
fi
|
|
chown ${user}:${group} ${home}
|
|
;;
|
|
esac
|