[rhel6-branch] fix: kickstart sshpw command dysfunctional (#602308).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this is because /etc was missing a couple of dummy files libuser
absolutely needs in order not to fail.
---
 anaconda             |    2 +-
 scripts/upd-instroot |    8 ++++++++
 users.py             |    6 ++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/anaconda b/anaconda
index bde63bf..f30a1eb 100755
--- a/anaconda
+++ b/anaconda
@@ -435,7 +435,7 @@ def handleSshPw(ks):
         else:
             u.createUser(name=ud.username, password=ud.password,
                          isCrypted=ud.isCrypted, lock=ud.lock,
-                         root="/")
+                         root="/", mkmailspool=False)
 
     del u
 
diff --git a/scripts/upd-instroot b/scripts/upd-instroot
index 4c5f1b1..21a3fed 100755
--- a/scripts/upd-instroot
+++ b/scripts/upd-instroot
@@ -1061,6 +1061,14 @@ directory = /mnt/sysimage/etc
 directory = /mnt/sysimage/etc
 EOF
 
+echo "Creating /etc/skel"
+# libuser needs this when it creates sshpw users
+mkdir -p $DEST/etc/skel
+
+echo "Creating empty /etc/gshadow"
+# libuser needs this when it creates sshpw users
+touch $DEST/etc/gshadow
+
 sed -i 's|\(installforallkernels\) = 0|\1 = 1|' $DEST/etc/yum/pluginconf.d/fedorakmod.conf
 
 #
diff --git a/users.py b/users.py
index 8ac20ac..3ee2b2d 100644
--- a/users.py
+++ b/users.py
@@ -26,6 +26,7 @@ import random
 import tempfile
 import os
 import os.path
+import iutil
 
 import logging
 log = logging.getLogger("anaconda")
@@ -134,7 +135,7 @@ class Users:
 
     def createUser (self, name=None, password=None, isCrypted=False, groups=[],
                     homedir=None, shell=None, uid=None, algo=None, lock=False,
-                    root="/mnt/sysimage", gecos=None):
+                    root="/mnt/sysimage", gecos=None, mkmailspool=True):
         childpid = os.fork()
 
         if not childpid:
@@ -157,6 +158,7 @@ class Users:
                             map(lambda grp: grp.get(libuser.GIDNUMBER)[0], grpLst))
 
                 if not homedir:
+                    iutil.mkdirChain('/home')
                     homedir = "/home/" + name
 
                 userEnt.set(libuser.HOMEDIRECTORY, homedir)
@@ -170,7 +172,7 @@ class Users:
                 if gecos:
                     userEnt.set(libuser.GECOS, gecos)
 
-                self.admin.addUser(userEnt)
+                self.admin.addUser(userEnt, mkmailspool=mkmailspool)
                 self.admin.addGroup(groupEnt)
 
                 if password:
-- 
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux