]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
ibod: Add patch for configuration cli, add systemd file.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 11 Nov 2011 20:12:16 +0000 (21:12 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 12 Nov 2011 16:43:25 +0000 (17:43 +0100)
Fixes #285.
Add a patch to add the option to specify the used config file.

ibod/ibod.nm
ibod/patches/ibod-1.4-configuration-cli.patch [new file with mode: 0644]
ibod/systemd/ibod@.service [new file with mode: 0644]

index 5827b184764c5808eeec45592d0fccdb12811efc..84f41117d9748bffb073ddbff05fd48b42048735 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = ibod
 version    = 1.4
-release    = 1
+release    = 2
 
 groups     = Networking/Tools
 url        = http://www.datenwelt.net/oss/ibod/
@@ -40,5 +40,23 @@ packages
                configfiles
                        /etc/isdn/ibod.cf
                end
+
+               prerequires += systemd-units
+
+               # There isn't any chance at the moment to determine the names of
+               # spawned instances by a systemd service file.
+               #
+               # So we aren't able to stop any ibod process before uninstalling the package. 
+               script postin
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
        end
 end
diff --git a/ibod/patches/ibod-1.4-configuration-cli.patch b/ibod/patches/ibod-1.4-configuration-cli.patch
new file mode 100644 (file)
index 0000000..656d479
--- /dev/null
@@ -0,0 +1,74 @@
+Author: Michael Tremer <michael.tremer@ipfire.org>
+
+diff -Nur ibod-1.4/ibod.c ibod-1.4-conf/ibod.c
+--- ibod-1.4/ibod.c    2000-04-11 05:34:17.000000000 +0000
++++ ibod-1.4-conf/ibod.c       2011-11-11 18:50:45.510054466 +0000
+@@ -23,7 +23,7 @@
+ static void get_if_state();
+ static int bring_up_slave();
+ static int bring_down_slave();
+-static char *home;
++static char *config_file;
+ static Conf cf;
+ static struct timeval timeout, tv_last, tv_up;
+ static int usageflags[ISDN_MAX_CHANNELS];
+@@ -48,12 +48,16 @@
+     channels_last = -1;
++
+     /* Find out where to look for configuration file */
+-    if ((home = getenv("IBOD_HOME")) == NULL)
+-        home = IBOD_DEFAULT_DIR;
++    if (argc > 1) {
++        config_file = argv[1];
++    } else {
++        config_file = IBOD_DEFAULT_CONF;
++    }
+     /* Setup initial attributes */
+-    if (setattr(home) == -1) {
++    if (setattr(config_file) == -1) {
+         closelog();
+         exit(1);
+     }
+@@ -185,10 +189,9 @@
+ }
+-static int setattr(char *home)
++static int setattr(char *config_filename)
+ {
+     FILE *fd;
+-    char config_filename[MAX_STR_LEN];
+     char linebuf[MAX_STR_LEN];
+     char *key, *value;
+     int  val;
+@@ -202,7 +205,6 @@
+     cf.stayup_time = STAYUP_TIME;
+     /* Open config file */
+-    sprintf(config_filename, "%s/ibod.cf", home);
+     if ((fd = fopen(config_filename, "r")) == NULL) {
+         syslog(LOG_ERR, "%s: %s\n", config_filename, strerror(errno));
+         return -1;
+@@ -288,7 +290,7 @@
+ static void reread(int sig)
+ {
+-    (void) setattr(home);
++    (void) setattr(config_file);
+     setinterval();
+diff -Nur ibod-1.4/ibod.h ibod-1.4-conf/ibod.h
+--- ibod-1.4/ibod.h    2011-11-11 19:00:45.623454321 +0000
++++ ibod-1.4-conf/ibod.h       2011-11-11 18:45:39.703353901 +0000
+@@ -11,6 +11,7 @@
+ #define STAYUP_TIME           30
+ #define IBOD_DEFAULT_DIR      "/etc/isdn"
++#define IBOD_DEFAULT_CONF     IBOD_DEFAULT_DIR "/ibod.cf"
+ #define MAX_STR_LEN           512
+ #define ISDN_INFO_DEV         "/dev/isdninfo"
+ #define ISDN_CTLR_DEV         "/dev/isdnctrl"
diff --git a/ibod/systemd/ibod@.service b/ibod/systemd/ibod@.service
new file mode 100644 (file)
index 0000000..a2fde5c
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=ibod on %I
+BindTo=dev-%I.device
+After=dev-%I.device network.service
+Requires=network.service
+
+[Service]
+ExecStart=/usr/bin/ibod /run/network/isdn/%I/ibod.cf
+UtmpIdentifier=%I
+KillMode=process