vdr/vdradmin/debian NEWS vdradmin.dirs postinst postrm README.Debian rules vdradmin.default vdradmin.init vdradmin.install

Thomas Schmidt pkg-vdr-dvb-changes@lists.alioth.debian.org
Sun, 23 Jan 2005 21:44:20 +0000


Update of /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian
In directory haydn:/tmp/cvs-serv12897/vdr/vdradmin/debian

Modified Files:
	postinst postrm README.Debian rules vdradmin.default 
	vdradmin.init vdradmin.install 
Added Files:
	NEWS vdradmin.dirs 
Log Message:
* cfgfiles under /var/lib/vdradmin to comply with FHS
* updated 02_sectmpfiles, to be able even when vdr runs as root and has our security-patch installed (still not the optimal solution, but it should work)

Index: vdradmin.install
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/vdradmin.install,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vdradmin.install	15 Aug 2004 19:02:52 -0000	1.2
+++ vdradmin.install	23 Jan 2005 21:44:18 -0000	1.3
@@ -13,6 +13,4 @@
 
 vdradmind.pl             usr/bin/
 
-debian/vdradmind.conf    etc/vdradmin/
-
 debian/vdradmind.pl.1    usr/share/man/man1/

Index: vdradmin.default
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/vdradmin.default,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- vdradmin.default	27 May 2004 14:56:51 -0000	1.1
+++ vdradmin.default	23 Jan 2005 21:44:18 -0000	1.2
@@ -8,11 +8,11 @@
 
 # Should vdradmin's init-script be enabled?
 
-#############################################################
-# ATTENTION! YOU SHOULD MODIFY /etc/vdradmin/vdradmind.conf #
-# before enabling this, because the default config uses a   # 
-# really simple default username/password (linvdr/linvdr)   #
-#############################################################
+#################################################################
+# ATTENTION! YOU SHOULD MODIFY /var/lib/vdradmin/vdradmind.conf #
+# before enabling this, because the default config uses a       #
+# really simple default username/password (linvdr/linvdr)       #
+#################################################################
 
 ENABLED="0"
 

Index: postinst
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/postinst,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- postinst	4 Jan 2005 21:13:44 -0000	1.4
+++ postinst	23 Jan 2005 21:44:18 -0000	1.5
@@ -9,17 +9,48 @@
 test -L $TEMPLATE_DIR/English/bilder || ln -s ../Deutsch/bilder $TEMPLATE_DIR/English/bilder
 test -L $TEMPLATE_DIR/French/bilder || ln -s ../Deutsch/bilder $TEMPLATE_DIR/French/bilder
 
+# Check if there are still cfgfiles in /etc/vdradmin/ and move them
+# to /var/lib/vdradmin
+if [ ! -f /var/lib/vdradmin/vdradmind.conf ]; then
+  if [ -f /etc/vdradmin/vdradmind.conf ]; then
+     mv /etc/vdradmin/vdradmind.conf /var/lib/vdradmin/
+  else
+     cp /usr/share/doc/vdradmin/examples/vdradmind.conf /var/lib/vdradmin/
+  fi
+fi
+
+[ -e /etc/vdradmin/vdradmind.conf ] || ln -s /var/lib/vdradmin/vdradmind.conf \
+/etc/vdradmin/vdradmind.conf
+
+if [ ! -f /var/lib/vdradmin/vdradmind.at ]; then
+  [ ! -f /etc/vdradmin/vdradmind.at ] || mv /etc/vdradmin/vdradmind.at /var/lib/vdradmin/
+fi
+
 # ensure that user and group 'vdradmin' exist
-adduser --system --home /dev/null --shell /bin/false --no-create-home \
-	--disabled-login --group vdradmin > /dev/null || true
+USER=vdradmin
+GROUP=vdradmin
+if ! getent group | grep -q "^$GROUP:" ; then
+	echo -n "Adding group $GROUP.."
+       	addgroup --quiet --system $GROUP
+       	echo "..done"
+fi
+if ! getent passwd | grep -q "^$USER:"; then
+	echo -n "Adding user $USER.."
+       	adduser --system --home /var/lib/vdradmin --shell /bin/false \
+		--gecos "VDRAdmin user" --no-create-home \
+               	--disabled-login --disabled-password \
+               	--ingroup $GROUP \
+               	$USER
+        echo "...done"
+fi
 
-# ensure that vdradmin's config has the correct owner
-[ ! -d /etc/vdradmin ] || chown -R vdradmin:vdradmin /etc/vdradmin/
+# ensure that vdradmin's config files have the correct owner
+[ ! -d /var/lib/vdradmin ] || chown -R $USER:$GROUP /var/lib/vdradmin/
 
 # change the permissions of the cfg-file to 0600
-[ ! -e /etc/vdradmin/vdradmind.conf ] || chmod 0600 /etc/vdradmin/vdradmind.conf
+[ ! -e /var/lib/vdradmin/vdradmind.conf ] || chmod 0600 /var/lib/vdradmin/vdradmind.conf
 
 # change the owner and group of the logfile to vdradmin
-[ ! -e /var/log/vdradmind.log ] || chown vdradmin:vdradmin /var/log/vdradmind.log
+[ ! -e /var/log/vdradmind.log ] || chown $USER:$GROUP /var/log/vdradmind.log
 	
 ##DEBHELPER##

Index: vdradmin.init
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/vdradmin.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vdradmin.init	4 Jan 2005 21:13:44 -0000	1.2
+++ vdradmin.init	23 Jan 2005 21:44:18 -0000	1.3
@@ -30,11 +30,28 @@
 
 set -e
 
+# Create Temporary Directory
+create_temp () 
+{
+	TEMPDIR=`mktemp -d -p /tmp vdradmin-XXXXXX`
+	
+   	# Check if the group vdr exists and make vdr 
+	# the owner of the temporary directory
+	if getent group | grep -q "^vdr:" ; then
+	   chown vdr $TEMPDIR
+        fi
+	
+	chgrp vdradmin $TEMPDIR
+	chmod 2770 $TEMPDIR
+}
+
 case "$1" in
   start)
 	echo -n "Starting $DESC: "
-		start-stop-daemon --start -c $USER:$GROUP -b -m --pidfile \
-		/var/run/vdradmin.pid --exec /usr/bin/vdradmind.pl -- -nf
+		create_temp
+		TEMPDIR=$TEMPDIR start-stop-daemon --start \
+		-c $USER:$GROUP -b -m --pidfile /var/run/vdradmin.pid \
+		--exec /usr/bin/vdradmind.pl -- -nf
 	echo "$NAME."
 	;;
   stop)
@@ -44,9 +61,11 @@
 	;;
   restart|force-reload)
 	echo -n "Restarting $DESC: "
+		create_temp
 		start-stop-daemon --stop -q -o --pidfile /var/run/vdradmin.pid
-	   	start-stop-daemon --start -c $USER:$GROUP -b -m --pidfile \
-		/var/run/vdradmin.pid --exec /usr/bin/vdradmind.pl -- -nf
+		TEMPDIR=$TEMPDIR start-stop-daemon --start \
+		-c $USER:$GROUP -b -m --pidfile /var/run/vdradmin.pid \
+		--exec /usr/bin/vdradmind.pl -- -nf
 	echo "$NAME."
 	;;
   *)

--- NEW FILE: NEWS ---
vdradmin (0.96-4) unstable; urgency=low

  The most important change in this release is that vdradmin from 
  now on will run under the username vdradmin, not as root, the 
  configfiles will be changed at installation, so they are owned by 
  the user and group vdradmin.

  We also changed the path of the files vdradmind.conf and vdradmind.at
  from /etc/vdradmin/ to /var/lib/vdradmin both files will be moved to 
  the new directory when they allready exist. The symlink 
  /etc/vdradmin/vdradmind.conf will be created so will find the cfgfile
  still under /etc/vdradmin.

 -- Thomas Schmidt <thomas.schmidt@in.stud.tu-ilmenau.de>  Sun, 23 Jan 2005 22:34:28 +0100

Index: rules
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/rules,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rules	4 Jan 2005 21:13:44 -0000	1.6
+++ rules	23 Jan 2005 21:44:18 -0000	1.7
@@ -25,6 +25,8 @@
 	dh_testdir
 	dh_testroot
 	dh_clean -k
+
+	dh_installdirs
 	
 # Build architecture-independent files here.
 binary-indep: install
@@ -32,7 +34,7 @@
 	dh_testroot
 	dh_installchangelogs HISTORY 
 	dh_installdocs
-	dh_installexamples
+	dh_installexamples debian/vdradmind.conf
 	dh_install
 	dh_installinit
 	dh_installman

--- NEW FILE: vdradmin.dirs ---
var/lib/vdradmin
etc/vdradmin

Index: postrm
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/postrm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- postrm	4 Jan 2005 21:13:44 -0000	1.1
+++ postrm	23 Jan 2005 21:44:18 -0000	1.2
@@ -3,7 +3,13 @@
 
 case "$1" in
     purge)
-    	deluser vdradmin > /dev/null || true
+ 	rm -f /var/lib/vdradmin/vdradmind.conf > /dev/null 2>&1 || true
+ 	rm -f /var/lib/vdradmin/vdradmind.at > /dev/null 2>&1 || true
+ 	rm -f /etc/vdradmin/vdradmind.conf > /dev/null 2>&1 || true
+
+    	chown root:root /var/log/vdradmind.log > /dev/null 2>&1 || true
+	
+	deluser vdradmin > /dev/null || true
     ;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
     ;;

Index: README.Debian
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdradmin/debian/README.Debian,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- README.Debian	15 Aug 2004 19:02:52 -0000	1.2
+++ README.Debian	23 Jan 2005 21:44:18 -0000	1.3
@@ -1,7 +1,7 @@
 vdradmin for Debian
 -------------------
 
-This package provides a working config-file under /etc/vdradmin/vdradmind.conf, 
+This package provides a working config-file under /var/lib/vdradmin/vdradmind.conf, 
 this files uses a standard-username and standard-password (linvdr/linvdr), you 
 should change this before you enable the vdradmin-service in 
 /etc/default/vdradmin, alternatively you can generate a new config with: