Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] package/restorecond: Fix restorecond init script.
Date: Thu, 20 Feb 2020 19:15:28 +0100	[thread overview]
Message-ID: <20200220191528.09723ed0@windsurf> (raw)
In-Reply-To: <20200204100942.421804-1-aduskett@gmail.com>

Hello,

On Tue,  4 Feb 2020 02:09:42 -0800
Adam Duskett <aduskett@gmail.com> wrote:

> diff --git a/package/restorecond/S20restorecond b/package/restorecond/S20restorecond
> new file mode 100644
> index 0000000000..1abf678177
> --- /dev/null
> +++ b/package/restorecond/S20restorecond

This script needs to be rewritten to follow the coding style / best
practices of package/busybox/S01syslogd, which is our reference init
script.

> @@ -0,0 +1,45 @@
> +#!/bin/sh
> +RESTORECOND=/usr/sbin/restorecond
> +PIDFILE=/run/restorecond.pid
> +if [ -x /usr/sbin/selinuxenabled ]; then

Do we need to check if it's available ? Isn't selinuxenabled one of the
dependencies of this package anyway ?

> +  if ! /usr/sbin/selinuxenabled; then
> +    echo "Selinux is not enabled!"
> +    exit 7

Why 7 ?

> +  fi
> +fi
> +
> +# Check that we are root ... so non-root users stop here
> +if [ $EUID != 0 ]; then
> +  echo "Restorecond must be ran as root!"

Useless, init scripts in Buildroot are executed as root.

> +  exit 4
> +fi
> +
> +test -x /usr/sbin/restorecond  || exit 5
> +test -f /etc/selinux/restorecond.conf  || exit 6

Please drop these checks as well.

> +
> +case "$1" in
> +  start)
> +    echo "Starting restorecond..."
> +    unset HOME MAIL USER USERNAME
> +    start-stop-daemon -S -x "${RESTORECOND}" -p "${PIDFILE}"
> +  ;;
> +  stop)
> +  echo "Stopping restorecond..."
> +  start-stop-daemon -K -x "${RESTORECOND}" -p "${PIDFILE}" -o
> +  ;;
> +  reload|force-reload)
> +  echo "Reloading restorecond..."
> +  restart
> +  ;;
> +  restart)
> +  stop
> +  start

Follow the coding style of package/busybox/S01syslogd here.

> +  condrestart)
> +  [ -e /var/lock/subsys/restorecond ] && restart

We don't have any condrestart target in any other script.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2020-02-20 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 10:09 [Buildroot] [PATCH 1/1] package/restorecond: Fix restorecond init script Adam Duskett
2020-02-20 18:15 ` Thomas Petazzoni [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=20200220191528.09723ed0@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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