[Pkg-sysvinit-commits] r1376 - in sysvinit/trunk/debian: . patches

Petter Reinholdtsen pere at alioth.debian.org
Mon Jul 6 23:15:03 UTC 2009


Author: pere
Date: 2009-07-06 23:15:03 +0000 (Mon, 06 Jul 2009)
New Revision: 1376

Added:
   sysvinit/trunk/debian/patches/94_fstab-decode.dpatch
Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/patches/00list
   sysvinit/trunk/debian/rules
Log:
New patch 94_fstab-decode adding helper program fstab-decode to
sysvinit-utils.  Source from the initscripts package in Fedora.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2009-07-06 22:03:19 UTC (rev 1375)
+++ sysvinit/trunk/debian/changelog	2009-07-06 23:15:03 UTC (rev 1376)
@@ -22,6 +22,8 @@
     malloc().  Patch from Christian 'Dr. Disk' Hechelmann and Fedora.
   * New patch 46_pidof_symlinkman to improve pidof manual page regarding
     its handling of symlinks.  Patch from Bill Nottingham and Fedora.
+  * New patch 94_fstab-decode adding helper program fstab-decode to
+    sysvinit-utils.  Source from the initscripts package in Fedora.
 
  -- Petter Reinholdtsen <pere at debian.org>  Wed, 01 Jul 2009 20:04:20 +0200
 

Modified: sysvinit/trunk/debian/patches/00list
===================================================================
--- sysvinit/trunk/debian/patches/00list	2009-07-06 22:03:19 UTC (rev 1375)
+++ sysvinit/trunk/debian/patches/00list	2009-07-06 23:15:03 UTC (rev 1376)
@@ -46,3 +46,4 @@
 91_sulogin_lockedpw
 92_sata-hddown
 93_sulogin_fallback
+94_fstab-decode

Added: sysvinit/trunk/debian/patches/94_fstab-decode.dpatch
===================================================================
--- sysvinit/trunk/debian/patches/94_fstab-decode.dpatch	                        (rev 0)
+++ sysvinit/trunk/debian/patches/94_fstab-decode.dpatch	2009-07-06 23:15:03 UTC (rev 1376)
@@ -0,0 +1,168 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 94_fstab-decode.dpatch by Fedora
+
+Helper program lifted from Fedora to make it easier to handle
+/etc/mtab content.
+
+ at DPATCH@
+Index: sysvinit/src/fstab-decode.c
+===================================================================
+--- sysvinit/src/fstab-decode.c	(revision 0)
++++ sysvinit/src/fstab-decode.c	(revision 0)
+@@ -0,0 +1,86 @@
++/* fstab-decode(8).
++
++Copyright (c) 2006 Red Hat, Inc. All rights reserved.
++
++This copyrighted material is made available to anyone wishing to use, modify,
++copy, or redistribute it subject to the terms and conditions of the GNU General
++Public License v.2.
++
++This program is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++PARTICULAR PURPOSE. See the GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License along with
++this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
++Street, Fifth Floor, Boston, MA 02110-1301, USA.
++
++Author: Miloslav Trmac <mitr at redhat.com> */
++
++#include <errno.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
++/* Decode the fstab-encoded string in place. */
++static void
++decode(char *s)
++{
++	const char *src;
++	char *dest;
++
++	src = s;
++	dest = s;
++	while (*src != '\0') {
++		if (*src != '\\')
++			*dest = *src++;
++		else {
++			static const struct repl {
++				char orig[4];
++				size_t len;
++				char new;
++			} repls[] = {
++#define R(X, Y) { X, sizeof(X) - 1, Y }
++				R("\\", '\\'),
++				R("011", '\t'),
++				R("012", '\n'),
++				R("040", ' '),
++				R("134", '\\')
++#undef R
++			};
++
++			size_t i;
++
++			for (i = 0; i < sizeof (repls) / sizeof (repls[0]);
++			     i++) {
++				if (memcmp(src + 1, repls[i].orig,
++					   repls[i].len) == 0) {
++					*dest = repls[i].new;
++					src += 1 + repls[i].len;
++					goto found;
++				}
++			}
++			*dest = *src++;
++		found:
++			;
++		}
++		dest++;
++	}
++	*dest = '\0';
++}
++
++int
++main (int argc, char *argv[])
++{
++	size_t i;
++
++	if (argc < 2) {
++		fprintf(stderr, "Usage: fstab-decode command [arguments]\n");
++		return EXIT_FAILURE;
++	}
++	for (i = 2; i < (size_t)argc; i++)
++		decode(argv[i]);
++	execvp(argv[1], argv + 1);
++	fprintf(stderr, "fstab-decode: %s: %s\n", argv[1], strerror(errno));
++	return 127;
++}
+Index: sysvinit/src/Makefile
+===================================================================
+--- sysvinit/src/Makefile	(revision 1370)
++++ sysvinit/src/Makefile	(working copy)
+@@ -15,13 +15,13 @@
+ 
+ # For some known distributions we do not build all programs, otherwise we do.
+ BIN	=
+-SBIN	= init halt shutdown runlevel killall5
++SBIN	= init halt shutdown runlevel killall5 fstab-decode
+ USRBIN	= last mesg
+ 
+ MAN1	= last.1 lastb.1 mesg.1
+ MAN5	= initscript.5 inittab.5
+ MAN8	= halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
+-MAN8	+= shutdown.8 telinit.8
++MAN8	+= shutdown.8 telinit.8 fstab-decode.8
+ 
+ ifeq ($(DISTRO),)
+ BIN	+= mountpoint
+Index: sysvinit/man/fstab-decode.8
+===================================================================
+--- sysvinit/man/fstab-decode.8	(revision 0)
++++ sysvinit/man/fstab-decode.8	(revision 0)
+@@ -0,0 +1,45 @@
++.\" A man page for fstab-decode(8).
++.\"
++.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved.
++.\"
++.\" This copyrighted material is made available to anyone wishing to use,
++.\" modify, copy, or redistribute it subject to the terms and conditions of the
++.\" GNU General Public License v.2.
++.\"
++.\" This program is distributed in the hope that it will be useful, but WITHOUT
++.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
++.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 
++.\" more details.
++.\"
++.\" You should have received a copy of the GNU General Public License along
++.\" with this program; if not, write to the Free Software Foundation, Inc.,
++.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++.\"
++.\" Author: Miloslav Trmac <mitr at redhat.com>
++.TH fstab-decode 8 "May 2006"
++
++.SH NAME
++fstab-decode \- run a command with fstab-encoded arguments
++
++.SH SYNOPSIS
++\fB fstab-decode\fR \fICOMMAND\fR [\fIARGUMENT\fR]...
++
++.SH DESCRIPTION
++.B fstab-decode
++decodes escapes in the specified \FIARGUMENT\fRs
++and uses them to run \fICOMMAND\fR.
++The argument escaping uses the same rules as path escaping in
++\fB/etc/fstab\fR,
++.B /etc/mtab
++and \fB/proc/mtab\fR.
++
++.SH EXIT STATUS
++.B fstab-decode
++exits with status 127 if
++.I COMMAND
++can't be run.
++Otherwise it exits with the status returned by \fICOMMAND\fR.
++
++.SH EXAMPLES
++
++.B fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)


Property changes on: sysvinit/trunk/debian/patches/94_fstab-decode.dpatch
___________________________________________________________________
Added: svn:executable
   + *

Modified: sysvinit/trunk/debian/rules
===================================================================
--- sysvinit/trunk/debian/rules	2009-07-06 22:03:19 UTC (rev 1375)
+++ sysvinit/trunk/debian/rules	2009-07-06 23:15:03 UTC (rev 1376)
@@ -105,6 +105,7 @@
 endif
 	rm -f $(tmp)/usr/share/man/man8/killall5.8
 	rm -f $(tmp)/usr/share/man/man8/sulogin.8
+	rm -f $(tmp)/usr/share/man/man8/fstab-decode.8
 	rm -f $(tmp)/usr/share/man/man1/last.1
 	rm -f $(tmp)/usr/share/man/man1/lastb.1
 	rm -f $(tmp)/usr/share/man/man1/mesg.1
@@ -113,6 +114,7 @@
 	rm -f $(tmp)/usr/share/man/man1/mountpoint.1
 	rm -f $(tmp)/sbin/killall5
 	rm -f $(tmp)/sbin/sulogin
+	rm -f $(tmp)/sbin/fstab-decode
 	rm -f $(tmp)/usr/bin/last
 	rm -f $(tmp)/usr/bin/lastb
 	rm -f $(tmp)/usr/bin/mesg
@@ -151,6 +153,7 @@
 	install -d -o root -g root -m 755 $(tmp)/usr/share/man/man{1,8}
 	install -o root -g root -m 755 src/killall5 $(tmp)/sbin
 	install -o root -g root -m 755 src/sulogin $(tmp)/sbin
+	install -o root -g root -m 755 src/fstab-decode $(tmp)/sbin
 	install -o root -g root -m 755 src/last $(tmp)/usr/bin
 	install -o root -g root -m 755 src/mesg $(tmp)/usr/bin
 	$(MAKE) $(CROSS) -C debian/startpar DESTDIR=$(tmp) install
@@ -169,6 +172,7 @@
 	install -o root -g root -m 644 man/mesg.1 $(tmp)/usr/share/man/man1
 	install -o root -g root -m 644 debian/service/service.8 $(tmp)/usr/share/man/man8
 	install -o root -g root -m 644 man/pidof.8 $(tmp)/usr/share/man/man8
+	install -o root -g root -m 644 man/fstab-decode.8 $(tmp)/usr/share/man/man8
 	gzip -9f $(tmp)/usr/share/man/man*/*.[0-9]
 	install -o root -g root -m 644 debian/copyright \
 	  $(tmp)$(doc)/sysvinit-utils/copyright




More information about the Pkg-sysvinit-commits mailing list