From c412765afeeca2f69efa08164a1810db0b1e71e9 Mon Sep 17 00:00:00 2001 From: Alan Mizrahi Date: Mon, 26 Jan 2015 21:22:07 +0900 Subject: [PATCH] [notify] lirc: updated to 0.9.2 The daemon is now configured in /etc/lirc/lirc_options.conf and remotes in individual files in /etc/lirc/lircd.conf.d/ --- lirc/.footprint | 114 +++++++++++++++++- lirc/.md5sum | 16 +-- ...1102847-eb44af1-add-euid-to-template.patch | 18 +++ ...44508-034dcf8-lirc.pc-variable-order.patch | 20 +++ ...4636-35d9b9a-lirc-lsplugins-bugfixes.patch | 65 ++++++++++ ...10013032-39d7085-log-priority-labels.patch | 63 ++++++++++ lirc/20150115020157-b7758ca-user-config.patch | 22 ++++ .../20150123231142-97282f2-help-message.patch | 19 +++ lirc/Pkgfile | 58 +++------ lirc/README | 15 --- lirc/irxevent_name.diff | 62 ---------- lirc/kernel-2.6.39.patch | 54 --------- lirc/linux-3.8.patch | 80 ------------ lirc/lirc_atiusb-kfifo.patch | 31 ----- lirc/lirc_serial.patch | 13 -- lirc/lirc_wpc8769l.patch | 88 -------------- lirc/lircd | 64 ---------- lirc/lircd-handle-large-config.patch | 39 ------ lirc/lircd.rc | 76 ++++++++++++ 19 files changed, 419 insertions(+), 498 deletions(-) create mode 100644 lirc/20141211102847-eb44af1-add-euid-to-template.patch create mode 100644 lirc/20141229144508-034dcf8-lirc.pc-variable-order.patch create mode 100644 lirc/20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch create mode 100644 lirc/20150110013032-39d7085-log-priority-labels.patch create mode 100644 lirc/20150115020157-b7758ca-user-config.patch create mode 100644 lirc/20150123231142-97282f2-help-message.patch delete mode 100644 lirc/README delete mode 100644 lirc/irxevent_name.diff delete mode 100644 lirc/kernel-2.6.39.patch delete mode 100644 lirc/linux-3.8.patch delete mode 100644 lirc/lirc_atiusb-kfifo.patch delete mode 100644 lirc/lirc_serial.patch delete mode 100644 lirc/lirc_wpc8769l.patch delete mode 100755 lirc/lircd delete mode 100644 lirc/lircd-handle-large-config.patch create mode 100755 lirc/lircd.rc diff --git a/lirc/.footprint b/lirc/.footprint index 815152bd7..0f5639483 100644 --- a/lirc/.footprint +++ b/lirc/.footprint @@ -1,44 +1,146 @@ drwxr-xr-x root/root etc/ +drwxr-xr-x root/root etc/lirc/ +-rw-r--r-- root/root etc/lirc/lirc_options.conf +-rw-r--r-- root/root etc/lirc/lircd.conf +drwxr-xr-x root/root etc/lirc/lircd.conf.d/ +-rw-r--r-- root/root etc/lirc/lircmd.conf drwxr-xr-x root/root etc/rc.d/ -rwxr-xr-x root/root etc/rc.d/lircd drwxr-xr-x root/root usr/ drwxr-xr-x root/root usr/bin/ -rwxr-xr-x root/root usr/bin/ircat +-rwxr-xr-x root/root usr/bin/irdb-get -rwxr-xr-x root/root usr/bin/irexec -rwxr-xr-x root/root usr/bin/irpty -rwxr-xr-x root/root usr/bin/irrecord -rwxr-xr-x root/root usr/bin/irsend +-rwxr-xr-x root/root usr/bin/irsimreceive +-rwxr-xr-x root/root usr/bin/irsimsend +-rwxr-xr-x root/root usr/bin/irtestcase -rwxr-xr-x root/root usr/bin/irw -rwxr-xr-x root/root usr/bin/irxevent +-rwxr-xr-x root/root usr/bin/lirc-config-tool +-rwxr-xr-x root/root usr/bin/lirc-lsremotes +lrwxrwxrwx root/root usr/bin/lirc-setup -> ../../lirc-setup -rwxr-xr-x root/root usr/bin/lircrcd -rwxr-xr-x root/root usr/bin/mode2 -rwxr-xr-x root/root usr/bin/pronto2lirc -rwxr-xr-x root/root usr/bin/xmode2 drwxr-xr-x root/root usr/include/ drwxr-xr-x root/root usr/include/lirc/ +-rw-r--r-- root/root usr/include/lirc/ciniparser.h +-rw-r--r-- root/root usr/include/lirc/config_file.h +-rw-r--r-- root/root usr/include/lirc/config_flags.h +-rw-r--r-- root/root usr/include/lirc/dictionary.h +-rw-r--r-- root/root usr/include/lirc/driver.h +-rw-r--r-- root/root usr/include/lirc/drv_admin.h +-rw-r--r-- root/root usr/include/lirc/dump_config.h +drwxr-xr-x root/root usr/include/lirc/include/ +drwxr-xr-x root/root usr/include/lirc/include/media/ +-rw-r--r-- root/root usr/include/lirc/include/media/lirc.h +-rw-r--r-- root/root usr/include/lirc/input_map.h +-rw-r--r-- root/root usr/include/lirc/input_map.inc +-rw-r--r-- root/root usr/include/lirc/ir_remote.h +-rw-r--r-- root/root usr/include/lirc/ir_remote_types.h -rw-r--r-- root/root usr/include/lirc/lirc_client.h +-rw-r--r-- root/root usr/include/lirc/lirc_config.h +-rw-r--r-- root/root usr/include/lirc/lirc_log.h +-rw-r--r-- root/root usr/include/lirc/lirc_options.h +-rw-r--r-- root/root usr/include/lirc/paths.h +-rw-r--r-- root/root usr/include/lirc/receive.h +-rw-r--r-- root/root usr/include/lirc/release.h +-rw-r--r-- root/root usr/include/lirc/serial.h +-rw-r--r-- root/root usr/include/lirc/transmit.h +-rw-r--r-- root/root usr/include/lirc_client.h +-rw-r--r-- root/root usr/include/lirc_driver.h +-rw-r--r-- root/root usr/include/lirc_private.h drwxr-xr-x root/root usr/lib/ --rw-r--r-- root/root usr/lib/liblirc_client.a +-rwxr-xr-x root/root usr/lib/liblirc.la +lrwxrwxrwx root/root usr/lib/liblirc.so -> liblirc.so.0.0.0 +lrwxrwxrwx root/root usr/lib/liblirc.so.0 -> liblirc.so.0.0.0 +-rwxr-xr-x root/root usr/lib/liblirc.so.0.0.0 -rwxr-xr-x root/root usr/lib/liblirc_client.la -lrwxrwxrwx root/root usr/lib/liblirc_client.so -> liblirc_client.so.0.2.1 -lrwxrwxrwx root/root usr/lib/liblirc_client.so.0 -> liblirc_client.so.0.2.1 --rwxr-xr-x root/root usr/lib/liblirc_client.so.0.2.1 +lrwxrwxrwx root/root usr/lib/liblirc_client.so -> liblirc_client.so.0.3.0 +lrwxrwxrwx root/root usr/lib/liblirc_client.so.0 -> liblirc_client.so.0.3.0 +-rwxr-xr-x root/root usr/lib/liblirc_client.so.0.3.0 +-rwxr-xr-x root/root usr/lib/liblirc_driver.la +lrwxrwxrwx root/root usr/lib/liblirc_driver.so -> liblirc_driver.so.0.0.0 +lrwxrwxrwx root/root usr/lib/liblirc_driver.so.0 -> liblirc_driver.so.0.0.0 +-rwxr-xr-x root/root usr/lib/liblirc_driver.so.0.0.0 +drwxr-xr-x root/root usr/lib/lirc/ +drwxr-xr-x root/root usr/lib/lirc/plugins/ +-rwxr-xr-x root/root usr/lib/lirc/plugins/accent.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/alsa_usb.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/atilibusb.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/atwf83.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/audio.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/audio_alsa.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/awlibusb.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/bte.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/commandir.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/creative.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/creative_infracd.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/default.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/devinput.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/dfclibusb.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/dsp.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/ea65.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/file.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/hiddev.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/i2cuser.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/iguanaIR.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/irlink.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/irtoy.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/livedrive_midi.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/livedrive_seq.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/logitech.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/mouseremote.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/mp3anywhere.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/mplay.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/pcmak.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/pinsys.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/pixelview.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/silitek.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/simreceive.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/simsend.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/slinke.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/srm7500libusb.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/tira.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/udp.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/uirt2.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/uirt2_raw.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/usbx.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/yard2.so +-rwxr-xr-x root/root usr/lib/lirc/plugins/zotac.so +drwxr-xr-x root/root usr/lib/pkgconfig/ +-rw-r--r-- root/root usr/lib/pkgconfig/lirc-driver.pc +-rw-r--r-- root/root usr/lib/pkgconfig/lirc.pc drwxr-xr-x root/root usr/man/ drwxr-xr-x root/root usr/man/man1/ -rw-r--r-- root/root usr/man/man1/ircat.1.gz +-rw-r--r-- root/root usr/man/man1/irdb-get.1.gz -rw-r--r-- root/root usr/man/man1/irexec.1.gz -rw-r--r-- root/root usr/man/man1/irpty.1.gz -rw-r--r-- root/root usr/man/man1/irrecord.1.gz -rw-r--r-- root/root usr/man/man1/irsend.1.gz +-rw-r--r-- root/root usr/man/man1/irsimreceive.1.gz +-rw-r--r-- root/root usr/man/man1/irsimsend.1.gz +-rw-r--r-- root/root usr/man/man1/irtestcase.1.gz -rw-r--r-- root/root usr/man/man1/irw.1.gz -rw-r--r-- root/root usr/man/man1/irxevent.1.gz --rw-r--r-- root/root usr/man/man1/lircrcd.1.gz +-rw-r--r-- root/root usr/man/man1/lirc-config-tool.1.gz +-rw-r--r-- root/root usr/man/man1/lirc-lsplugins.1.gz +-rw-r--r-- root/root usr/man/man1/lirc-lsremotes.1.gz +-rw-r--r-- root/root usr/man/man1/lirc-setup.1.gz -rw-r--r-- root/root usr/man/man1/mode2.1.gz --rw-r--r-- root/root usr/man/man1/smode2.1.gz -rw-r--r-- root/root usr/man/man1/xmode2.1.gz +drwxr-xr-x root/root usr/man/man5/ +-rw-r--r-- root/root usr/man/man5/lircd.conf.5.gz drwxr-xr-x root/root usr/man/man8/ -rw-r--r-- root/root usr/man/man8/lircd.8.gz -rw-r--r-- root/root usr/man/man8/lircmd.8.gz +-rw-r--r-- root/root usr/man/man8/lircrcd.8.gz drwxr-xr-x root/root usr/sbin/ +-rwxr-xr-x root/root usr/sbin/lirc-lsplugins -rwxr-xr-x root/root usr/sbin/lircd -rwxr-xr-x root/root usr/sbin/lircmd diff --git a/lirc/.md5sum b/lirc/.md5sum index eb6c9e3ec..41447c1d1 100644 --- a/lirc/.md5sum +++ b/lirc/.md5sum @@ -1,8 +1,8 @@ -087a7d102e1c96bf1179f38db2b0b237 kernel-2.6.39.patch -9ee196bd03ea44af5a752fb0cc6ca96a linux-3.8.patch -b232aef26f23fe33ea8305d276637086 lirc-0.9.0.tar.bz2 -1f8b104a2365d9f93404b143f499059b lirc_atiusb-kfifo.patch -eba5edd29ca9e8a69d62d86e248f95a0 lirc_serial.patch -1cce37e18e3f6f46044abab29016d18f lirc_wpc8769l.patch -aca36f475fe6486d2b710f3556dce379 lircd -b70cc9640505205446ec47b7d4779f38 lircd-handle-large-config.patch +113d765740ef94c9a43b45c7c3e602c9 20141211102847-eb44af1-add-euid-to-template.patch +6b360d079312bcc5fd5e5cb7b6e6fd7f 20141229144508-034dcf8-lirc.pc-variable-order.patch +0f5b3638934886a51dcc341dbc5a152e 20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch +249b6b2e48dee7ae9e07cd4061600546 20150110013032-39d7085-log-priority-labels.patch +aaa20d592294530b429f2c6ffae3805a 20150115020157-b7758ca-user-config.patch +c2252bb3008abdf4dbe0373b829b959d 20150123231142-97282f2-help-message.patch +3afc84e79c0839823cc20e7a710dd06d lirc-0.9.2.tar.bz2 +38b9832e42a80d3fb45fd02c23938b36 lircd.rc diff --git a/lirc/20141211102847-eb44af1-add-euid-to-template.patch b/lirc/20141211102847-eb44af1-add-euid-to-template.patch new file mode 100644 index 000000000..467bfaf94 --- /dev/null +++ b/lirc/20141211102847-eb44af1-add-euid-to-template.patch @@ -0,0 +1,18 @@ +commit eb44af17ade6f55ca05f825d8a55f65c5305cbf1 +Author: Alec Leamas +Date: Thu Dec 11 10:28:47 2014 +0100 + + lirc_options.conf: Add effective-user to template. + +diff --git a/lirc_options.conf b/lirc_options.conf +index 9dc672a..9346de8 100644 +--- a/lirc_options.conf ++++ b/lirc_options.conf +@@ -12,6 +12,7 @@ plugindir = /usr/lib/lirc/plugins + permission = 666 + allow-simulate = No + repeat-max = 600 ++#effective-user = + #listen = [address:]port + #connect = host[:port] + #debug = 6 diff --git a/lirc/20141229144508-034dcf8-lirc.pc-variable-order.patch b/lirc/20141229144508-034dcf8-lirc.pc-variable-order.patch new file mode 100644 index 000000000..42794200f --- /dev/null +++ b/lirc/20141229144508-034dcf8-lirc.pc-variable-order.patch @@ -0,0 +1,20 @@ +commit 034dcf864796314d46b31268b34d28e9b79a9905 +Author: Inando +Date: Mon Dec 29 14:45:08 2014 +0100 + + lirc.pc: Fix bad variable reference/ordering (#86) + +diff --git a/lirc.pc.in b/lirc.pc.in +index 43f2b9b..432f51a 100644 +--- a/lirc.pc.in ++++ b/lirc.pc.in +@@ -2,8 +2,8 @@ Name: lirc + Description: LIRC Linux Infrared Control client libs. + Version: @VERSION@ + +-datarootdir=@datarootdir@ + prefix=@prefix@ ++datarootdir=@datarootdir@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ + includedir=@includedir@ diff --git a/lirc/20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch b/lirc/20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch new file mode 100644 index 000000000..e85d82e64 --- /dev/null +++ b/lirc/20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch @@ -0,0 +1,65 @@ +commit 35d9b9aa0290d393767f9169b7cdf6333be11c6f +Author: Alec Leamas +Date: Fri Jan 9 12:46:36 2015 +0100 + + lirc-lsplugins: Bugfixes, list also default device (#90). + + Since we should use the default device, it should also be + possible to check. Added to the -l output. + +diff --git a/tools/lirc-lsplugins.c b/tools/lirc-lsplugins.c +index 139fa1e..9ed8f57 100644 +--- a/tools/lirc-lsplugins.c ++++ b/tools/lirc-lsplugins.c +@@ -86,6 +86,7 @@ typedef struct { + const char* features; + const char* version; + const char* info; ++ const char* device; + } line_t; + + static const line_t* lines[MAX_PLUGINS]; +@@ -126,6 +127,7 @@ static line_t* line_new(const char* path) + line->errors = NULL; + line->info = NULL; + line->version = NULL; ++ line->device = NULL; + line->features = opt_long ? " " : ""; + return line; + } +@@ -212,7 +214,8 @@ static void line_print_long(const line_t* line) + } + + printf("Plugin path:\t%s\n", line->path); +- printf("Driver name:\t%s\n", line->path ? line->name : "-"); ++ printf("Driver name:\t%s\n", line->name ? line->name : "-"); ++ printf("Default device:\t%s\n", line->device ? line->device : "-"); + printf("Load state:\t%s\n", loadstate); + printf("Timing info:\t%s\n", handles_timing); + printf("Can send:\t%s\n", can_send); +@@ -264,17 +267,22 @@ static void format_drivers(struct driver** drivers, + continue; + } + if ((*drivers)->name) { +- strncpy(buf, (*drivers)->name, sizeof(buf)); ++ strncpy(buf, (*drivers)->name, sizeof(buf) - 1); + line->name = strdup(buf); + } + if ((*drivers)->driver_version) { +- strncpy(buf, (*drivers)->driver_version, sizeof(buf)); ++ strncpy(buf, ++ (*drivers)->driver_version, sizeof(buf) - 1); + line->version = strdup(buf); + } + if ((*drivers)->info) { +- strncpy(buf, (*drivers)->info, sizeof(buf)); ++ strncpy(buf, (*drivers)->info, sizeof(buf) - 1); + line->info = strdup(buf); + } ++ if ((*drivers)->device) { ++ strncpy(buf, (*drivers)->device, sizeof(buf) - 1); ++ line->device = strdup(buf); ++ } + snprintf(buf, sizeof(buf), "-%c%c", + get(CAN_ANY, 'a', *drivers), + get(CAN_SEND, 's', *drivers)); diff --git a/lirc/20150110013032-39d7085-log-priority-labels.patch b/lirc/20150110013032-39d7085-log-priority-labels.patch new file mode 100644 index 000000000..14d701450 --- /dev/null +++ b/lirc/20150110013032-39d7085-log-priority-labels.patch @@ -0,0 +1,63 @@ +commit 39d70855945ad1cb14fd865ebe581081ca8f2a27 +Author: Alec Leamas +Date: Sat Jan 10 01:30:32 2015 +0100 + + lib/lirc_log: Add priority labels (info, error...) to syslog msg (#89). + +diff --git a/lib/lirc_log.c b/lib/lirc_log.c +index 307fb77..cf37e6d 100644 +--- a/lib/lirc_log.c ++++ b/lib/lirc_log.c +@@ -2,22 +2,8 @@ + ** lircd.c ***************************************************************** + **************************************************************************** + * +- * lircd - LIRC Decoder Daemon ++ * lirc_log - simple logging module. + * +- * Copyright (C) 1996,97 Ralph Metzler +- * Copyright (C) 1998,99 Christoph Bartelmus +- * +- * ======= +- * HISTORY +- * ======= +- * +- * 0.1: 03/27/96 decode SONY infra-red signals +- * create mousesystems mouse signals on pipe /dev/lircm +- * 04/07/96 send ir-codes to clients via socket (see irpty) +- * 05/16/96 now using ir_remotes for decoding +- * much easier now to describe new remotes +- * +- * 0.5: 09/02/98 finished (nearly) complete rewrite (Christoph) + * + */ + +@@ -59,6 +45,8 @@ const char *logfile = "syslog"; + char progname[128] = {'?','\0'}; + static int nodaemon = 0; + ++static const int PRIO_LEN = 16; /**< Longest priority label, some margin. */ ++ + + static const char* prio2text(int prio) + { +@@ -246,6 +234,7 @@ void logprintf(loglevel_t prio, const char *format_str, ...) + { + int save_errno = errno; + va_list ap; ++ char buff[PRIO_LEN + strlen(format_str)]; + + #ifdef SYSTEMD_LOGPERROR_FIX + if (nodaemon && prio <= loglevel) { +@@ -258,8 +247,10 @@ void logprintf(loglevel_t prio, const char *format_str, ...) + } + #endif + if (use_syslog) { ++ snprintf(buff, sizeof(buff), ++ "%s: %s", prio2text(prio), format_str); + va_start(ap, format_str); +- vsyslog(prio, format_str, ap); ++ vsyslog(prio, buff, ap); + va_end(ap); + } else if (lf && prio <= loglevel) { + time_t current; diff --git a/lirc/20150115020157-b7758ca-user-config.patch b/lirc/20150115020157-b7758ca-user-config.patch new file mode 100644 index 000000000..22079f367 --- /dev/null +++ b/lirc/20150115020157-b7758ca-user-config.patch @@ -0,0 +1,22 @@ +commit b7758ca235bb5d8bbeca7ea45d304545d757b957 +Author: Alec Leamas +Date: Thu Jan 15 02:01:57 2015 +0100 + + lib: Bad bugfix for finding ~/.lircrc + + Basically, the common library code did not find ~/.lircrc, just + ~/.config/lircrc. Fixed. + +diff --git a/lib/lirc_client.c b/lib/lirc_client.c +index b161f0e..0f31fa8 100644 +--- a/lib/lirc_client.c ++++ b/lib/lirc_client.c +@@ -805,7 +805,7 @@ static char *lirc_getfilename(const char *file, const char *current_file) + if (filename == NULL) { + return NULL; + } +- strcat(filename, LIRCRC_USER_FILE); ++ strcat(filename, "/" LIRCRC_USER_FILE); + } + filename = realloc(filename, strlen(filename) + 1); + } else if (strncmp(file, "~/", 2) == 0) { diff --git a/lirc/20150123231142-97282f2-help-message.patch b/lirc/20150123231142-97282f2-help-message.patch new file mode 100644 index 000000000..c5e492a21 --- /dev/null +++ b/lirc/20150123231142-97282f2-help-message.patch @@ -0,0 +1,19 @@ +commit 97282f2dce4404a6ada9fdb1fa7cc9bfba16e93a +Author: Alec Leamas +Date: Fri Jan 23 23:11:42 2015 +0100 + + lircd: Help message bugfix. + +diff --git a/daemons/lircd.c b/daemons/lircd.c +index 1251b92..2ce3850 100644 +--- a/daemons/lircd.c ++++ b/daemons/lircd.c +@@ -114,7 +114,7 @@ static const char* const help = + "\t -r --release[=suffix]\t\tAuto-generate release events\n" + "\t -a --allow-simulate\t\tAccept SIMULATE command\n" + "\t -Y --dynamic-codes\t\tEnable dynamic code generation\n" +-"\t -A --driver-options=key:value[;key:value...]\n" ++"\t -A --driver-options=key:value[|key:value...]\n" + "\t\t\t\t\tSet driver options\n" + # if defined(__linux__) + "\t -u --uinput\t\t\tgenerate Linux input events\n" diff --git a/lirc/Pkgfile b/lirc/Pkgfile index ad940dba5..de9d3a28c 100644 --- a/lirc/Pkgfile +++ b/lirc/Pkgfile @@ -4,56 +4,38 @@ # Depends on: name=lirc -version=0.9.0 +version=0.9.2 release=3 source=( http://download.sourceforge.net/$name/$name-$version.tar.bz2 -kernel-2.6.39.patch -linux-3.8.patch -lirc_atiusb-kfifo.patch -lirc_wpc8769l.patch -lirc_serial.patch -lircd-handle-large-config.patch -lircd +lircd.rc +20141211102847-eb44af1-add-euid-to-template.patch +20141229144508-034dcf8-lirc.pc-variable-order.patch +20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch +20150110013032-39d7085-log-priority-labels.patch +20150115020157-b7758ca-user-config.patch +20150123231142-97282f2-help-message.patch ) -# Possible drivers: -# -# none, any, act200l, animax, atiusb, audio, avermedia, avermedia_vdomate, -# avermedia98, bestbuy, bestbuy2, breakoutbox, bte, caraca, chronos, comX, -# creative_infracd, dsp, cph03x, cph06x, creative, devinput, flyvideo, -# gvbctv5pci, hauppauge, hauppauge_dvb, hercules_smarttv_stereo, irdeo, -# irdeo_remote, irman, irreal, it87, knc_one, kworld, leadtek_0007, -# leadtek_0010, livedrive_midi, livedrive_seq, logitech, lptX, mceusb, -# mediafocusI, mp3anywhere, packard_bell, parallel, pctv, pixelview_bt878, -# pixelview_pak, pixelview_pro, provideo, realmagic, remotemaster, sa1100, -# sasem, serial, silitek, sir, slinke, tekram, tekram_bt829, tira, tvbox, -# udp, uirt2, uirt2_raw - -# To select the driver, you can change this: -LIRC_DRIVER=serial - build() { cd lirc-$version - patch -p1 -i $SRC/lirc_serial.patch - patch -p1 -i $SRC/lirc_wpc8769l.patch - patch -p1 -i $SRC/lircd-handle-large-config.patch - patch -p1 -i $SRC/lirc_atiusb-kfifo.patch - patch -p1 -i $SRC/kernel-2.6.39.patch - patch -p1 -i $SRC/linux-3.8.patch + # Apply bugfixes waiting for next release + for i in $SRC/*.patch; do + patch -i $i -p1 + done ./configure \ --prefix=/usr \ + --sysconfdir=/etc \ --mandir=/usr/man \ - --with-transmitter \ - --enable-sandboxed \ - --with-syslog=LOG_DAEMON \ - --with-driver=$LIRC_DRIVER - make -j 1 + --localstatedir=/var + make make DESTDIR=$PKG install - install -D -m 755 $SRC/lircd $PKG/etc/rc.d/lircd - # Uncomment this line if you want to use the kernel module(s) provided by lirc - rm -rf $PKG/lib + # init script + install -D -m 755 $SRC/lircd.rc $PKG/etc/rc.d/lircd + + # remove cruft + rm -rf $PKG/configs $PKG/usr/share $PKG/var $PKG/etc/lirc/lircd.conf.d/README.conf.d $PKG/usr/lib/lirc/plugins/*.la } diff --git a/lirc/README b/lirc/README deleted file mode 100644 index f03d9a59e..000000000 --- a/lirc/README +++ /dev/null @@ -1,15 +0,0 @@ -README for lirc - -REQUIREMENTS - -Enable the kernel modules required for your particular driver. -Please refer to the LIRC website for more details. - -PRE-INSTALL - -This port builds lirc using the serial driver by default. -Just change the LIRC_DRIVER line in the Pkgfile to suit your needs. - -POST-INSTALL - -PRECAUTION diff --git a/lirc/irxevent_name.diff b/lirc/irxevent_name.diff deleted file mode 100644 index 1a5f42ca1..000000000 --- a/lirc/irxevent_name.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- lirc-0.9.0/tools/irxevent.c.orig 2012-03-28 17:37:58.603657279 +0900 -+++ lirc-0.9.0/tools/irxevent.c 2012-03-28 17:41:20.432647800 +0900 -@@ -131,6 +131,7 @@ - static const char *root_window_name = "RootWindow"; - - static const char *progname = "irxevent"; -+static char *lirc_progname = NULL; /* program name to react to, by default irxevent */ - static Display *dpy; - static Window root; - static XEvent xev; -@@ -550,6 +551,7 @@ - } - - static struct option long_options[] = { -+ {"name", required_argument, NULL, 'n'}, - {"daemon", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, -@@ -566,8 +568,11 @@ - int c; - int WindowID; - -- while ((c = getopt_long(argc, argv, "dhV", long_options, NULL)) != EOF) { -+ while ((c = getopt_long(argc, argv, "n:dhV", long_options, NULL)) != EOF) { - switch (c) { -+ case 'n': -+ lirc_progname = optarg; -+ continue; - case 'd': - bDaemon = 1; - continue; -@@ -605,7 +610,7 @@ - // windows may get closed at wrong time. Override default error handler... - XSetErrorHandler(errorHandler); - -- if (lirc_init("irxevent", 1) == -1) -+ if (lirc_init(lirc_progname?lirc_progname:progname, 1) == -1) - exit(EXIT_FAILURE); - - if (lirc_readconfig(config_file, &config, check) == 0) { ---- lirc-0.9.0/doc/man/irxevent.1.orig 2012-03-28 17:49:49.743623879 +0900 -+++ lirc-0.9.0/doc/man/irxevent.1 2012-03-28 17:53:34.603613319 +0900 -@@ -14,6 +14,9 @@ - - Irxevent is a complement to irexec and irpty. - .TP -+\fB\-n\fR \fB\-\-name\fR -+program name in .lircrc for this irxevent instance -+.TP - \fB\-d\fR \fB\-\-daemon\fR - fork and run in background - .TP ---- lirc-0.9.0/doc/html/irxevent.html.orig 2012-03-28 17:54:15.632611392 +0900 -+++ lirc-0.9.0/doc/html/irxevent.html 2012-03-28 17:54:44.502610035 +0900 -@@ -55,6 +55,7 @@ -

- Irxevent is a complement to irexec and irpty. -

-+
-n --name
-
-d --daemon
- fork and run in background -
-h --help
diff --git a/lirc/kernel-2.6.39.patch b/lirc/kernel-2.6.39.patch deleted file mode 100644 index 7353d61ca..000000000 --- a/lirc/kernel-2.6.39.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff -ru lirc-0.9.0/drivers//lirc_atiusb/lirc_atiusb.c lirc-0.9.0.new/drivers//lirc_atiusb/lirc_atiusb.c ---- lirc-0.9.0/drivers//lirc_atiusb/lirc_atiusb.c 2011-03-25 23:28:18.000000000 +0100 -+++ lirc-0.9.0.new/drivers//lirc_atiusb/lirc_atiusb.c 2011-06-07 17:02:20.356580306 +0200 -@@ -48,7 +48,6 @@ - #include - #include - #include --#include - #include - #include - #include -diff -ru lirc-0.9.0/drivers//lirc_i2c/lirc_i2c.c lirc-0.9.0.new/drivers//lirc_i2c/lirc_i2c.c ---- lirc-0.9.0/drivers//lirc_i2c/lirc_i2c.c 2011-03-25 23:28:18.000000000 +0100 -+++ lirc-0.9.0.new/drivers//lirc_i2c/lirc_i2c.c 2011-06-07 17:04:19.725933627 +0200 -@@ -555,8 +555,8 @@ - kfree(ir); - return -EINVAL; - } -- printk(KERN_INFO "lirc_i2c: chip 0x%x found @ 0x%02x (%s)\n", -- adap->id, addr, ir->c.name); -+ printk(KERN_INFO "lirc_i2c: chip found @ 0x%02x (%s)\n", -+ addr, ir->c.name); - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) - /* register device */ -diff -ru lirc-0.9.0/drivers//lirc_wpc8769l/lirc_wpc8769l.c lirc-0.9.0.new/drivers//lirc_wpc8769l/lirc_wpc8769l.c ---- lirc-0.9.0/drivers//lirc_wpc8769l/lirc_wpc8769l.c 2011-03-25 23:28:18.000000000 +0100 -+++ lirc-0.9.0.new/drivers//lirc_wpc8769l/lirc_wpc8769l.c 2011-06-07 17:07:23.984935411 +0200 -@@ -361,14 +361,14 @@ - size = count << 3; - - ldata = (unsigned long *) data_buf; -- next_one = generic_find_next_le_bit(ldata, size, 0); -+ next_one = find_next_zero_bit_le(ldata, size, 0); - - if (next_one > 0) - put_pulse_bit(next_one - * WPC8769L_USECS_PER_BIT); - - while (next_one < size) { -- next_zero = generic_find_next_zero_le_bit(ldata, -+ next_zero = find_next_zero_bit_le(ldata, - size, next_one + 1); - - put_space_bit( -@@ -376,7 +376,7 @@ - * WPC8769L_USECS_PER_BIT); - - if (next_zero < size) { -- next_one = generic_find_next_le_bit(ldata, -+ next_one = find_next_bit_le(ldata, - size, next_zero + 1); - - put_pulse_bit( diff --git a/lirc/linux-3.8.patch b/lirc/linux-3.8.patch deleted file mode 100644 index 7b6378a83..000000000 --- a/lirc/linux-3.8.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff -upr lirc-0.9.0.orig/drivers/lirc_serial/lirc_serial.c lirc-0.9.0/drivers/lirc_serial/lirc_serial.c ---- lirc-0.9.0.orig/drivers/lirc_serial/lirc_serial.c 2013-02-21 02:36:25.000000000 +0200 -+++ lirc-0.9.0/drivers/lirc_serial/lirc_serial.c 2013-02-21 02:39:55.000000000 +0200 -@@ -1103,12 +1103,12 @@ static struct lirc_driver driver = { - - static struct platform_device *lirc_serial_dev; - --static int __devinit lirc_serial_probe(struct platform_device *dev) -+static int lirc_serial_probe(struct platform_device *dev) - { - return 0; - } - --static int __devexit lirc_serial_remove(struct platform_device *dev) -+static int lirc_serial_remove(struct platform_device *dev) - { - return 0; - } -@@ -1159,7 +1159,7 @@ static int lirc_serial_resume(struct pla - - static struct platform_driver lirc_serial_driver = { - .probe = lirc_serial_probe, -- .remove = __devexit_p(lirc_serial_remove), -+ .remove = lirc_serial_remove, - .suspend = lirc_serial_suspend, - .resume = lirc_serial_resume, - .driver = { -diff -upr lirc-0.9.0.orig/drivers/lirc_sir/lirc_sir.c lirc-0.9.0/drivers/lirc_sir/lirc_sir.c ---- lirc-0.9.0.orig/drivers/lirc_sir/lirc_sir.c 2013-02-21 02:36:25.000000000 +0200 -+++ lirc-0.9.0/drivers/lirc_sir/lirc_sir.c 2013-02-21 02:38:24.000000000 +0200 -@@ -1290,19 +1290,19 @@ static int init_lirc_sir(void) - return 0; - } - --static int __devinit lirc_sir_probe(struct platform_device *dev) -+static int lirc_sir_probe(struct platform_device *dev) - { - return 0; - } - --static int __devexit lirc_sir_remove(struct platform_device *dev) -+static int lirc_sir_remove(struct platform_device *dev) - { - return 0; - } - - static struct platform_driver lirc_sir_driver = { - .probe = lirc_sir_probe, -- .remove = __devexit_p(lirc_sir_remove), -+ .remove = lirc_sir_remove, - .driver = { - .name = "lirc_sir", - .owner = THIS_MODULE, -diff -upr lirc-0.9.0.orig/drivers/lirc_wpc8769l/lirc_wpc8769l.c lirc-0.9.0/drivers/lirc_wpc8769l/lirc_wpc8769l.c ---- lirc-0.9.0.orig/drivers/lirc_wpc8769l/lirc_wpc8769l.c 2013-02-21 02:36:25.000000000 +0200 -+++ lirc-0.9.0/drivers/lirc_wpc8769l/lirc_wpc8769l.c 2013-02-21 02:39:39.000000000 +0200 -@@ -930,12 +930,12 @@ static int wpc8769l_acpi_detect(void) - #ifdef MODULE - static struct platform_device *lirc_wpc8769l_platform_dev; - --static int __devinit lirc_wpc8769l_probe(struct platform_device *dev) -+static int lirc_wpc8769l_probe(struct platform_device *dev) - { - return 0; - } - --static int __devexit lirc_wpc8769l_remove(struct platform_device *dev) -+static int lirc_wpc8769l_remove(struct platform_device *dev) - { - return 0; - } -@@ -963,7 +963,7 @@ static int lirc_wpc8769l_resume(struct p - - static struct platform_driver lirc_wpc8769l_platform_driver = { - .probe = lirc_wpc8769l_probe, -- .remove = __devexit_p(lirc_wpc8769l_remove), -+ .remove = lirc_wpc8769l_remove, - .suspend = lirc_wpc8769l_suspend, - .resume = lirc_wpc8769l_resume, - .driver = { diff --git a/lirc/lirc_atiusb-kfifo.patch b/lirc/lirc_atiusb-kfifo.patch deleted file mode 100644 index a64984dce..000000000 --- a/lirc/lirc_atiusb-kfifo.patch +++ /dev/null @@ -1,31 +0,0 @@ -From ec3c5660e67c122e2d5eb9cfa838c9709fccf8e0 Mon Sep 17 00:00:00 2001 -From: Jason Martin -Date: Fri, 3 Jun 2011 00:12:51 -0400 -Subject: [PATCH] lirc_atiusb: fix buffer alloc to work with new kfifo - -I came across posts with regards to lirc_atiusb and its compatibility -with newer kernels, and their use of kfifo.I spent a little bit of time -this evening, and was able to correct the issues with the driver, and -now have a functioning lirc_atiusb device under the 2.6.38 kernel. - -Signed-off-by: Jarod Wilson ---- - drivers/lirc_atiusb/lirc_atiusb.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/drivers/lirc_atiusb/lirc_atiusb.c b/drivers/lirc_atiusb/lirc_atiusb.c -index 52080de..bf2b631 100644 ---- a/drivers/lirc_atiusb/lirc_atiusb.c -+++ b/drivers/lirc_atiusb/lirc_atiusb.c -@@ -1048,7 +1048,7 @@ static struct atirf_dev *new_irctl(struct usb_interface *intf) - goto new_irctl_failure_check; - } - -- if (lirc_buffer_init(driver->rbuf, dclen, 1)) { -+ if (lirc_buffer_init(driver->rbuf, dclen, 2)) { - mem_failure = 4; - goto new_irctl_failure_check; - } --- -1.7.0.1 - diff --git a/lirc/lirc_serial.patch b/lirc/lirc_serial.patch deleted file mode 100644 index 2012ed5c2..000000000 --- a/lirc/lirc_serial.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- lirc-0.9.0/drivers/lirc_serial/lirc_serial.c.orig 2013-03-11 23:21:07.238776562 +0900 -+++ lirc-0.9.0/drivers/lirc_serial/lirc_serial.c 2013-03-11 23:21:41.245768838 +0900 -@@ -66,7 +66,10 @@ - #include - #include - -+#include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) - #include -+#endif - #include - #include - #include diff --git a/lirc/lirc_wpc8769l.patch b/lirc/lirc_wpc8769l.patch deleted file mode 100644 index e4e2a049b..000000000 --- a/lirc/lirc_wpc8769l.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 413e83bf504fe9a9a177f27742220cfcb184b034 Mon Sep 17 00:00:00 2001 -From: =?utf8?q?Juan=20Jes=C3=BAs=20Garc=C3=ADa=20de=20Soria=20Lucena?= -Date: Wed, 30 Mar 2011 16:46:35 -0400 -Subject: [PATCH] Make lirc_wpc8769l functional again - -Signed-off-by: Jarod Wilson ---- - drivers/lirc_wpc8769l/lirc_wpc8769l.c | 28 +++++++++++++++++----------- - 1 files changed, 17 insertions(+), 11 deletions(-) - -diff --git a/drivers/lirc_wpc8769l/lirc_wpc8769l.c b/drivers/lirc_wpc8769l/lirc_wpc8769l.c -index f820d11..4d04063 100644 ---- a/drivers/lirc_wpc8769l/lirc_wpc8769l.c -+++ b/drivers/lirc_wpc8769l/lirc_wpc8769l.c -@@ -816,10 +816,6 @@ static int set_use_inc(void *data) - /* Reset last timeout value. */ - lastus = 0; - -- /* Init the read buffer. */ -- if (lirc_buffer_init(&rbuf, sizeof(lirc_t), RBUF_LEN) < 0) -- return -ENOMEM; -- - /* Acquire the IRQ. */ - result = request_irq(irq, irq_handler, - IRQF_DISABLED | IRQF_SHARED, -@@ -863,9 +859,6 @@ static void set_use_dec(void *data) - /* Free the IRQ. */ - free_irq(irq, THIS_MODULE); - dprintk("Freed IRQ %d\n", irq); -- -- /* Free the RX buffer. */ -- lirc_buffer_free(&rbuf); - } - - static struct lirc_driver driver = { -@@ -1065,19 +1058,29 @@ static int __init lirc_wpc8769l_module_init(void) - /* Do load-time checks. */ - wpc8769l_power_up_and_check_if_we_woke_us_up(); - -+ /* Init the read buffer. */ -+ if (lirc_buffer_init(&rbuf, sizeof(lirc_t), RBUF_LEN) < 0) { -+ rc = -ENOMEM; -+ goto exit_platform_exit; -+ } -+ - /* Configure the driver hooks. */ - driver.features = LIRC_CAN_REC_MODE2; -+ driver.dev = &lirc_wpc8769l_platform_dev->dev; - driver.minor = lirc_register_driver(&driver); - if (driver.minor < 0) { - eprintk("lirc_register_driver failed!\n"); - rc = -EIO; -- goto exit_platform_exit; -+ goto exit_release_buffer; - } - - iprintk("Driver loaded.\n"); - - return 0; /* Everything OK. */ - -+exit_release_buffer: -+ lirc_buffer_free(&rbuf); -+ - exit_platform_exit: - lirc_wpc8769l_platform_exit(); - -@@ -1095,12 +1098,15 @@ module_init(lirc_wpc8769l_module_init); - - static void __exit lirc_wpc8769l_module_exit(void) - { -- /* Unregister the platform driver and device. */ -- lirc_wpc8769l_platform_exit(); -- - /* Unregister the LIRC driver. */ - lirc_unregister_driver(driver.minor); - -+ /* Free the buffer. */ -+ lirc_buffer_free(&rbuf); -+ -+ /* Unregister the platform driver and device. */ -+ lirc_wpc8769l_platform_exit(); -+ - /* Release the second range. */ - if (baseport2) - release_region(baseport2, WPC8769L_IO_REGION_2_SIZE); --- -1.7.0.1 - diff --git a/lirc/lircd b/lirc/lircd deleted file mode 100755 index 166ff708d..000000000 --- a/lirc/lircd +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# /etc/rc.d/lircd: start/stop/restart lirc daemon -# - -NAME=lirc -USER=lirc -GROUP=lirc -RUNDIR=/var/run/lirc -PIDFILE=$RUNDIR/lircd.pid -CONFIG=/etc/lircd.conf -DEVICE=/dev/usbirboy -PARAMS="--device=$DEVICE --output=$RUNDIR/lircd --pidfile=$PIDFILE --permission=660 --allow-simulate $CONFIG" - -case "$1" in - start) - [ -d $RUNDIR ] || install -d -m 750 -o $USER -g $GROUP $RUNDIR || exit 1 - if [ -f $PIDFILE ]; then - pid=$(< $PIDFILE) - if [ ! -d /proc/$pid -o -z "$pid" ]; then - echo "$NAME: removing stale pidfile $PIDFILE" >&2 - rm -f $PIDFILE - fi - fi - if [ -f $PIDFILE ]; then - echo "$NAME already running with pid $pid" >&2 - exit 1 - fi - - chown $USER:$GROUP $DEVICE - /usr/bin/sudo -b -H -u $USER /usr/sbin/lircd $PARAMS - ;; - stop) - if [ -f $PIDFILE ]; then - pid=$(< $PIDFILE) - if [ ! -d /proc/$pid -o -z "$pid" ]; then - echo "$NAME: removing stale pidfile $PIDFILE" >&2 - rm -f $PIDFILE - else - kill $pid - t=0 - while [ -d /proc/$pid -a $t -lt 10 ]; do - sleep 0.5 - let t++ - done - if [ -d /proc/$pid ]; then - echo "$NAME still running with pid $pid" >&2 - else - rm -f $PIDFILE - fi - fi - else - echo "$NAME is not running" >&2 - fi - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "Usage: $0 start|stop|restart" - exit 1 - ;; -esac diff --git a/lirc/lircd-handle-large-config.patch b/lirc/lircd-handle-large-config.patch deleted file mode 100644 index 85bc20518..000000000 --- a/lirc/lircd-handle-large-config.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5efb56bf22a5077db564c766ba7cc37bc269231d Mon Sep 17 00:00:00 2001 -From: Jarod Wilson -Date: Wed, 6 Apr 2011 11:04:12 -0400 -Subject: [PATCH] lircd: handle larger config files in write_socket better - -Pointed out by Michael Zanetti on list, irsend LIST has issues with long -config files, which didn't exist in maintainer mode, as we were using a -do while loop to make sure we spit out everything. Just use that loop -all the time. - -Signed-off-by: Jarod Wilson ---- - daemons/lircd.c | 8 ++------ - 1 files changed, 2 insertions(+), 6 deletions(-) - -diff --git a/daemons/lircd.c b/daemons/lircd.c -index 6c21a3a..ddcca05 100644 ---- a/daemons/lircd.c -+++ b/daemons/lircd.c -@@ -231,14 +231,10 @@ inline int write_socket(int fd, const char *buf, int len) - int done, todo = len; - - while (todo) { --#ifdef SIM_REC - do { - done = write(fd, buf, todo); -- } -- while (done < 0 && errno == EAGAIN); --#else -- done = write(fd, buf, todo); --#endif -+ } while (done < 0 && errno == EAGAIN); -+ - if (done <= 0) - return (done); - buf += done; --- -1.7.0.1 - diff --git a/lirc/lircd.rc b/lirc/lircd.rc new file mode 100755 index 000000000..c77ae3c9e --- /dev/null +++ b/lirc/lircd.rc @@ -0,0 +1,76 @@ +#!/bin/bash + +NAME=lirc +USER=lirc +RUNDIR=/var/run/lirc +PIDFILE="$RUNDIR/lircd.pid" +STARTCMD="/usr/bin/sudo -b -H -u $USER /usr/sbin/lircd" +STOPCMD="" +STOPTIMEOUT=120 + +function getpid() { + if [ -z "$PIDFILE" ]; then + pid="$(pgrep -xfn "$STARTCMD")" + else + if [ -f "$PIDFILE" ]; then + pid=$(< $PIDFILE) + if [ ! -d /proc/"$pid" ]; then + echo "$NAME: removing stale pidfile $PIDFILE" >&2 + rm -f "$PIDFILE" + unset pid + fi + fi + fi + echo "$pid" +} + +case $1 in +start) + pid=$(getpid) + install -d -m 755 -o $USER $RUNDIR || exit 1 + if [ -n "$pid" ]; then + echo "$NAME already running with pid $pid" >&2 + exit 1 + fi + eval "$STARTCMD" + ;; +stop) + pid=$(getpid) + if [ -n "$pid" ]; then + if [ -n "$STOPCMD" ]; then + eval "$STOPCMD" + else + kill "$pid" + fi + t=$(printf '%(%s)T' -1) + tend=$((t+STOPTIMEOUT)) + while [ -d /proc/$pid -a $t -lt $tend ]; do + sleep 0.5 + t=$(printf '%(%s)T' -1) + done + if [ -d /proc/"$pid" ]; then + echo "$NAME still running with pid $pid" >&2 + else + [ -n "$PIDFILE" ] && rm -f "$PIDFILE" + fi + else + echo "$NAME is not running" >&2 + fi + ;; +restart) + $0 stop + $0 start + ;; +status) + pid=$(getpid) + if [ -n "$pid" ]; then + echo "$NAME is running with pid $pid" + else + echo "$NAME is not running" + fi + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac +