mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] weston: Add init script
@ 2019-12-12 12:54 Guillermo Rodríguez
  2020-01-06 11:18 ` Michael Olbrich
  2020-01-07 15:28 ` [ptxdist] [PATCH v2] " Guillermo Rodríguez
  0 siblings, 2 replies; 4+ messages in thread
From: Guillermo Rodríguez @ 2019-12-12 12:54 UTC (permalink / raw)
  To: ptxdist; +Cc: Guillermo Rodríguez

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
---
 projectroot/etc/init.d/weston-init | 29 +++++++++++++++++++++++++++++
 rules/weston.make                  |  4 ++++
 2 files changed, 33 insertions(+)
 create mode 100644 projectroot/etc/init.d/weston-init

diff --git a/projectroot/etc/init.d/weston-init b/projectroot/etc/init.d/weston-init
new file mode 100644
index 000000000..fa6b96b07
--- /dev/null
+++ b/projectroot/etc/init.d/weston-init
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+start() {
+	OPENVT_ARGS="-c 1 -s"
+	WESTON_ARGS="--log=/var/log/weston.log"
+
+	test -f /etc/default/weston-init && . /etc/default/weston-init
+
+	if [ -z "$XDG_RUNTIME_DIR" ]; then
+		export XDG_RUNTIME_DIR=/run/xdg
+		mkdir -p "$XDG_RUNTIME_DIR"
+		chmod 0700 "$XDG_RUNTIME_DIR"
+	fi
+
+	echo "Starting Weston"
+	exec openvt $OPENVT_ARGS -- weston $WESTON_ARGS
+}
+
+stop() {
+	echo "Stopping Weston"
+	killall -q weston
+}
+
+case $1 in
+	start|stop) $1 ;;
+	restart) stop ; sleep 1 ; start ;;
+
+	*) echo "Usage: $0 {start|stop|restart}"; exit 1 ;;
+esac
diff --git a/rules/weston.make b/rules/weston.make
index 4c38fd2d1..406b0fd48 100644
--- a/rules/weston.make
+++ b/rules/weston.make
@@ -170,6 +170,10 @@ endif
 ifdef PTXCONF_WESTON_SYSTEMD
 	@$(call install_lib, weston, 0, 0, 0644, weston/systemd-notify)
 endif
+ifdef PTXCONF_INITMETHOD_BBINIT
+	@$(call install_alternative, weston, 0, 0, 0755, /etc/init.d/weston-init)
+	@$(call install_link, weston, ../init.d/weston-init, /etc/rc.d/S92weston-init)
+endif
 
 	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-simple-im)
 	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-desktop-shell)
-- 
2.21.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] weston: Add init script
  2019-12-12 12:54 [ptxdist] [PATCH] weston: Add init script Guillermo Rodríguez
@ 2020-01-06 11:18 ` Michael Olbrich
  2020-01-07 10:08   ` Guillermo Rodriguez Garcia
  2020-01-07 15:28 ` [ptxdist] [PATCH v2] " Guillermo Rodríguez
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Olbrich @ 2020-01-06 11:18 UTC (permalink / raw)
  To: ptxdist

On Thu, Dec 12, 2019 at 01:54:57PM +0100, Guillermo Rodríguez wrote:
> Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
> ---

Please take a look at how other packages handle this. You'll need a
WESTON_STARTSCRIPT option in weston.in and weston-bbinit.in for the link.

Michael

>  projectroot/etc/init.d/weston-init | 29 +++++++++++++++++++++++++++++
>  rules/weston.make                  |  4 ++++
>  2 files changed, 33 insertions(+)
>  create mode 100644 projectroot/etc/init.d/weston-init
> 
> diff --git a/projectroot/etc/init.d/weston-init b/projectroot/etc/init.d/weston-init
> new file mode 100644
> index 000000000..fa6b96b07
> --- /dev/null
> +++ b/projectroot/etc/init.d/weston-init
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +
> +start() {
> +	OPENVT_ARGS="-c 1 -s"
> +	WESTON_ARGS="--log=/var/log/weston.log"
> +
> +	test -f /etc/default/weston-init && . /etc/default/weston-init
> +
> +	if [ -z "$XDG_RUNTIME_DIR" ]; then
> +		export XDG_RUNTIME_DIR=/run/xdg
> +		mkdir -p "$XDG_RUNTIME_DIR"
> +		chmod 0700 "$XDG_RUNTIME_DIR"
> +	fi
> +
> +	echo "Starting Weston"
> +	exec openvt $OPENVT_ARGS -- weston $WESTON_ARGS
> +}
> +
> +stop() {
> +	echo "Stopping Weston"
> +	killall -q weston
> +}
> +
> +case $1 in
> +	start|stop) $1 ;;
> +	restart) stop ; sleep 1 ; start ;;
> +
> +	*) echo "Usage: $0 {start|stop|restart}"; exit 1 ;;
> +esac
> diff --git a/rules/weston.make b/rules/weston.make
> index 4c38fd2d1..406b0fd48 100644
> --- a/rules/weston.make
> +++ b/rules/weston.make
> @@ -170,6 +170,10 @@ endif
>  ifdef PTXCONF_WESTON_SYSTEMD
>  	@$(call install_lib, weston, 0, 0, 0644, weston/systemd-notify)
>  endif
> +ifdef PTXCONF_INITMETHOD_BBINIT
> +	@$(call install_alternative, weston, 0, 0, 0755, /etc/init.d/weston-init)
> +	@$(call install_link, weston, ../init.d/weston-init, /etc/rc.d/S92weston-init)
> +endif
>  
>  	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-simple-im)
>  	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-desktop-shell)
> -- 
> 2.21.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] weston: Add init script
  2020-01-06 11:18 ` Michael Olbrich
@ 2020-01-07 10:08   ` Guillermo Rodriguez Garcia
  0 siblings, 0 replies; 4+ messages in thread
From: Guillermo Rodriguez Garcia @ 2020-01-07 10:08 UTC (permalink / raw)
  To: ptxdist

El lun., 6 ene. 2020 a las 12:18, Michael Olbrich
(<m.olbrich@pengutronix.de>) escribió:
>
> On Thu, Dec 12, 2019 at 01:54:57PM +0100, Guillermo Rodríguez wrote:
> > Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
> > ---
>
> Please take a look at how other packages handle this. You'll need a
> WESTON_STARTSCRIPT option in weston.in and weston-bbinit.in for the link.

I had looked at Avahi. Apparently it is the only package that does it
in a different way :-/

Will submit a v2, thank you.

Guillermo

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ptxdist] [PATCH v2] weston: Add init script
  2019-12-12 12:54 [ptxdist] [PATCH] weston: Add init script Guillermo Rodríguez
  2020-01-06 11:18 ` Michael Olbrich
@ 2020-01-07 15:28 ` Guillermo Rodríguez
  1 sibling, 0 replies; 4+ messages in thread
From: Guillermo Rodríguez @ 2020-01-07 15:28 UTC (permalink / raw)
  To: ptxdist; +Cc: Guillermo Rodríguez

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
---
v2: Proper handling of init script and link

 projectroot/etc/init.d/weston-init | 29 +++++++++++++++++++++++++++++
 rules/weston-bbinit.in             |  8 ++++++++
 rules/weston.in                    |  5 +++++
 rules/weston.make                  | 11 +++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 projectroot/etc/init.d/weston-init
 create mode 100644 rules/weston-bbinit.in

diff --git a/projectroot/etc/init.d/weston-init b/projectroot/etc/init.d/weston-init
new file mode 100644
index 000000000..fa6b96b07
--- /dev/null
+++ b/projectroot/etc/init.d/weston-init
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+start() {
+	OPENVT_ARGS="-c 1 -s"
+	WESTON_ARGS="--log=/var/log/weston.log"
+
+	test -f /etc/default/weston-init && . /etc/default/weston-init
+
+	if [ -z "$XDG_RUNTIME_DIR" ]; then
+		export XDG_RUNTIME_DIR=/run/xdg
+		mkdir -p "$XDG_RUNTIME_DIR"
+		chmod 0700 "$XDG_RUNTIME_DIR"
+	fi
+
+	echo "Starting Weston"
+	exec openvt $OPENVT_ARGS -- weston $WESTON_ARGS
+}
+
+stop() {
+	echo "Stopping Weston"
+	killall -q weston
+}
+
+case $1 in
+	start|stop) $1 ;;
+	restart) stop ; sleep 1 ; start ;;
+
+	*) echo "Usage: $0 {start|stop|restart}"; exit 1 ;;
+esac
diff --git a/rules/weston-bbinit.in b/rules/weston-bbinit.in
new file mode 100644
index 000000000..f0994d27e
--- /dev/null
+++ b/rules/weston-bbinit.in
@@ -0,0 +1,8 @@
+## SECTION=initmethod_bbinit
+
+config WESTON_BBINIT_LINK
+	string
+	depends on WESTON_STARTSCRIPT
+	prompt "weston-init"
+	default "S92weston-init"
+
diff --git a/rules/weston.in b/rules/weston.in
index d2ef2119b..75945d7e6 100644
--- a/rules/weston.in
+++ b/rules/weston.in
@@ -75,6 +75,11 @@ config WESTON_LAUNCH
 	  weston-launch is a setuid-root program which does privileged
 	  operations on Weston's behalf
 
+config WESTON_STARTSCRIPT
+	bool
+	default INITMETHOD_BBINIT
+	prompt "install /etc/init.d/weston-init"
+
 config WESTON_SYSTEMD
 	bool
 	default INITMETHOD_SYSTEMD
diff --git a/rules/weston.make b/rules/weston.make
index 4c38fd2d1..eaabebe61 100644
--- a/rules/weston.make
+++ b/rules/weston.make
@@ -171,6 +171,17 @@ ifdef PTXCONF_WESTON_SYSTEMD
 	@$(call install_lib, weston, 0, 0, 0644, weston/systemd-notify)
 endif
 
+ifdef PTXCONF_INITMETHOD_BBINIT
+ifdef PTXCONF_WESTON_STARTSCRIPT
+	@$(call install_alternative, weston, 0, 0, 0755, /etc/init.d/weston-init)
+ifneq ($(call remove_quotes,$(PTXCONF_WESTON_BBINIT_LINK)),)
+	@$(call install_link, weston, \
+		../init.d/weston-init, \
+		/etc/rc.d/$(PTXCONF_WESTON_BBINIT_LINK))
+endif
+endif
+endif
+
 	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-simple-im)
 	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-desktop-shell)
 	@$(call install_copy, weston, 0, 0, 0755, -, /usr/libexec/weston-keyboard)
-- 
2.21.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-07 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 12:54 [ptxdist] [PATCH] weston: Add init script Guillermo Rodríguez
2020-01-06 11:18 ` Michael Olbrich
2020-01-07 10:08   ` Guillermo Rodriguez Garcia
2020-01-07 15:28 ` [ptxdist] [PATCH v2] " Guillermo Rodríguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox