Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Oct 2012 19:22:10 +0000 (UTC)
From:      Pav Lucistnik <pav@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r306088 - in head/net/boinc-client: . files
Message-ID:  <201210181922.q9IJMATY006365@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pav
Date: Thu Oct 18 19:22:09 2012
New Revision: 306088
URL: http://svn.freebsd.org/changeset/ports/306088

Log:
  - Fix build with clang
  - Change BOINC_CLIENT_HOME ownership only for owner
  - Fixes to rc script
  - Allow for spaces in paths
  
  PR:		ports/171569
  Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
  Feature safe:	yes

Added:
  head/net/boinc-client/files/patch-zip-unzip-extract.c   (contents, props changed)
Modified:
  head/net/boinc-client/Makefile
  head/net/boinc-client/files/boinc-client.in
  head/net/boinc-client/files/pkg-install.in
  head/net/boinc-client/pkg-plist

Modified: head/net/boinc-client/Makefile
==============================================================================
--- head/net/boinc-client/Makefile	Thu Oct 18 19:21:20 2012	(r306087)
+++ head/net/boinc-client/Makefile	Thu Oct 18 19:22:09 2012	(r306088)
@@ -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 <bsd.port.post.mk>

Modified: head/net/boinc-client/files/boinc-client.in
==============================================================================
--- head/net/boinc-client/files/boinc-client.in	Thu Oct 18 19:21:20 2012	(r306087)
+++ head/net/boinc-client/files/boinc-client.in	Thu Oct 18 19:22:09 2012	(r306088)
@@ -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}"
+load_rc_config ${name}
+: ${boinc_client_enable="NO"}
 
-active_file="/var/run/${name}.active"
+command="%%PREFIX%%/bin/boinc_client"
+pidfile="/var/run/${name}.pid"
 
-load_rc_config $name
-: ${boinc_client_enable="NO"}
+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}
+	local pid
+
+	pid=$(check_pidfile "${pidfile}" "${command}")
+	if [ -n "${pid}" ]; then
+		echo 1>&2 "${name} already running? (pid=${pid})."
+		return 1
 	fi
+	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_stop()
+boinc_client_poststop()
 {
-	if [ ! -f ${active_file} ]; then
-		echo 1>&2 "${name} is not running."
-		return 1
-	fi
-	echo "Stopping ${name}."
-	su - ${boinc_client_user} -c \
-	    "cd ${boinc_client_home} && %%PREFIX%%/bin/boinccmd --quit"
-	rm ${active_file}
+	rm -f "${pidfile}"
 }
 
 run_rc_command "$1"

Added: head/net/boinc-client/files/patch-zip-unzip-extract.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/boinc-client/files/patch-zip-unzip-extract.c	Thu Oct 18 19:22:09 2012	(r306088)
@@ -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";

Modified: head/net/boinc-client/files/pkg-install.in
==============================================================================
--- head/net/boinc-client/files/pkg-install.in	Thu Oct 18 19:21:20 2012	(r306087)
+++ head/net/boinc-client/files/pkg-install.in	Thu Oct 18 19:22:09 2012	(r306088)
@@ -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

Modified: head/net/boinc-client/pkg-plist
==============================================================================
--- head/net/boinc-client/pkg-plist	Thu Oct 18 19:21:20 2012	(r306087)
+++ head/net/boinc-client/pkg-plist	Thu Oct 18 19:22:09 2012	(r306088)
@@ -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%%\"."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210181922.q9IJMATY006365>