summaryrefslogtreecommitdiffstats
path: root/users.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2006-05-18 02:59:45 +0000
committerJeremy Katz <katzj@redhat.com>2006-05-18 02:59:45 +0000
commit7bfb685fb9691e6ec0038b7585aa349b6d5642fa (patch)
treef25ea7ccde0d5f2916eda2af8b04c84c1cdd8b9e /users.py
parent26daefb8ee3d05f13a7e759422fad06f7a299e95 (diff)
downloadanaconda-7bfb685fb9691e6ec0038b7585aa349b6d5642fa.tar.gz
anaconda-7bfb685fb9691e6ec0038b7585aa349b6d5642fa.tar.xz
anaconda-7bfb685fb9691e6ec0038b7585aa349b6d5642fa.zip
2006-05-17 Jeremy Katz <katzj@redhat.com>
* anaconda (Anaconda.setMethod): Set up our libuser.conf * users.py (createLuserConf): Create a libuser.conf that points to our rootpath so that things work with live CD, etc
Diffstat (limited to 'users.py')
-rw-r--r--users.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/users.py b/users.py
index 05c59257a..588400c2d 100644
--- a/users.py
+++ b/users.py
@@ -16,6 +16,29 @@ import libuser
import string
import crypt
import random
+import tempfile
+import os
+
+def createLuserConf(instPath):
+ """Writes a libuser.conf for instPath."""
+ (fd, fn) = tempfile.mkstemp(prefix="libuser.")
+ buf = """
+[defaults]
+skeleton = %(instPath)s/etc/skel
+mailspooldir = %(instPath)s/var/mail
+crypt_style = md5
+modules = files shadow
+create_modules = files shadow
+[files]
+directory = %(instPath)s/etc
+[shadow]
+directory = %(instPath)s/etc
+""" % {"instPath": instPath}
+ os.write(fd, buf)
+ os.close(fd)
+
+ os.environ["LIBUSER_CONF"] = fn
+
def cryptPassword(password, useMD5):
if useMD5: