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

Re: [PATCH] netplug - Allow to specify custom script file via param '-s'



Hello,

Brian, could you please clarify the state of the upstream development?
(See below.)

On Sat, 23 Mar 2013 08:58:20 +0100
Philipp Matthias Hahn <pmhahn@pmhahn.de> wrote:

> On Fri, Mar 22, 2013 at 07:55:56AM +0100, Raphael Hertzog wrote:
> > There is: you can use experimental to continue working on the
> > package until the wheezy release. Or you can accumulate stuff in
> > the VCS.

> I know.

> > > So your patch will just stay in the BTS until I find some time to
> > > work the netplug again, which is very low on my current priority
> > > list.

> > It's not a very rewarding answer to someone who invested time in
> > your package...

> > When I am in a similar situation, I tend to offer the person to
> > join as co-maintainer. The patch is not very long and it should not
> > be too hard to review. Or you can redirect him towards upstream if
> > that's better.
> 
> Upstream is dead: <http://hg.serpentine.com/netplug> 2010-06-26
> So basically I would need to maintain that patch ad infinitum.
> And currently I don't have the time to become a new upstream, so my
> rather harsh reply.

-- 
WBR, Andrew
diff -r aaebd52fac19 lib.c
--- a/lib.c	Sat Jun 26 09:36:45 2010 -0700
+++ b/lib.c	Sat Mar 02 02:38:19 2013 +0100
@@ -29,6 +29,7 @@
 
 #include "netplug.h"
 
+const char *script_file = NP_SCRIPT_DIR "/netplug";
 
 void
 do_log(int pri, const char *fmt, ...)
@@ -109,11 +110,11 @@
     setpgrp();                  /* become group leader */
 
     do_log(LOG_INFO, "%s %s %s -> pid %d",
-           NP_SCRIPT, ifname, action, getpid());
+           script_file, ifname, action, getpid());
 
-    execl(NP_SCRIPT, NP_SCRIPT, ifname, action, NULL);
+    execl(script_file, script_file, ifname, action, NULL);
 
-    do_log(LOG_ERR, NP_SCRIPT ": %m");
+    do_log(LOG_ERR, "%s: %m", script_file);
     exit(1);
 }
 
diff -r aaebd52fac19 main.c
--- a/main.c	Sat Jun 26 09:36:45 2010 -0700
+++ b/main.c	Sat Mar 02 02:38:19 2013 +0100
@@ -91,7 +91,7 @@
 static void
 usage(char *progname, int exitcode)
 {
-    fprintf(stderr, "Usage: %s [-DFP] [-c config-file] [-i interface] [-p pid-file]\n",
+    fprintf(stderr, "Usage: %s [-DFP] [-c config-file] [-s script-file] [-i interface] [-p pid-file]\n",
             progname);
 
     fprintf(stderr, "\t-D\t\t"
@@ -102,6 +102,8 @@
             "do not autoprobe for interfaces (use with care)\n");
     fprintf(stderr, "\t-c config_file\t"
             "read interface patterns from this config file\n");
+    fprintf(stderr, "\t-s script_file\t"
+            "script file for probing interfaces, bringing them up or down\n");
     fprintf(stderr, "\t-i interface\t"
             "only handle interfaces matching this pattern\n");
     fprintf(stderr, "\t-p pid_file\t"
@@ -219,7 +221,7 @@
     int probe = 1;
     int c;
 
-    while ((c = getopt(argc, argv, "DFPc:hi:p:")) != EOF) {
+    while ((c = getopt(argc, argv, "DFPc:s:hi:p:")) != EOF) {
         switch (c) {
         case 'D':
             debug = 1;
@@ -234,6 +236,9 @@
             read_config(optarg);
             cfg_read = 1;
             break;
+        case 's':
+            script_file = optarg;
+            break;
         case 'h':
             fprintf(stderr, "netplugd version %s\n", NP_VERSION);
             usage(argv[0], 0);
diff -r aaebd52fac19 man/man8/netplugd.8
--- a/man/man8/netplugd.8	Sat Jun 26 09:36:45 2010 -0700
+++ b/man/man8/netplugd.8	Sat Mar 02 02:38:19 2013 +0100
@@ -19,6 +19,7 @@
 .Nm netplugd
 .Op Fl FP
 .Op Fl c Ar config_file
+.Op Fl s Ar script_file
 .Op Fl i Ar interface_pattern
 .Op Fl p Ar pid_file
 .\"
@@ -117,6 +118,9 @@
 .Pa /dev/null
 as a config file.
 .\"
+.It Fl s Ar script_file
+Specify an alternative script file path, override /etc/netplug.d/netplug
+.\"
 .It Fl i Ar interface_pattern
 Specify a pattern that will be used to match interface names that
 .Nm
diff -r aaebd52fac19 netplug.h
--- a/netplug.h	Sat Jun 26 09:36:45 2010 -0700
+++ b/netplug.h	Sat Mar 02 02:38:19 2013 +0100
@@ -26,8 +26,6 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#define NP_SCRIPT NP_SCRIPT_DIR "/netplug"
-
 /* configuration */
 
 void read_config(char *filename);
@@ -37,6 +35,8 @@
 void probe_interfaces(void);
 void close_on_exec(int fd);
 
+extern const char *script_file;
+
 extern int debug;
 
 /* netlink interfacing */

Attachment: signature.asc
Description: PGP signature


Reply to: