[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NEW: GkrellM2 family




Hi Peter,

>>>>> "PH" == "Peter Hessler" <phessler@sfobug.org>:
PH> The server module of GkrellM2 is an optional flavor, install with 
PH> FLAVOR="server".  The server depends on glib1, as opposed to glib2.  
PH> I have *NOT* audited the server module for security, as I am not very 
PH> familiar with C.
PH> 
PH> Updated tarball is avaliable at 
PH> [http://www.theapt.org/openbsd/gkrellm2.tar.gz]

The following diff does the following for just the gkrellm2/gkrellm2 part
of the above tarball (even though i've been looking at the source for the
server i'm not yet ready to put any patches forward for that):

* adds devel/pkgconfg as a build depend for gkrellm2
* removes the server FLAVOR, instead it uses a MULTI_PACKAGES method so
  just the server on a remote machine without needing gkrellm2
  NOTE: this is my first MULTI_PACKAGE work, if there is something I've
  done wrong please let me know
* make server use glib2 rather than glib1
* install server to $LOCALBASE/sbin rather then $LOCALBASE/bin
* add INSTALL/DEINSTALL scrips for gkrellm-server so that the daemon
  can have it's own user and group to run as.  It also prints a message
  about starting gkrellmd from rc.local with those user and group settings
  (do note that I'm not yet entirely sure this will help yet as gkrellmd is
  installed setgid kmem, which I'm looking at).

Also, I've noticed that there are elements in each of the sysutils/gkrellm2
subdirs Makefiles that might be movable to a sysutils/gkrellm2/Makefile.inc
file, but that's just a suggestion.

Enjoy,  please comment if I've gone off track along the way.

-dan

------------%< snip %<----------------------%< snip %<------------

diff -Nurp gkrellm2.orig/Makefile gkrellm2/Makefile
--- gkrellm2.orig/Makefile	Wed Feb  5 18:18:53 2003
+++ gkrellm2/Makefile	Sun Feb  9 17:36:04 2003
@@ -5,6 +5,7 @@ COMMENT-server=	"GkrellM2 server module"
 
 VERSION=	2.1.7a
 DISTNAME=	gkrellm-${VERSION}
+PKGNAME-server= gkrellm-server-${VERSION}
 CATEGORIES=	sysutils gkrellm2
 
 HOMEPAGE=	http://www.gkrellm.net/
@@ -23,23 +24,23 @@ USE_GMAKE=	Yes
 NOT_FOR_ARCHS=	${NO_SHARED_ARCHS}
 NO_REGRESS=	Yes
 
-FLAVORS=	server
-FLAVOR?=
+SUBPACKAGE?=
+MULTI_PACKAGES=	-server
 
-.if ${FLAVOR:L} == "server"
-PKGNAME-server= gkrellm2-server-${VERSION}
-LIB_DEPENDS=	glib.1.2,gmodule.1.2::devel/glib
-WRKSRC=		${WRKDIST}/server
-ALL_TARGET=	netbsd
-INSTALL_TARGET=	install_netbsd
-.else
-PKGNAME=	gkrellm2-${VERSION}
 LIB_DEPENDS=	gthread-2.0.0.0::devel/glib2 \
-		gdk-x11-2.0.0.0,gdk_pixbuf-2.0.0.0,gtk-x11-2.0.0.0::x11/gtk+2
+				gdk-x11-2.0.0.0,gdk_pixbuf-2.0.0.0,gtk-x11-2.0.0.0::x11/gtk+2
+BUILD_DEPENDS=	:pkgconfig-*:devel/pkgconfig
 USE_X11=	Yes
+
+.if defined(PACKAGING)
+. if ${SUBPACKAGE} == "-server"
+LIB_DEPENDS=	gthread-2.0.0.0::devel/glib2 \
+#RUN_DEPENDS=	::sysutils/gkrellm2/gkrellm2
+. endif
+.endif
+
 ALL_TARGET=	openbsd
 INSTALL_TARGET=	install_openbsd
-.endif
 
 pre-extract:
 	@if [ -f ${LOCALBASE}/include/gkrellm/gkrellm.h ]; then \
diff -Nurp gkrellm2.orig/patches/patch-Makefile gkrellm2/patches/patch-Makefile
--- gkrellm2.orig/patches/patch-Makefile	Fri Jan  3 21:18:09 2003
+++ gkrellm2/patches/patch-Makefile	Sun Feb  9 16:17:27 2003
@@ -1,14 +1,15 @@
 $OpenBSD$
---- Makefile.orig	Tue Oct 29 15:59:35 2002
-+++ Makefile	Fri Jan  3 18:17:50 2003
+--- Makefile.orig	Tue Oct 29 18:59:35 2002
++++ Makefile	Sun Feb  9 16:16:52 2003
 @@ -74,17 +74,17 @@ BINMODE = 755
  #GTOP_LIBS_D = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps
  #export GTOP_INCLUDE GTOP_LIBS GTOP_LIBS_D
  
 -INSTALLDIR = /usr/local/bin
-+INSTALLDIR = ${PREFIX}/bin
- SINSTALLDIR = $(INSTALLDIR)
+-SINSTALLDIR = $(INSTALLDIR)
 -MANDIR = /usr/local/share/man/man1
++INSTALLDIR = ${PREFIX}/bin
++SINSTALLDIR = ${PREFIX}/sbin
 +MANDIR = ${PREFIX}/man/man1
  SMANDIR = $(MANDIR)
  MANMODE = 644
@@ -23,16 +24,7 @@ $OpenBSD$
  
  OS_NAME=$(shell uname -s)
  OS_RELEASE=$(shell uname -r)
-@@ -120,6 +120,8 @@ install_netbsd:
- install_openbsd:
- 	(cd po && ${MAKE} install)
- 	(cd src && ${MAKE} install_openbsd)
-+
-+install_openbsd_server:
- 	(cd server && ${MAKE} install_openbsd)
- 
- install_solaris:
-@@ -161,17 +163,19 @@ darwin:
+@@ -161,11 +161,11 @@ darwin:
  netbsd:
  	(cd po && ${MAKE} all)
  	(cd src && ${MAKE} \
@@ -48,11 +40,12 @@ $OpenBSD$
  
  openbsd:
  	(cd po && ${MAKE} all)
- 	(cd src && ${MAKE} \
- 		PTHREAD_INC=-I${PREFIX}/include EXTRAOBJS= \
+@@ -174,7 +174,7 @@ openbsd:
  		SYS_LIBS="-lkvm -pthread" gkrellm )
-+
-+openbsd_server:
  	(cd server && ${MAKE} \
  		PTHREAD_INC=-I${PREFIX}/include EXTRAOBJS= \
- 		SYS_LIBS="-lkvm -pthread" gkrellmd )
+-		SYS_LIBS="-lkvm -pthread" gkrellmd )
++		SYS_LIBS="-lkvm -lintl -pthread" gkrellmd )
+ 
+ solaris:
+ 	(cd po && ${MAKE} MSGFMT_OPT="-v -o" \
diff -Nurp gkrellm2.orig/patches/patch-server_Makefile gkrellm2/patches/patch-server_Makefile
--- gkrellm2.orig/patches/patch-server_Makefile	Fri Jan 24 00:52:56 2003
+++ gkrellm2/patches/patch-server_Makefile	Sun Feb  9 16:53:26 2003
@@ -1,6 +1,6 @@
 $OpenBSD$
---- server/Makefile.orig	Mon Dec 16 12:53:28 2002
-+++ server/Makefile	Thu Jan 23 21:52:28 2003
+--- server/Makefile.orig	Mon Dec 16 15:53:28 2002
++++ server/Makefile	Sun Feb  9 16:52:49 2003
 @@ -1,13 +1,12 @@
  PACKAGE_D ?= gkrellmd
  PKG_CONFIG ?= pkg-config
@@ -26,15 +26,16 @@ $OpenBSD$
 -ifeq ($(glib12),1)
 -FLAGS = -O2 -I.. $(GLIB12_INCLUDE) $(GTOP_INCLUDE)
 -endif
-+CFLAGS+= -I.. $(GLIB12_INCLUDE) $(GTOP_INCLUDE)
++CFLAGS+= -I.. $(PKG_INCLUDE) $(GTOP_INCLUDE)
  
 -FLAGS+= $(PTHREAD_INC)
 +CFLAGS+= $(PTHREAD_INC)
  
 -LIBS = $(PKG_LIB) $(GTOP_LIBS_D) $(SYS_LIBS) 
 -ifeq ($(glib12),1)
- LIBS = $(GLIB12_LIB) $(GTOP_LIBS_D) $(SYS_LIBS)
+-LIBS = $(GLIB12_LIB) $(GTOP_LIBS_D) $(SYS_LIBS)
 -endif
++LIBS = $(PKG_LIB) $(GTOP_LIBS_D) $(SYS_LIBS)
  
  ifeq ($(debug),1)
      FLAGS += -g
@@ -60,11 +61,15 @@ $OpenBSD$
  
  OS_NAME=$(shell uname -s)
  OS_RELEASE=$(shell uname -r)
-@@ -74,7 +67,7 @@ darwin: 
+@@ -74,7 +67,11 @@ darwin: 
  		LINK_FLAGS="-flat_namespace -undefined warning" gkrellmd
  
  netbsd:
 -	$(MAKE) PTHREAD_INC=-I/usr/local/include \
++	$(MAKE) PTHREAD_INC=-I${PREFIX}/include \
++	GTK_CONFIG=gtk-config EXTRAOBJS= SYS_LIBS="-lkvm" gkrellmd
++
++openbsd:
 +	$(MAKE) PTHREAD_INC=-I${PREFIX}/include \
  	GTK_CONFIG=gtk-config EXTRAOBJS= SYS_LIBS="-lkvm" gkrellmd
  
diff -Nurp gkrellm2.orig/patches/patch-server_gkrellmd_h gkrellm2/patches/patch-server_gkrellmd_h
--- gkrellm2.orig/patches/patch-server_gkrellmd_h	Thu Jan  9 00:52:07 2003
+++ gkrellm2/patches/patch-server_gkrellmd_h	Sun Feb  9 16:08:35 2003
@@ -1,7 +1,7 @@
 $OpenBSD$
---- server/gkrellmd.h.orig	Wed Jan  8 17:04:25 2003
-+++ server/gkrellmd.h	Wed Jan  8 21:51:41 2003
-@@ -141,9 +141,11 @@ extern int	errno;
+--- server/gkrellmd.h.orig	Wed Jan 29 13:26:32 2003
++++ server/gkrellmd.h	Sun Feb  9 16:03:00 2003
+@@ -143,9 +143,11 @@ extern int	errno;
  #define GKRELLMD_CONFIG     "gkrellmd.conf"
  
  #if !defined(WIN32)
diff -Nurp gkrellm2.orig/patches/patch-src_Makefile gkrellm2/patches/patch-src_Makefile
--- gkrellm2.orig/patches/patch-src_Makefile	Fri Jan  3 21:18:09 2003
+++ gkrellm2/patches/patch-src_Makefile	Sun Feb  9 16:14:13 2003
@@ -1,6 +1,6 @@
 $OpenBSD$
---- src/Makefile.orig	Thu Nov 21 08:02:33 2002
-+++ src/Makefile	Fri Jan  3 18:17:50 2003
+--- src/Makefile.orig	Thu Nov 21 11:02:33 2002
++++ src/Makefile	Sun Feb  9 16:10:45 2003
 @@ -2,15 +2,15 @@ PACKAGE ?= gkrellm
  PKG_CONFIG ?= pkg-config
  EXTRAOBJS ?= md5c.o
@@ -39,13 +39,3 @@ $OpenBSD$
  
  OBJS =	main.o alerts.o battery.o base64.o clock.o cpu.o disk.o fs.o \
  	hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o \
-@@ -74,6 +74,9 @@ darwin: 
- netbsd:
- 	$(MAKE) PTHREAD_INC=-I/usr/local/include \
- 		EXTRAOBJS= SYS_LIBS="-lkvm" gkrellm
-+
-+openbsd:
-+       $(MAKE) GTK_CONFIG=gtk-config GTOP_LIBS= SYS_LIBS="-lkvm -pthread" gkrellm
- 
- openbsd:
- 	$(MAKE) GTK_CONFIG=gtk-config GTOP_LIBS= SYS_LIBS="-lkvm -pthread" gkrellm
diff -Nurp gkrellm2.orig/pkg/DEINSTALL-server gkrellm2/pkg/DEINSTALL-server
--- gkrellm2.orig/pkg/DEINSTALL-server	Wed Dec 31 19:00:00 1969
+++ gkrellm2/pkg/DEINSTALL-server	Sun Feb  9 17:42:29 2003
@@ -0,0 +1,23 @@
+#!/bin/sh
+# $OpenBSD: $
+#
+# gkrellm-server de-installation
+
+set -e
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PREFIX=${PKG_PREFIX:-/usr/local}
+
+echo
+echo "+---------------"
+echo "| To completely deinstall the $1 package you need to perform"
+echo "| these steps as root:"
+echo "|"
+echo "|           rmuser _gkrellmd"
+echo "|           rmuser _gkrellmd"
+echo "|"
+echo "| You can skip these steps if you plan on re-installing"
+echo "| $1 at some future time."
+echo "+---------------"
+echo
+
+exit 0
diff -Nurp gkrellm2.orig/pkg/DESCR-server gkrellm2/pkg/DESCR-server
--- gkrellm2.orig/pkg/DESCR-server	Wed Dec 31 19:00:00 1969
+++ gkrellm2/pkg/DESCR-server	Sun Feb  9 15:48:51 2003
@@ -0,0 +1 @@
+GKrellM2 server to use on remote machines.
diff -Nurp gkrellm2.orig/pkg/INSTALL-server gkrellm2/pkg/INSTALL-server
--- gkrellm2.orig/pkg/INSTALL-server	Wed Dec 31 19:00:00 1969
+++ gkrellm2/pkg/INSTALL-server	Sun Feb  9 17:47:04 2003
@@ -0,0 +1,66 @@
+#!/bin/sh
+# $OpenBSD: $
+# gkrellm-server install script
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PREFIX=${PKG_PREFIX:-/usr/local}
+GKRELLMDUSER=_gkrellmd
+GKRELLMDGROUP=_gkrellmd
+
+do_install_usergroup()
+{
+  # create privoxy user and group
+  groupinfo -e $GKRELLMDGROUP
+  if [ $? -eq 0 ]; then
+    echo "===> Using $GKRELLMDGROUP group for Gkrellm Server"
+  else
+    echo "===> Creating $GKRELLMDGROUP group for Gkrellm Server"
+    groupadd $GKRELLMDGROUP
+  fi
+  userinfo -e $GKRELLMDUSER
+  if [ $? -eq 0 ]; then
+    echo "===> Using $GKRELLMDUSER user for Gkrellm Server"
+  else
+    echo "===> Creating $GKRELLMDUSER user for Gkrellm Server"
+    useradd -g $GKRELLMDGROUP -d /nonexistent -L daemon -c 'Gkrellm Server Account' -s /sbin/nologin $GKRELLMDUSER
+  fi
+}
+
+do_message()
+{
+    echo
+    echo "+---------------"
+    echo "| You will need to edit /etc/rc.local as appropriate and add a"
+    echo "| section similiar to the following:"
+    echo "|"
+    echo "|     if [ -x ${PREFIX}/sbin/gkrellmd ]; then"
+    echo "|             echo -n ' gkrellmd';"
+    echo "|             ${PREFIX}/sbin/gkrellmd -U $GKRELLMDUSER -G $GKRELLMDGROUP"
+    echo "|     fi"
+    echo "+---------------"
+    echo
+}
+
+# verify proper execution
+#
+if [ $# -ne 2 ]; then
+    echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
+    exit 1
+fi
+
+# Verify/process the command
+#
+case $2 in
+    PRE-INSTALL)
+	do_install_usergroup
+	;;
+    POST-INSTALL)
+	do_message
+	;;
+    *)
+	echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff -Nurp gkrellm2.orig/pkg/PLIST-server gkrellm2/pkg/PLIST-server
--- gkrellm2.orig/pkg/PLIST-server	Thu Jan 23 22:58:11 2003
+++ gkrellm2/pkg/PLIST-server	Sun Feb  9 16:19:31 2003
@@ -1,3 +1,3 @@
 @comment $OpenBSD$
-bin/gkrellmd
+sbin/gkrellmd
 man/man1/gkrellmd.1