rpm-ostree/scripts/rpmostree-passwd2json.py
James Antill 855ab9ad01 compose: Add check-passwd/group JSON options, fails compose if uids/gids change
Verify uid/gid on files, directories and symlinks
Just output a msg when user/group is removed with no files

json-parsing: Add functions for strictly dealing with ints
passwd/json: Add simple scripts to convert passwd/group files to json data

docs: Check-passwd/groups and ignore-remove-users/groups JSON config. entries
2014-12-18 16:59:33 -05:00

24 lines
573 B
Python
Executable File

#! /usr/bin/python -tt
import os
import sys
out = """\
"check-passwd": { "type": "data",\n\
"entries": { """
prefix_len = len(' "entries": { ')
done = False
for fname in sys.argv[1:]:
for line in open(fname):
(user,xpass,uid,gid,x) = line.split(':', 4)
if done:
out += ',\n'
out += ' ' * prefix_len
done = True
if uid == gid:
out += '"%s": %s' % (user, uid)
else:
out += '"%s": [%s, %s]' % (user, uid, gid)
out += ' } },'
print out