nrelease: Improve 'etc.hdd' creation to eliminate inconsistency
authorAaron LI <aly@aaronly.me>
Wed, 8 Feb 2023 14:39:47 +0000 (22:39 +0800)
committerAaron LI <aly@aaronly.me>
Sat, 25 Feb 2023 11:11:18 +0000 (19:11 +0800)
commit3f84c424c7a4c0033330ff959d8950c6cc74c9fc
treeccb67a74f41498a0a56ead6cec3048e0f12a42a4
parent46c51ac56ab9d1bd9ff569701c346c7a56c24956
nrelease: Improve 'etc.hdd' creation to eliminate inconsistency

Previously, the 'etc.hdd' was created during the 'buildiso' target and
then updated in the 'pkgs' target.  However, in the 'pkgs' target, only
the password files (i.e., master.passwd, passwd, group) were copied but
the password DBs (i.e., pwd.db, spwd.db) were not rebuild.  This caused
an inconsistency in 'etc.hdd'.  When a user tried manual installation
and forgot to run 'pwd_mkdb', the installed system would fail to add new
users and generate errors like:

> pw: user 'myuser' disappeared during update.
> adduser: ERROR: There was an error adding user (myuser).

This commit improves the creation of 'etc.hdd'.  Reorder the 'customiso'
target *after* the 'pkgs' target, so we can simply copy the 'etc' to
'etc.hdd' and be done, without any further changes, and the resulting
password files and DBs are in consistency.  In addition, this avoids
adding the 'installer' user to the 'etc.hdd' and so we get a cleaner
system by default.

See also: https://lists.dragonflybsd.org/pipermail/users/2023-February/428576.html
(Regenerating the password databases on new installs)
nrelease/Makefile