Fix passwd entries, from old format to new.

Change-Id: I78278f0cdc6b9b87bf9b3a14970a462037589d87
This commit is contained in:
Ben Gras 2014-06-17 17:51:52 +02:00 committed by Lionel Sambuc
parent cbb688a05d
commit fcce231cb7
3 changed files with 14 additions and 22 deletions

View file

@ -27,7 +27,7 @@ RAMDISK_DEFINES= \
PROTO= proto PROTO= proto
# Common to all architectures # Common to all architectures
ETC= system.conf master.passwd group ETC= system.conf group
EXTRA= rc EXTRA= rc
PROTO_FILES= proto.common.etc proto.common.dynamic PROTO_FILES= proto.common.etc proto.common.dynamic
PROG_DRIVERS= PROG_DRIVERS=
@ -97,7 +97,8 @@ PROGROOT:= ${.OBJDIR:S,/drivers/ramdisk,,}
# Generate dependencies rules for config files # Generate dependencies rules for config files
.for etc in ${ETC} .for etc in ${ETC}
${etc}: ${NETBSDSRCDIR}/etc/${etc} etc/${etc}: ${NETBSDSRCDIR}/etc/${etc}
mkdir -p ${.OBJDIR}/etc
${INSTALL} $> $@ ${INSTALL} $> $@
.endfor .endfor
@ -140,7 +141,7 @@ ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}:
.endfor # prog .endfor # prog
.endfor # srcdir .endfor # srcdir
realall image: proto.gen ${ETC} ${EXTRA} pwd.db spwd.db passwd group realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group
${_MKMSG_CREATE} "Generating ramdisk image" ${_MKMSG_CREATE} "Generating ramdisk image"
${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; } ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }
# if fsck.mfs -s image | grep -q CLEAN; \ # if fsck.mfs -s image | grep -q CLEAN; \
@ -150,17 +151,14 @@ realall image: proto.gen ${ETC} ${EXTRA} pwd.db spwd.db passwd group
# rm -f image; false; \ # rm -f image; false; \
# fi # fi
etc/pwd.db etc/spwd.db etc/passwd: etc/master.passwd
etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd
rm -rf ${.OBJDIR}/etc/ rm -rf ${.OBJDIR}/etc/
mkdir -p ${.OBJDIR}/etc mkdir -p ${.OBJDIR}/etc
${INSTALL} $> $@ ${INSTALL} $> $@
${TOOL_PWD_MKDB} -V 0 -p -d . etc/master.passwd ${TOOL_PWD_MKDB} -V 0 -p -d . etc/master.passwd
# LSC We use @F because some version of make still output a full path for @,
# even when the target is just a file name
pwd.db spwd.db passwd: etc/master.passwd
${INSTALL} etc/${@F} ${@F}
proto.dev.mtree: proto.dev.mtree:
@echo ". type=dir uname=root gname=operator mode=0755" \ @echo ". type=dir uname=root gname=operator mode=0755" \
>${.TARGET}.tmp && \ >${.TARGET}.tmp && \
@ -172,8 +170,8 @@ proto.dev.mtree:
# We have to remove the two first entries of the generated proto file, as # We have to remove the two first entries of the generated proto file, as
# well as the two last ones (closing $). # well as the two last ones (closing $).
# Do not forget to double $ so that make doesn't try to expand it. # Do not forget to double $ so that make doesn't try to expand it.
proto.dev: proto.dev.mtree pwd.db spwd.db passwd group proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group
${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR} -C -K device | \ ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \
${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \ ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \
${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \ ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \
mv ${.TARGET}.tmp ${.TARGET} mv ${.TARGET}.tmp ${.TARGET}

View file

@ -1,12 +1,12 @@
etc d--755 0 0 etc d--755 0 0
mtab s--555 2 1 /proc/mounts mtab s--555 2 1 /proc/mounts
system.conf ---644 0 0 system.conf system.conf ---644 0 0 etc/system.conf
passwd ---644 0 0 passwd passwd ---644 0 0 etc/passwd
pwd.db ---644 0 0 pwd.db pwd.db ---644 0 0 etc/pwd.db
spwd.db ---600 0 0 spwd.db spwd.db ---600 0 0 etc/spwd.db
master.passwd ---600 0 0 master.passwd master.passwd ---600 0 0 etc/master.passwd
rc ---755 0 0 rc rc ---755 0 0 rc
#if defined(__i386__) #if defined(__i386__)
rs.single ---755 0 0 rs.single rs.single ---755 0 0 etc/rs.single
#endif #endif
$ $

View file

@ -439,15 +439,9 @@ main(int argc, char *argv[])
* Create original format password file entry. * Create original format password file entry.
*/ */
if (makeold) { if (makeold) {
#if defined(__minix)
(void)fprintf(oldfp, "%s:##%s:%d:%d:%s:%s:%s\n",
pwd.pw_name, pwd.pw_name, pwd.pw_uid, pwd.pw_gid,
pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
#else
(void)fprintf(oldfp, "%s:*:%d:%d:%s:%s:%s\n", (void)fprintf(oldfp, "%s:*:%d:%d:%s:%s:%s\n",
pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos, pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos,
pwd.pw_dir, pwd.pw_shell); pwd.pw_dir, pwd.pw_shell);
#endif /* defined(__minix) */
if (ferror(oldfp)) if (ferror(oldfp))
wr_error(oldpwdfile); wr_error(oldpwdfile);
} }