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.
This commit is contained in:
Dave Reisner 2019-07-31 13:09:36 -04:00 committed by Serge Hallyn
parent 13c618465d
commit 2cac079ef4

View File

@ -2,8 +2,8 @@
EXTRA_DIST = \ EXTRA_DIST = \
.indent.pro .indent.pro
ubindir = ${prefix}/bin ubindir = ${bindir}
usbindir = ${prefix}/sbin usbindir = ${sbindir}
suidperms = 4755 suidperms = 4755
sgidperms = 2755 sgidperms = 2755
@ -52,13 +52,14 @@ usbin_PROGRAMS = \
# id and groups are from gnu, sulogin from sysvinit # id and groups are from gnu, sulogin from sysvinit
noinst_PROGRAMS = id sulogin noinst_PROGRAMS = id sulogin
suidusbins =
suidbins = su suidbins = su
suidubins = chage chfn chsh expiry gpasswd newgrp suidubins = chage chfn chsh expiry gpasswd newgrp
if !WITH_TCB if !WITH_TCB
suidubins += passwd suidubins += passwd
endif endif
if ACCT_TOOLS_SETUID 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 endif
if ENABLE_SUBIDS if ENABLE_SUBIDS
if !FCAPS if !FCAPS
@ -134,6 +135,9 @@ install-am: all-am
for i in $(suidubins); do \ for i in $(suidubins); do \
chmod $(suidperms) $(DESTDIR)$(ubindir)/$$i; \ chmod $(suidperms) $(DESTDIR)$(ubindir)/$$i; \
done done
for i in $(suidusbins); do \
chmod $(suidperms) $(DESTDIR)$(usbindir)/$$i; \
done
if WITH_TCB if WITH_TCB
for i in $(shadowsgidubins); do \ for i in $(shadowsgidubins); do \
chown root:shadow $(DESTDIR)$(ubindir)/$$i; \ chown root:shadow $(DESTDIR)$(ubindir)/$$i; \