Am 06.06.2014 13:42, schrieb Axel Beckert:
Hi Alex,

Alexander Bech wrote:

It is a feature that does not work.
Yes. A feature which is rather incompatible with the concept of
packaging. And incompatible with multiple architectures, too.

The problem could possibly be solved by adding this to the
xymon-client.postinst:

chown -R xymon:xymon /usr/lib/xymon
chown -R xymon:xymon /etc/xymon
Nope, that would violate multiple sections of the Debian Policy.
Basically /usr/lib/ is just for packaged contents and should only be
changed by package updates.

If that feature is used in conjunction with the Debian package, all
downloaded files should go somewhere else, e.g. to
/usr/local/lib/xymon/ or maybe even somewhere under /var/run/xymon/.
Or /var/lib/xymon ?
CLIENTUPDATEHOME
/var/lib/xymon would be no issue, as it's meant for "variable" data.
/var/tmp/ neither.

                Regards, Axel
Hi Axel,

here is a patch that makes clientupdate work without violation of the Debian Policy.

Short description:
- The variable CLIENTUPDATEHOME is defined In xymonclient.cfg
- clientupdate makes his work here
- clientlaunch.cfg and xymonclient.cfg read what to do here.


Accepted?

Thank you,
Alex

diff -u orig/clientlaunch.cfg ./clientlaunch.cfg
--- orig/clientlaunch.cfg	2014-05-20 23:34:24.000000000 +0200
+++ ./clientlaunch.cfg	2014-06-07 01:49:49.349698759 +0200
@@ -26,4 +26,9 @@
 	LOGFILE $XYMONCLIENTLOGS/xymonclient.log
 	INTERVAL 5m
 
-include /var/run/xymon/clientlaunch-include.cfg
+#include /var/run/xymon/clientlaunch-include.cfg  # deprecated. xymonlaunch can read a directory.
+
+# first search and load tasks from /etc/xymon/clientlaunch.d
+directory /etc/xymon/clientlaunch.d
+# later search for task definitions in $CLIENTUPDATEHOME. Existing tasks can be redefined here.
+directory /var/lib/xymon/client/etc/clientlaunch.d
diff -u orig/clientupdate.c ./clientupdate.c
--- orig/clientupdate.c	2012-07-16 13:08:37.000000000 +0200
+++ ./clientupdate.c	2014-06-06 22:59:21.201698759 +0200
@@ -57,8 +57,8 @@
 	drop_root_and_removesuid(argv[0]);
 #endif
 
-	versionfn = (char *)malloc(strlen(xgetenv("XYMONHOME")) + strlen(CLIENTVERSIONFILE) + 2);
-	sprintf(versionfn, "%s/%s", xgetenv("XYMONHOME"), CLIENTVERSIONFILE);
+	versionfn = (char *)malloc(strlen(xgetenv("CLIENTUPDATEHOME")) + strlen(CLIENTVERSIONFILE) + 2);
+	sprintf(versionfn, "%s/%s", xgetenv("CLIENTUPDATEHOME"), CLIENTVERSIONFILE);
 	inprogressfn = (char *)malloc(strlen(xgetenv("XYMONHOME")) + strlen(INPROGRESSFILE) + 2);
 	sprintf(inprogressfn, "%s/%s", xgetenv("XYMONHOME"), INPROGRESSFILE);
 
@@ -73,8 +73,8 @@
 		*version = '\0';
 	}
 
-	if (chdir(xgetenv("XYMONHOME")) != 0) {
-		errprintf("Cannot chdir to XYMONHOME\n");
+	if (chdir(xgetenv("CLIENTUPDATEHOME")) != 0) {
+		errprintf("Cannot chdir to CLIENTUPDATEHOME\n");
 		return 1;
 	}
 
Nur in .: clientupdate-patch.txt.
Nur in .: orig.
diff -u orig/postinst ./postinst
--- orig/postinst	2014-06-06 21:09:00.000000000 +0200
+++ ./postinst	2014-06-06 23:03:33.653698759 +0200
@@ -54,8 +54,15 @@
 	test -d /var/run/xymon || mkdir /var/run/xymon
 	chown xymon:xymon /var/run/xymon
 
+	test -d /var/lib/xymon || mkdir /var/lib/xymon
+	test -d /var/lib/xymon/client || mkdir /var/lib/xymon/client
+	test -d /var/lib/xymon/client/etc || mkdir /var/lib/xymon/client/etc
+	test -d /var/lib/xymon/client/etc/clientlaunch.d || mkdir /var/lib/xymon/client/etc/clientlaunch.d
+	test -d /var/lib/xymon/client/etc/xymonclient.d || mkdir /var/lib/xymon/client/etc/xymonclient.d
+	test -d /var/lib/xymon/client/ext || mkdir /var/lib/xymon/client/ext
+	test -d /var/lib/xymon/client/local || mkdir /var/lib/xymon/client/local
 	test -d /var/lib/xymon/tmp || mkdir /var/lib/xymon/tmp
-	chown xymon:xymon /var/lib/xymon/tmp
+	chown -R xymon:xymon /var/lib/xymon
 
 	test -d /var/log/hobbit -a ! -d /var/log/xymon && mv -v /var/log/hobbit /var/log/xymon || true
 	test -d /var/log/xymon || mkdir /var/log/xymon
diff -u orig/xymonclient.cfg ./xymonclient.cfg
--- orig/xymonclient.cfg	2014-05-20 23:34:24.000000000 +0200
+++ ./xymonclient.cfg	2014-06-07 01:51:17.029698759 +0200
@@ -15,7 +15,10 @@
 XYMONTMP="/var/lib/xymon/tmp"     # Where we may store temporary files.
 XYMONCLIENTLOGS="/var/log/xymon"  # Where we store the client logfiles
 
-include /var/run/xymon/xymonclient-include.cfg
+#include /var/run/xymon/xymonclient-include.cfg   # Deprecated. xymonlaunch can read directories.
+
+# Directory for for updating an existing client installation from a central repository stored on the Xymon server.
+CLIENTUPDATEHOME="/var/lib/xymon/client"
 
 # Compatibility settings
 HOBBITCLIENTHOME="$XYMONCLIENTHOME"
@@ -66,3 +69,11 @@
 PS="ps ax"
 
 MAXLINE="32768"
+
+# These lines must appear at the end
+# Load additional settings from .cfg files from /etc/xymon/xymonclient.d
+directory /etc/xymon/xymonclient.d
+
+# Later load settings ftom .cfg files in $CLIENTUPDATEHOME. Existing settings can be redefined here.
+directory /var/lib/xymon/client/etc/xymonclient.d
+
diff -u orig/xymonclient.sh ./xymonclient.sh
--- orig/xymonclient.sh	2013-07-23 14:20:59.000000000 +0200
+++ ./xymonclient.sh	2014-06-07 01:54:55.649698759 +0200
@@ -74,6 +74,18 @@
 	done
 fi
 
+# See if there are also any from central server installed local add-ons
+if test -d $XYMONHOME/local; then
+	for MODULE in $CLIENTUPDATEHOME/local/*
+	do
+		if test -x $MODULE
+		then
+			echo "[plugin:`basename $MODULE`]" >>$MSGTMPFILE
+			$MODULE >>$MSGTMPFILE
+		fi
+	done
+fi
+
 # System clock
 echo "[clock]"          >> $MSGTMPFILE
 $XYMONHOME/bin/logfetch --clock >> $MSGTMPFILE

Reply via email to