diff --git a/net/boinc-client/Makefile b/net/boinc-client/Makefile index 82f0101d9441..1e9c0f22e1ef 100644 --- a/net/boinc-client/Makefile +++ b/net/boinc-client/Makefile @@ -7,6 +7,7 @@ PORTNAME= boinc-client PORTVERSION= 7.0.28 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_LOCAL} MASTER_SITE_SUBDIR= pav @@ -14,7 +15,6 @@ MASTER_SITE_SUBDIR= pav MAINTAINER= pav@FreeBSD.org COMMENT= Berkeley Open Infrastructure for Network Computing client -USE_GCC= any USE_XZ= yes GNU_CONFIGURE= yes USE_LDCONFIG= yes @@ -149,6 +149,11 @@ post-patch: @${REINPLACE_CMD} -e 's|@BUILD_GRAPHICS_API_TRUE@|#&|' ${WRKSRC}/api/Makefile.in .endif +pre-install: +.if ${PORT_OPTIONS:MUSER} + @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL +.endif + post-install: .if ${PORT_OPTIONS:MMANAGER} ${MKDIR} ${PREFIX}/share/boinc @@ -176,8 +181,5 @@ post-install: . endif ${CP} -R ${WRKSRC}/api/txf ${PREFIX}/share/boinc .endif -.if ${PORT_OPTIONS:MUSER} - @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL -.endif .include diff --git a/net/boinc-client/files/boinc-client.in b/net/boinc-client/files/boinc-client.in index 9edab1342e57..11a503933b11 100644 --- a/net/boinc-client/files/boinc-client.in +++ b/net/boinc-client/files/boinc-client.in @@ -6,52 +6,48 @@ # REQUIRE: LOGIN # KEYWORD: shutdown # -# Add the following line to /etc/rc.conf to enable the BOINC client: -# -# boinc_client_enable="YES" +# Add the following lines to /etc/rc.conf to enable the BOINC client: # +# boinc_client_enable (boolean) Set to "YES" to enable boinc_client +# (default is "NO"). +# boinc_client_flags (string) Additional flags for boinc_client. . /etc/rc.subr -name="boinc-client" +name="boinc_client" rcvar=boinc_client_enable -boinc_client_user=%%BOINC_CLIENT_USER%% -boinc_client_home=%%BOINC_CLIENT_HOME%% -boinc_client_flags="--daemon --dir ${boinc_client_home}" - -active_file="/var/run/${name}.active" - -load_rc_config $name +load_rc_config ${name} : ${boinc_client_enable="NO"} +command="%%PREFIX%%/bin/boinc_client" +pidfile="/var/run/${name}.pid" + +boinc_client_user=%%BOINC_CLIENT_USER%% +command_args="--daemon --dir \"%%BOINC_CLIENT_HOME%%\"" + start_cmd=boinc_client_start -stop_cmd=boinc_client_stop +stop_postcmd=boinc_client_poststop boinc_client_start() { - if checkyesno boinc_client_enable; then - if [ -f ${active_file} ]; then - echo 1>&2 "${name} already running?" - return 1 - fi - echo "Starting ${name}." - idprio 31 su - ${boinc_client_user} -c \ - "%%PREFIX%%/bin/boinc_client ${boinc_client_flags}" - touch ${active_file} - fi -} + local pid -boinc_client_stop() -{ - if [ ! -f ${active_file} ]; then - echo 1>&2 "${name} is not running." + pid=$(check_pidfile "${pidfile}" "${command}") + if [ -n "${pid}" ]; then + echo 1>&2 "${name} already running? (pid=${pid})." return 1 fi - echo "Stopping ${name}." - su - ${boinc_client_user} -c \ - "cd ${boinc_client_home} && %%PREFIX%%/bin/boinccmd --quit" - rm ${active_file} + echo "Starting ${name}." + idprio 31 su - ${boinc_client_user} -c \ + "\"${command}\" ${boinc_client_flags} ${command_args}" || return 1 + pgrep -U ${boinc_client_user} -n -t - '^boinc_client$' \ + > "${pidfile}" || return 1 +} + +boinc_client_poststop() +{ + rm -f "${pidfile}" } run_rc_command "$1" diff --git a/net/boinc-client/files/patch-zip-unzip-extract.c b/net/boinc-client/files/patch-zip-unzip-extract.c new file mode 100644 index 000000000000..703cea2514ed --- /dev/null +++ b/net/boinc-client/files/patch-zip-unzip-extract.c @@ -0,0 +1,11 @@ +--- zip/unzip/extract.c.orig 2012-04-09 13:58:50.000000000 +0300 ++++ zip/unzip/extract.c 2012-09-12 14:05:07.000000000 +0300 +@@ -218,7 +218,7 @@ + static ZCONST char Far InvalidComprData[] = "invalid compressed data to "; + static ZCONST char Far Inflate[] = "inflate_boinc"; + +-extern int inflate_boinc(__G__ is_defl64); ++extern int inflate_boinc(__GPRO__ int is_defl64); + + #ifndef SFX + static ZCONST char Far Explode[] = "explode"; diff --git a/net/boinc-client/files/pkg-install.in b/net/boinc-client/files/pkg-install.in index b528ad7e985d..aeb77bdbedfa 100644 --- a/net/boinc-client/files/pkg-install.in +++ b/net/boinc-client/files/pkg-install.in @@ -1,36 +1,42 @@ #!/bin/sh +# +# $FreeBSD:$ +# PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin user=%%BOINC_CLIENT_USER%% group=%%BOINC_CLIENT_GROUP%% -home=%%BOINC_CLIENT_HOME%% +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} +PRE-INSTALL) + if ! pw usershow ${user} 2>/dev/null 1>&2; then + if ! pw useradd ${user} -g ${group} -c "BOINC client user" \ + -d "${home}" -s ${shell}; then + echo "Failed to create user \"${user}\"." >&2 + exit 1 + else + echo "User \"${user}\" created successfully:" + fi else - echo "BOINC client user created." + echo "Using existent user \"${user}\":" 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} - ;; + pw usershow ${user} + mkdir -m u=rwx,go= -p "${home}" + if [ ! -e "${home}/skins" -a ! -L "${home}/skins" ]; then + ln -s "%%PREFIX%%/share/boinc/skins" "${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" + fi + echo "Adjusting file ownership in \"${home}\" to ${user}:${group}" + chown -hR ${user}:${group} "${home}" + ;; +*) + exit 64 + ;; esac + +exit 0 diff --git a/net/boinc-client/pkg-plist b/net/boinc-client/pkg-plist index 534e9fe2e322..6415a35d4fb0 100644 --- a/net/boinc-client/pkg-plist +++ b/net/boinc-client/pkg-plist @@ -448,6 +448,6 @@ lib/libboinc_zip.so.7 %%X11%%@dirrm share/boinc %%NLS%%@dirrmtry share/locale/sv_SE/LC_MESSAGES %%NLS%%@dirrmtry share/locale/sv_SE -%%USER%%@unexec if [ -d %%BOINC_CLIENT_HOME%% ]; then echo "If you are deinstalling boinc-client completely, remove the %%BOINC_CLIENT_HOME%% directory."; fi -%%USER%%@unexec if [ -d %%BOINC_CLIENT_HOME%% ]; then echo -n "Also, d"; else echo -n "D"; fi +%%USER%%@unexec if [ -d "%%BOINC_CLIENT_HOME%%" ]; then echo "If you are deinstalling boinc-client completely, remove the \"%%BOINC_CLIENT_HOME%%\" directory."; fi +%%USER%%@unexec if [ -d "%%BOINC_CLIENT_HOME%%" ]; then echo -n "Also, d"; else echo -n "D"; fi %%USER%%@unexec echo "on't forget to remove the BOINC client user \"%%BOINC_CLIENT_USER%%\"."