From f54ca21bb5823e935f7fc910b3883ef630052297 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Dec 2004 16:53:18 +0000 Subject: move stuff into trunk git-svn-id: file:///home/lennart/svn/public/fooconf/trunk@5 a3b0ba65-a9ea-0310-aec1-fe512e4e1665 --- fooconf-unix-passwd | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 fooconf-unix-passwd (limited to 'fooconf-unix-passwd') diff --git a/fooconf-unix-passwd b/fooconf-unix-passwd new file mode 100755 index 0000000..a39fa9b --- /dev/null +++ b/fooconf-unix-passwd @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# Hey Emacs, this is -*-python-*- code! + +from fooconflib import * + +def generateUnixPasswdFragment(ctx = FooConfContext()) : + cursor = ctx.db.cursor() + cursor.execute("SELECT name, id, enabled"+ + " FROM account") + + while 1: + row = cursor.fetchone() + if row is None: break + + if row["enabled"] : + pw = "xxx" + shell = "/bin/sh" + else: + pw = "" + shell = "/bin/false" + + print "%s:%s:%u:%u:%s,Fooconf User:%s:%s" % (ctx.makeSysUserName(row["name"]), + pw, + ctx.makeSysUID(row["id"]), + ctx.makeSysGID(row["id"]), + row["name"], + ctx.makeHomeDir(row["name"]), + shell) + +if __name__ == "__main__": + generateUnixPasswdFragment() -- cgit