summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rwxr-xr-xanaconda11
-rw-r--r--users.py23
3 files changed, 38 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c8c6171f..b48fb3254 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
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
+
* security.py (Security.write): Safe for all !test mode
* instdata.py (InstallData.write): Likewise.
diff --git a/anaconda b/anaconda
index 6134efdac..8e2dba7a9 100755
--- a/anaconda
+++ b/anaconda
@@ -601,6 +601,7 @@ if __name__ == "__main__":
import warnings
import rhpl
import vnc
+ import users
from flags import flags
from rhpl.translate import _, textdomain, addPoPath
@@ -679,8 +680,10 @@ if __name__ == "__main__":
if rhpl.getArch() == "s390":
opts.isHeadless = True
+ users.createLuserConf(anaconda.rootPath)
+
# setup links required for all install types
- for i in ( "services", "protocol", "nsswitch.conf", "joe", "selinux", "libuser.conf"):
+ for i in ( "services", "protocol", "nsswitch.conf", "joe", "selinux"):
try:
if os.path.exists("/mnt/runtime/etc/" + i):
os.symlink ("../mnt/runtime/etc/" + i, "/etc/" + i)
@@ -945,6 +948,12 @@ if __name__ == "__main__":
except:
handleException(anaconda, sys.exc_info())
+ # remove our libuser.conf
+ try:
+ os.unlink(os.environ["LIBUSER_CONF"])
+ except:
+ pass
+
if anaconda.isKickstart and instClass.ksdata.reboot["eject"]:
isys.flushDriveDict()
for drive in isys.cdromList():
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: