summaryrefslogtreecommitdiffstats
path: root/fooconf-unix-group
blob: 7a3051266604ce686899c50afc123b4b7a059d69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
# Hey Emacs, this is -*-python-*- code!

from fooconflib import *

def generateUnixGroupFragment(ctx = FooConfContext()) :
      cursor = ctx.db.cursor()
      cursor.execute("SELECT name, id "+
                     "FROM account")
      
      while 1:
            row = cursor.fetchone()
            if row is None: break

            print "%s:x:%u:" % (ctx.makeSysUserName(row["name"]),
                                ctx.makeSysGID(row["id"]))

if __name__ == "__main__":
      generateUnixGroupFragment()