From 2cac079ef4b26b078cddc25e63df11868ee93ed4 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 31 Jul 2019 13:09:36 -0400 Subject: [PATCH] Honor --sbindir and --bindir for binary installation Some distros don't care about the split between /bin, /sbin, /usr/bin, and /usr/sbin, so let them easily stuff binaries wherever they want. This also fixes a problem during installation where-in a loop of 'chmod 4755' calls will mostly fail. However, because the last two succeed (newuidmap/newgidmap), make considers the command to be a success. Somewhat not-amusingly, configuring shadow with --with-fcaps will cause installation to fail because the final chmod call is now a failing one. --- src/Makefile.am | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 34690ced..f7f132ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,8 @@ EXTRA_DIST = \ .indent.pro -ubindir = ${prefix}/bin -usbindir = ${prefix}/sbin +ubindir = ${bindir} +usbindir = ${sbindir} suidperms = 4755 sgidperms = 2755 @@ -52,13 +52,14 @@ usbin_PROGRAMS = \ # id and groups are from gnu, sulogin from sysvinit noinst_PROGRAMS = id sulogin +suidusbins = suidbins = su suidubins = chage chfn chsh expiry gpasswd newgrp if !WITH_TCB suidubins += passwd endif if ACCT_TOOLS_SETUID -suidubins += chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod +suidusbins += chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod endif if ENABLE_SUBIDS if !FCAPS @@ -134,6 +135,9 @@ install-am: all-am for i in $(suidubins); do \ chmod $(suidperms) $(DESTDIR)$(ubindir)/$$i; \ done + for i in $(suidusbins); do \ + chmod $(suidperms) $(DESTDIR)$(usbindir)/$$i; \ + done if WITH_TCB for i in $(shadowsgidubins); do \ chown root:shadow $(DESTDIR)$(ubindir)/$$i; \