All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Adam Duskett <aduskett@gmail.com>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>,
	Anisse Astier <anisse@astier.eu>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 3/5] package/mender/S42mender: fix check-pkg and shellcheck warnings
Date: Wed, 22 Jun 2022 22:35:37 +0200	[thread overview]
Message-ID: <20220622203537.GD2608@scaer> (raw)
In-Reply-To: <20220622184824.289640-3-aduskett@gmail.com>

Adam, All,

On 2022-06-22 11:48 -0700, Adam Duskett spake thusly:
> Copy the basic syntax of package/polkit/S50polkit and change the following:
> 
>   - Add DAEMON, DAEMON_PATH, PIDFILE and DAEMON_ARGS variables.
>   - Fix shellcheck warning SC2166 on line 16.
>   - Fix shellcheck warning SC2181 on lines 29 and 34 by assigning the return
>     code from the start-stop-daemon binary to a variable, and then check the
>     value of the variable.
> 
> Signed-off-by: Adam Duskett <aduskett@gmail.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  package/mender/S42mender | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/package/mender/S42mender b/package/mender/S42mender
> index dc60f94f8b..29008beca0 100644
> --- a/package/mender/S42mender
> +++ b/package/mender/S42mender
> @@ -2,6 +2,10 @@
>  #
>  # Starts mender service.
>  #
> +DAEMON="mender"
> +DAEMON_PATH="/usr/bin/mender"
> +PIDFILE="/var/run/${DAEMON}.pid"
> +DAEMON_ARGS="-daemon"
>  
>  start() {
>  	# If /var/lib/mender is a symlink to /var/run/mender, and
> @@ -9,8 +13,7 @@ start() {
>  	#     create the directory pointed to by the symlink.
>  	#   - the filesystem is RW (i.e. we can rm the symlink),
>  	#     replace the symlink with an actual directory
> -	if [ -L /var/lib/mender \
> -	     -a "$(readlink /var/lib/mender)" = "/var/run/mender" ]
> +	if [ -L /var/lib/mender ] && [ "$(readlink /var/lib/mender)" = "/var/run/mender" ]
>  	then
>  		if rm -f /var/lib/mender >/dev/null 2>&1; then
>  			mkdir -p /var/lib/mender
> @@ -23,15 +26,16 @@ start() {
>  
>  	printf "Starting mender service: "
>  	umask 077
> -
> -	start-stop-daemon -S -q -b -m -p /var/run/mender.pid \
> -		--exec /usr/bin/mender -- daemon
> -	[ $? = 0 ] && echo "OK" || echo "FAIL"
> +	start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${DAEMON_ARGS}
> +	status=$?
> +	[ "${status}" = 0 ] && echo "OK" || echo "FAIL"
>  }
> +
>  stop() {
>  	printf "Stopping mender service: "
> -	start-stop-daemon -K -q -p /var/run/mender.pid
> -	[ $? = 0 ] && echo "OK" || echo "FAIL"
> +	start-stop-daemon -Kqp "$PIDFILE"
> +	status=$?
> +	[ "${status}" = 0 ] && echo "OK" || echo "FAIL"
>  }
>  restart() {
>  	stop
> @@ -49,7 +53,7 @@ case "$1" in
>  		restart
>  		;;
>  	*)
> -		echo "Usage: $0 {start|stop|restart}"
> +		echo "Usage: $0 {start|stop|reload|restart}"
>  		exit 1
>  esac
>  
> -- 
> 2.36.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-06-22 20:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 18:48 [Buildroot] [PATCH 1/5] package/mender: bump to version 3.3.0 Adam Duskett
2022-06-22 18:48 ` [Buildroot] [PATCH 2/5] package/mender/mender.mk: add bootloader-integration inventory script Adam Duskett
2022-06-22 18:48 ` [Buildroot] [PATCH 3/5] package/mender/S42mender: fix check-pkg and shellcheck warnings Adam Duskett
2022-06-22 20:35   ` Yann E. MORIN [this message]
2022-06-22 18:48 ` [Buildroot] [PATCH 4/5] package/mender-artifact: bump version to 3.8.0 Adam Duskett
2022-06-22 18:48 ` [Buildroot] [PATCH 5/5] package/mender-connect: new package Adam Duskett
2022-07-23 20:10   ` Arnout Vandecappelle
2022-07-23 20:18 ` [Buildroot] [PATCH 1/5] package/mender: bump to version 3.3.0 Arnout Vandecappelle

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=20220622203537.GD2608@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=aduskett@gmail.com \
    --cc=angelo.compagnucci@gmail.com \
    --cc=anisse@astier.eu \
    --cc=buildroot@buildroot.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.