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>
This commit is contained in:
committed by
Alejandro Colomar
parent
bbf1f4da0f
commit
f93361979a
15
auto/make
15
auto/make
@@ -363,12 +363,15 @@ install-check:
|
|||||||
exit 1)
|
exit 1)
|
||||||
|
|
||||||
${NXT_DAEMON}-install: $NXT_DAEMON install-check
|
${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 -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
|
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/
|
install -p -m644 $NXT_BUILD_DIR/unitd.8 \$(DESTDIR)$NXT_MANDIR/man8/
|
||||||
|
|
||||||
.PHONY: uninstall ${NXT_DAEMON}-uninstall manpage-uninstall
|
.PHONY: uninstall ${NXT_DAEMON}-uninstall manpage-uninstall
|
||||||
@@ -390,10 +393,12 @@ cat << END >> $NXT_MAKEFILE
|
|||||||
.PHONY: libunit-install libunit-uninstall
|
.PHONY: libunit-install libunit-uninstall
|
||||||
|
|
||||||
libunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
|
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 \
|
install -p -m u=rw,go=r $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \
|
||||||
\$(DESTDIR)$NXT_LIBDIR/
|
\$(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 \
|
install -p -m u=rw,go=r src/nxt_unit.h \
|
||||||
src/nxt_unit_field.h \
|
src/nxt_unit_field.h \
|
||||||
src/nxt_unit_request.h \
|
src/nxt_unit_request.h \
|
||||||
|
|||||||
Reference in New Issue
Block a user