All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss@m4x.org>
To: bauen1 <j2468h@googlemail.com>
Cc: SElinux list <selinux@vger.kernel.org>,
	Petr Lautrbach <plautrba@redhat.com>
Subject: Re: [PATCH v2] policycoreutils: sestatus belongs to bin not sbin
Date: Sun, 21 Feb 2021 14:30:37 +0100	[thread overview]
Message-ID: <CAJfZ7=mP1-B-VqGdYwN1MwB7pVzdzsJJY2a_W4_uRWdoiiN9Vw@mail.gmail.com> (raw)
In-Reply-To: <a88cc4b7-273d-6d1c-6b63-06b139442878@gmail.com>

On Thu, Feb 18, 2021 at 7:33 PM bauen1 <j2468h@googlemail.com> wrote:
>
> It is quite useful even to non-privileged users and doesn't require any
> privileges to work, except for maybe -v.
>
> Some tools hard code the old path, so a compatibility symlink is also
> created.
>
> Signed-off-by: Jonathan Hettwer <j2468h@gmail.com>
> ---
>  policycoreutils/sestatus/Makefile | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/policycoreutils/sestatus/Makefile b/policycoreutils/sestatus/Makefile
> index 8c4f45f8..e108f96f 100644
> --- a/policycoreutils/sestatus/Makefile
> +++ b/policycoreutils/sestatus/Makefile
> @@ -1,6 +1,7 @@
>  # Installation directories.
>  LINGUAS ?= ru
>  PREFIX ?= /usr
> +BINDIR ?= $(PREFIX)/bin
>  SBINDIR ?= $(PREFIX)/sbin
>  MANDIR = $(PREFIX)/share/man
>  ETCDIR ?= /etc
> @@ -16,8 +17,13 @@ sestatus: sestatus.o
>  install: all
>         [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
>         [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5
> +       -mkdir -p $(DESTDIR)$(BINDIR)
>         -mkdir -p $(DESTDIR)$(SBINDIR)
> -       install -m 755 sestatus $(DESTDIR)$(SBINDIR)
> +       # Some tools hardcode /usr/sbin/sestatus ; add a compatibility symlink
> +       # install will overwrite a symlink, so create the symlink before calling
> +       # install to allow distributions with BINDIR == SBINDIR
> +       ln -s ../bin/sestatus $(DESTDIR)$(SBINDIR)

This assumes that $(BINDIR) == $(SBINDIR)/../bin, which is likely to
be true but which would break if not. Moreover, not using "-f" breaks
running "make install" twice:

ln -s ../bin/sestatus /my-DESTDIR/usr/sbin
ln: failed to create symbolic link '/my-DESTDIR/usr/sbin/sestatus': File exists

To fix both these issues, you can add --relative and -f like other
Makefiles in the project:

ln -sf --relative $(DESTDIR)$(BINDIR)/sestatus $(DESTDIR)$(SBINDIR)

Doing this seems to work fine on my test system. Could you please send
a v3 with this?

By the way I confirm that this v2 addresses the previous comments I
made on the first version of this patch, thanks!
Nicolas


      reply	other threads:[~2021-02-21 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 20:43 [PATCH] policycoretuils: sestatus belongs to bin not sbin bauen1
2021-02-16 21:31 ` Nicolas Iooss
2021-02-17 16:29   ` bauen1
2021-02-17 16:32   ` Petr Lautrbach
2021-02-18 18:33   ` [PATCH v2] policycoreutils: " bauen1
2021-02-21 13:30     ` Nicolas Iooss [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='CAJfZ7=mP1-B-VqGdYwN1MwB7pVzdzsJJY2a_W4_uRWdoiiN9Vw@mail.gmail.com' \
    --to=nicolas.iooss@m4x.org \
    --cc=j2468h@googlemail.com \
    --cc=plautrba@redhat.com \
    --cc=selinux@vger.kernel.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.