etcforce and etcfiles fixup

The way etcfiles was re-implemented was wrong as it would overwrite the
password database. This patch adds back a proper etcfiles (safe) target,
and a etcforce (unsafe) target.

Change-Id: I141c37b29a449fca1ee362b7416750be0298dbfb
This commit is contained in:
Lionel Sambuc 2012-11-19 14:36:33 +01:00
parent 420b1799d9
commit 0181ec6beb
2 changed files with 23 additions and 4 deletions

View file

@ -244,7 +244,7 @@ BUILDTARGETS+= do-lib
.if !defined(__MINIX) .if !defined(__MINIX)
# LSC Not used in MINIX3 # LSC Not used in MINIX3
BUILDTARGETS+= do-compat-lib BUILDTARGETS+= do-compat-lib
.endif # !defiend(__MINIX) .endif # !defined(__MINIX)
BUILDTARGETS+= do-build BUILDTARGETS+= do-build
.if ${MKX11} != "no" .if ${MKX11} != "no"
BUILDTARGETS+= do-x11 BUILDTARGETS+= do-x11
@ -270,15 +270,18 @@ START_TIME!= date
.if defined(__MINIX) .if defined(__MINIX)
world: build .PHONY .MAKE world: build .PHONY .MAKE
${MAKEDIRTARGET} . etcforce ${MAKEDIRTARGET} . etcfiles
@echo "WARNING: " @echo "WARNING: "
@echo "WARNING: The 'world' target is obsolete, please use 'build' instead." @echo "WARNING: The 'world' target is obsolete, please use 'build' instead."
@echo "WARNING: " @echo "WARNING: "
etcfiles: .PHONY .MAKE
${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/}
etcforce: .PHONY .MAKE etcforce: .PHONY .MAKE
${MAKEDIRTARGET} etc install-etc-files DESTDIR=${DESTDIR:U/} ${MAKEDIRTARGET} etc install-etc-files DESTDIR=${DESTDIR:U/}
.endif # defiend(__MINIX) .endif # defined(__MINIX)
build: .PHONY .MAKE build: .PHONY .MAKE
.if defined(BUILD_DONE) .if defined(BUILD_DONE)

View file

@ -317,13 +317,29 @@ CONFIGSYMLINKS+= \
# install-etc-files -- # install-etc-files --
# Install etc (config) files; not performed by "make build" # Install etc (config) files; not performed by "make build"
# #
# LSC Minix administrator group is operator, not wheel
install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
${ETC_INSTALL_FILE} -o root -g operator -m 600 \ ${ETC_INSTALL_FILE} -o root -g operator -m 600 \
master.passwd ${DESTDIR}/etc master.passwd ${DESTDIR}/etc
${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
${DESTDIR}/etc/master.passwd ${DESTDIR}/etc/master.passwd
.if defined(__MINIX)
# LSC: We need a safe install target for etc files, as this is expected from
# our current user base. This safe version only leaves out the master.passwd
# file in order not to loose any user account created.
#
# LSC: To ensure minimal modifications, the logic is a bit contrived, i.e. the
# NetBSD build system expect install-etc-files to be unsafe, so what was done
# is to separate that step into two steps, with the unsafe version refering
# (not by dependency, to ensure correct order of actions) the safe step, and
# use the following mapping in the main Makefile:
# etcforce -> install-etc-files (default NetBSD target)
# etcfiles -> install-etc-files-safe (new -safe- target)
${MAKEDIRTARGET} . install-etc-files-safe
install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV
# LSC Minix administrator group is operator, not wheel
.endif # defined(__MINIX)
.if ${MKUNPRIVED} != "no" .if ${MKUNPRIVED} != "no"
( \ ( \
for metaent in passwd pwd.db spwd.db; do \ for metaent in passwd pwd.db spwd.db; do \