mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] triggerhappy: new package for triggerhappy (thd) version 0.3.4+git
Date: Thu, 4 Dec 2014 17:26:34 +0100	[thread overview]
Message-ID: <20141204162634.GD16181@pengutronix.de> (raw)
In-Reply-To: <1417269886-30393-1-git-send-email-apr@cn-eng.de>

On Sat, Nov 29, 2014 at 03:04:46PM +0100, Andreas Pretzsch wrote:
> thd - triggerhappy global hotkey daemon
> 
> Triggerhappy is a hotkey daemon developed with small and embedded
> systems in mind, e.g. linux based routers. It attaches to the input
> device files and interprets the event data received and executes
> scripts configured in its configuration.
> 
> Import release 0.3.4 + patches [release/0.3.4..master (cb3ed9b..aac9f35)]
> and a fix for cross-compiling.
> 
> Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
> ---
>  generic/etc/init.d/triggerhappy                    |  74 +++++
>  ...larify-licence-information-GPLv3-or-later.patch | 347 +++++++++++++++++++++
>  ...ault-SIGCHLD-handler-for-spawned-processe.patch |  38 +++
>  ...CE-environment-variable-so-that-triggers-.patch |  25 ++
>  ...ve-leading-whitespaces-from-command-lines.patch |  27 ++
>  ...-detect-linux-input.h-path-with-gcc-4.8.0.patch |  30 ++
>  ...-detect-linux-input.h-path-with-cross-gcc.patch |  28 ++
>  patches/triggerhappy-0.3.4/series                  |   9 +
>  rules/triggerhappy-bbinit.in                       |   7 +
>  rules/triggerhappy.in                              |  82 +++++
>  rules/triggerhappy.make                            |  79 +++++
>  11 files changed, 746 insertions(+)
>  create mode 100644 generic/etc/init.d/triggerhappy
>  create mode 100644 patches/triggerhappy-0.3.4/0001-clarify-licence-information-GPLv3-or-later.patch
>  create mode 100644 patches/triggerhappy-0.3.4/0002-Restore-default-SIGCHLD-handler-for-spawned-processe.patch
>  create mode 100644 patches/triggerhappy-0.3.4/0003-Set-TH_DEVICE-environment-variable-so-that-triggers-.patch
>  create mode 100644 patches/triggerhappy-0.3.4/0004-remove-leading-whitespaces-from-command-lines.patch
>  create mode 100644 patches/triggerhappy-0.3.4/0005-fix-failure-to-detect-linux-input.h-path-with-gcc-4.8.0.patch
>  create mode 100644 patches/triggerhappy-0.3.4/0006-fix-failure-to-detect-linux-input.h-path-with-cross-gcc.patch
>  create mode 100644 patches/triggerhappy-0.3.4/series
>  create mode 100644 rules/triggerhappy-bbinit.in
>  create mode 100644 rules/triggerhappy.in
>  create mode 100644 rules/triggerhappy.make
> 
> diff --git a/generic/etc/init.d/triggerhappy b/generic/etc/init.d/triggerhappy
> new file mode 100644
> index 0000000..d475751
> --- /dev/null
> +++ b/generic/etc/init.d/triggerhappy
> @@ -0,0 +1,74 @@
> +#!/bin/sh
> +
> +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
> +NAME=thd
> +PNAME=triggerhappy
> +DAEMON=/usr/sbin/thd
> +PIDFILE=/var/run/$NAME.pid
> +DAEMON_ARGS="--daemon --pidfile $PIDFILE --socket /var/run/thd.socket"
> +DAEMON_ARGS="$DAEMON_ARGS --triggers @TRIGGERS@"
> +DAEMON_ARGS="$DAEMON_ARGS --user @USER@"
> +DAEMON_ARGS="$DAEMON_ARGS @INPUT_DEV@"
> +
> +[ -r /etc/default/$PNAME ] && . /etc/default/$PNAME
> +
> +case "$1" in
> +	start)
> +		echo -n "starting $PNAME..."
> +		start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" -- $DAEMON_ARGS > /dev/null 2>&1
> +		if [ "$?" = "0" ]; then
> +			echo "done"
> +		else
> +			echo "failed"
> +			exit 1
> +		fi
> +		;;
> +
> +	stop)
> +		echo -n "stopping $PNAME..."
> +		start-stop-daemon -K -p $PIDFILE > /dev/null 2>&1
> +		if [ "$?" = "0" ]; then
> +			echo "done"
> +		else
> +			echo "failed"
> +			exit 1
> +		fi
> +		;;
> +
> +	restart|force-reload)
> +		echo -n "restarting $PNAME..."
> +		start-stop-daemon -K -x "$DAEMON" -p $PIDFILE > /dev/null 2>&1
> +		if [ "$?" = "0" ]; then
> +			echo "done"
> +		else
> +			echo "failed"
> +			exit 1
> +		fi
> +		sleep 1
> +		start-stop-daemon -S -x "$DAEMON" -p $PIDFILE > /dev/null 2>&1
> +		if [ "$?" = "0" ]; then
> +			echo "done"
> +		else
> +			echo "failed"
> +			exit 1
> +		fi
> +		;;
> +
> +	reload)
> +		echo -n "reloading $PNAME..."
> +		start-stop-daemon -K -x "$DAEMON" -p $PIDFILE -s 1 > /dev/null 2>&1
> +		if [ "$?" = "0" ]; then
> +			echo "done"
> +		else
> +			echo "failed"
> +			exit 1
> +		fi
> +		;;
> +
> +	*)
> +		echo "Usage: $0 {start|stop|restart|force-reload|reload}" >&2
> +		exit 1
> +		;;
> +esac
> +
> +exit 0
[...]
> diff --git a/patches/triggerhappy-0.3.4/series b/patches/triggerhappy-0.3.4/series
> new file mode 100644
> index 0000000..d4dde26
> --- /dev/null
> +++ b/patches/triggerhappy-0.3.4/series
> @@ -0,0 +1,9 @@
> +# release/0.3.4..master (cb3ed9b..aac9f35)
> +0001-clarify-licence-information-GPLv3-or-later.patch
> +0002-Restore-default-SIGCHLD-handler-for-spawned-processe.patch
> +0003-Set-TH_DEVICE-environment-variable-so-that-triggers-.patch
> +0004-remove-leading-whitespaces-from-command-lines.patch
> +# https://github.com/wertarbyte/triggerhappy/issues/3
> +0005-fix-failure-to-detect-linux-input.h-path-with-gcc-4.8.0.patch
> +# cross-compile fix
> +0006-fix-failure-to-detect-linux-input.h-path-with-cross-gcc.patch
> diff --git a/rules/triggerhappy-bbinit.in b/rules/triggerhappy-bbinit.in
> new file mode 100644
> index 0000000..7bc1a57
> --- /dev/null
> +++ b/rules/triggerhappy-bbinit.in
> @@ -0,0 +1,7 @@
> +## SECTION=initmethod_bbinit
> +
> +config TRIGGERHAPPY_BBINIT_LINK
> +	string
> +	depends on TRIGGERHAPPY_STARTSCRIPT
> +	prompt "triggerhappy"
> +	default "S99triggerhappy"
> diff --git a/rules/triggerhappy.in b/rules/triggerhappy.in
> new file mode 100644
> index 0000000..017074a
> --- /dev/null
> +++ b/rules/triggerhappy.in
> @@ -0,0 +1,82 @@
> +## SECTION=shell_and_console
> +
> +menuconfig TRIGGERHAPPY
> +	tristate
> +	prompt "triggerhappy                  "
> +	select BUSYBOX_START_STOP_DAEMON		if TRIGGERHAPPY_STARTSCRIPT
> +	select BUSYBOX_FEATURE_START_STOP_DAEMON_FANCY	if TRIGGERHAPPY_STARTSCRIPT
> +	help
> +	  thd - triggerhappy global hotkey daemon
> +
> +	  Triggerhappy is a hotkey daemon developed with small and embedded
> +	  systems in mind, e.g. linux based routers. It attaches to the input
> +	  device files and interprets the event data received and executes
> +	  scripts configured in its configuration.
> +
> +if TRIGGERHAPPY
> +
> +config TRIGGERHAPPY_STARTSCRIPT
> +	bool
> +	default y
> +	depends on TRIGGERHAPPY
> +	select TRIGGERHAPPY_INSTALL_CONFIG
> +	prompt "install /etc/init.d/triggerhappy"
> +
> +config TRIGGERHAPPY_INSTALL_CONFIG
> +	bool
> +	default y
> +	prompt "install trigger config"

Is it usefull without config file?

> +
> +
> +if TRIGGERHAPPY_INSTALL_CONFIG
> +
> +config TRIGGERHAPPY_TRIGGERS
> +	string
> +	prompt "trigger config file/directory"

No prompt. Otherwise the default logic won't work.

> +	default "/etc/triggerhappy/triggers.d/"	if TRIGGERHAPPY_TRIGGERS_DIR
> +	default "/etc/triggerhappy.conf"	if TRIGGERHAPPY_TRIGGERS_FILE
> +	help
> +	  Read trigger definitions from <conf>, which can either be a file or
> +	  a directory. If a directory is specified, all its files matching the
> +	  pattern *.conf are loaded.
> +	  Create this file or directory with files in projectroot.
> +	  default dir:  "/etc/triggerhappy/triggers.d/"
> +	  default file: "/etc/triggerhappy.conf"
> +
> +choice
> +	prompt "trigger definitions in"

put the help here.

> +	default TRIGGERHAPPY_TRIGGERS_DIR
> +	config TRIGGERHAPPY_TRIGGERS_DIR
> +		bool
> +		prompt "dir"

dont indent, and:
	prompt "/etc/triggerhappy/triggers.d/"

> +	config TRIGGERHAPPY_TRIGGERS_FILE
> +		bool
> +		prompt "file"


same here.

> +endchoice
> +
> +endif
> +
> +
> +if TRIGGERHAPPY_STARTSCRIPT
> +
> +config TRIGGERHAPPY_USER
> +	string
> +	prompt "Change to user id <user> after opening files"
> +	default "root"
> +	help
> +	  Change to user id <user> after opening files. This usually prevents
> +	  thd from opening additional input devices, unless they are opened
> +	  by the th-cmd program and their file descriptor are passed to the
> +	  daemon or unless running as root.
> +
> +config TRIGGERHAPPY_INPUT_DEV
> +	string
> +	prompt "input device(s) to watch"
> +	default "/dev/input/event*"
> +	help
> +	  Name or pattern of input devices to watch.
> +	  Default: "/dev/input/event*" to watch all.
> +
> +endif
> +
> +endif
> diff --git a/rules/triggerhappy.make b/rules/triggerhappy.make
> new file mode 100644
> index 0000000..5889b50
> --- /dev/null
> +++ b/rules/triggerhappy.make
> @@ -0,0 +1,79 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2014 by Andreas Pretzsch <apr@cn-eng.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +PACKAGES-$(PTXCONF_TRIGGERHAPPY) += triggerhappy
> +
> +TRIGGERHAPPY_VERSION	:= 0.3.4
> +TRIGGERHAPPY_MD5	:= fa390c206432fafe899840e4b14a050d
> +TRIGGERHAPPY		:= triggerhappy-$(TRIGGERHAPPY_VERSION)
> +TRIGGERHAPPY_SUFFIX	:= tar.gz
> +TRIGGERHAPPY_URL	:= https://github.com/wertarbyte/triggerhappy.git;tag=release/$(TRIGGERHAPPY_VERSION)

use https://github.com/wertarbyte/triggerhappy/archive/release/0.3.4.tar.gz please.
It's basically the same and avoids the git download magic.

> +TRIGGERHAPPY_SOURCE	:= $(SRCDIR)/$(TRIGGERHAPPY).$(TRIGGERHAPPY_SUFFIX)
> +TRIGGERHAPPY_DIR	:= $(BUILDDIR)/$(TRIGGERHAPPY)
> +TRIGGERHAPPY_LICENSE	:= GPLv3+
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +TRIGGERHAPPY_CONF_TOOL	:= NO
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +TRIGGERHAPPY_PATH	:= PATH=$(CROSS_PATH)
> +TRIGGERHAPPY_MAKE_ENV	:= \
	$(CROSS_ENV) \
	EXTRAFLAGS="$(CROSS_CPPFLAGS) $(CROSS_LDFLAGS)"

break.

> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/triggerhappy.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, triggerhappy)
> +	@$(call install_fixup, triggerhappy,PRIORITY,optional)
> +	@$(call install_fixup, triggerhappy,SECTION,base)
> +	@$(call install_fixup, triggerhappy,AUTHOR,"Andreas Pretzsch <apr@cn-eng.de>")
> +	@$(call install_fixup, triggerhappy,DESCRIPTION,"thd - triggerhappy global hotkey daemon")
> +
> +	@$(call install_copy, triggerhappy, 0, 0, 0755, -, /usr/sbin/thd)
> +	@$(call install_copy, triggerhappy, 0, 0, 0755, -, /usr/sbin/th-cmd)
> +
> +ifdef PTXCONF_INITMETHOD_BBINIT
> +ifdef PTXCONF_TRIGGERHAPPY_STARTSCRIPT
> +	@$(call install_alternative, triggerhappy, 0, 0, 0755, /etc/init.d/triggerhappy)
> +	@$(call install_replace, triggerhappy, /etc/init.d/triggerhappy, \
> +		@TRIGGERS@, "$(PTXCONF_TRIGGERHAPPY_TRIGGERS)")
> +	@$(call install_replace, triggerhappy, /etc/init.d/triggerhappy, \
> +		@USER@, "$(PTXCONF_TRIGGERHAPPY_USER)")
> +	@$(call install_replace, triggerhappy, /etc/init.d/triggerhappy, \
> +		@INPUT_DEV@, "$(PTXCONF_TRIGGERHAPPY_INPUT_DEV)")
> +ifneq ($(call remove_quotes,$(PTXCONF_TRIGGERHAPPY_BBINIT_LINK)),)
> +	@$(call install_link, triggerhappy, \
> +		../init.d/triggerhappy, \
> +		/etc/rc.d/$(PTXCONF_TRIGGERHAPPY_BBINIT_LINK))
> +endif
> +endif
> +endif
> +
> +ifdef PTXCONF_TRIGGERHAPPY_TRIGGERS_FILE
> +	@$(call install_alternative, triggerhappy, 0, 0, 0644, \
		$(PTXCONF_TRIGGERHAPPY_TRIGGERS))

break

> +endif
> +ifdef PTXCONF_TRIGGERHAPPY_TRIGGERS_DIR
> +	@$(call install_alternative_tree, triggerhappy, 0, 0, $(PTXCONF_TRIGGERHAPPY_TRIGGERS))

same here.

Michael

> +endif
> +
> +	@$(call install_finish, triggerhappy)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.1.3
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2014-12-04 16:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 14:04 Andreas Pretzsch
2014-12-04 16:26 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141204162634.GD16181@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox