]> Zhao Yanbai Git Server - minix.git/commitdiff
Fix passwd entries, from old format to new.
authorBen Gras <ben@minix3.org>
Tue, 17 Jun 2014 15:51:52 +0000 (17:51 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:53 +0000 (17:05 +0200)
Change-Id: I78278f0cdc6b9b87bf9b3a14970a462037589d87

drivers/ramdisk/Makefile
drivers/ramdisk/proto.common.etc
usr.sbin/pwd_mkdb/pwd_mkdb.c

index ccbccfbd03248f7eba31247b1df68fd002ea1847..606b11f026f3ddc069451cbe1c0804de2f9c1ebe 100644 (file)
@@ -27,7 +27,7 @@ RAMDISK_DEFINES= \
 PROTO= proto
 
 # Common to all architectures
-ETC=           system.conf master.passwd group
+ETC=           system.conf group
 EXTRA=         rc
 PROTO_FILES=   proto.common.etc proto.common.dynamic
 PROG_DRIVERS=
@@ -97,7 +97,8 @@ PROGROOT:= ${.OBJDIR:S,/drivers/ramdisk,,}
 
 # Generate dependencies rules for config files
 .for etc in ${ETC}
-${etc}: ${NETBSDSRCDIR}/etc/${etc}
+etc/${etc}: ${NETBSDSRCDIR}/etc/${etc}
+       mkdir -p ${.OBJDIR}/etc
        ${INSTALL} $> $@
 .endfor
 
@@ -140,7 +141,7 @@ ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}:
 .endfor # prog
 .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"
        ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }
 #      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;             \
 #      fi
 
+etc/pwd.db etc/spwd.db etc/passwd: etc/master.passwd
+
 etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd
        rm -rf ${.OBJDIR}/etc/
        mkdir -p ${.OBJDIR}/etc
        ${INSTALL} $> $@
        ${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:
        @echo ". type=dir uname=root gname=operator mode=0755" \
                >${.TARGET}.tmp && \
@@ -172,8 +170,8 @@ proto.dev.mtree:
 # We have to remove the two first entries of the generated proto file, as
 # well as the two last ones (closing $).
 # 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
-       ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR} -C -K device | \
+proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group
+       ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \
                ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \
                ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \
                mv ${.TARGET}.tmp ${.TARGET}
index bd6de5250a7cd1259bf120900e8a82be64a7b3dd..4c3107338badd9bc201e342df97830dea1627b04 100644 (file)
@@ -1,12 +1,12 @@
        etc d--755 0 0
                mtab    s--555 2 1      /proc/mounts
-               system.conf ---644 0 0 system.conf
-               passwd ---644 0 0 passwd
-               pwd.db ---644 0 0 pwd.db
-               spwd.db ---600 0 0 spwd.db
-               master.passwd ---600 0 0 master.passwd
+               system.conf ---644 0 0 etc/system.conf
+               passwd ---644 0 0 etc/passwd
+               pwd.db ---644 0 0 etc/pwd.db
+               spwd.db ---600 0 0 etc/spwd.db
+               master.passwd ---600 0 0 etc/master.passwd
                rc ---755 0 0 rc
 #if defined(__i386__)
-               rs.single ---755 0 0 rs.single
+               rs.single ---755 0 0 etc/rs.single
 #endif
        $
index 25d89be8270f00a1baf722f779d6d63a3b59555b..f7785ae856c14ed48e8b3ed3c1edb18a5b441e7c 100644 (file)
@@ -439,15 +439,9 @@ main(int argc, char *argv[])
                 * Create original format password file entry.
                 */
                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",
                            pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos,
                            pwd.pw_dir, pwd.pw_shell);
-#endif /* defined(__minix) */
                        if (ferror(oldfp))
                                wr_error(oldpwdfile);
                }