diff options
author | Alex Colomar <a.colomar@f5.com> | 2022-10-11 16:00:06 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@nginx.com> | 2022-10-20 15:50:05 +0200 |
commit | f93361979a9f612b59470640c3566f5cb66c3eaf (patch) | |
tree | 25a44efa6f0f0303584ffb2d48ecc4339af88d8b /auto/make | |
parent | bbf1f4da0fe19c51253400a2cef58b8bac28fb25 (diff) | |
download | unit-f93361979a9f612b59470640c3566f5cb66c3eaf.tar.gz unit-f93361979a9f612b59470640c3566f5cb66c3eaf.tar.bz2 |
Avoided modifying existing directories at 'make install'.
'install -d' has an issue compared to 'mkdir -p': it doesn't
respect existing directories. It will set the ownership, file
mode, and SELinux contexts (and any other property that would be
set by install(1) to a newly-created directory), overwriting any
existing properties of the existing directory.
'mkdir -p' doesn't have this issue: it is a no-op if the
directory exists. However, it's not an ideal solution either,
since it can't be used to set the properties (owner, mode, ...) of
a newly-created directory.
Therefore, the best solution is to use install(1), but only after
making sure that the directory doesn't exist with test(1).
Reported-by: Andrew Clayton <a.clayton@nginx.com>
Reported-by: Alejandro Colomar <alx@nginx.com>
Closes: <https://github.com/nginx/unit/issues/769>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
Tested-by: Andrew Clayton <a.clayton@nginx.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r-- | auto/make | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -363,12 +363,15 @@ install-check: exit 1) ${NXT_DAEMON}-install: $NXT_DAEMON install-check - install -d \$(DESTDIR)$NXT_SBINDIR + test -d \$(DESTDIR)$NXT_SBINDIR \ + || install -d \$(DESTDIR)$NXT_SBINDIR install -p $NXT_BUILD_DIR/$NXT_DAEMON \$(DESTDIR)$NXT_SBINDIR/ - install -d \$(DESTDIR)$NXT_STATE + test -d \$(DESTDIR)$NXT_STATE \ + || install -d \$(DESTDIR)$NXT_STATE manpage-install: manpage install-check - install -d \$(DESTDIR)$NXT_MANDIR/man8 + test -d \$(DESTDIR)$NXT_MANDIR/man8 \ + || install -d \$(DESTDIR)$NXT_MANDIR/man8 install -p -m644 $NXT_BUILD_DIR/unitd.8 \$(DESTDIR)$NXT_MANDIR/man8/ .PHONY: uninstall ${NXT_DAEMON}-uninstall manpage-uninstall @@ -390,10 +393,12 @@ cat << END >> $NXT_MAKEFILE .PHONY: libunit-install libunit-uninstall libunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC - install -d \$(DESTDIR)$NXT_LIBDIR + test -d \$(DESTDIR)$NXT_LIBDIR \ + || install -d \$(DESTDIR)$NXT_LIBDIR install -p -m u=rw,go=r $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \ \$(DESTDIR)$NXT_LIBDIR/ - install -d \$(DESTDIR)$NXT_INCDIR + test -d \$(DESTDIR)$NXT_INCDIR \ + || install -d \$(DESTDIR)$NXT_INCDIR install -p -m u=rw,go=r src/nxt_unit.h \ src/nxt_unit_field.h \ src/nxt_unit_request.h \ |