Re: [firstboot] Copy skel files even if the home directory exists (#598957)

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

 



The code looks ok, I'm just not sure if we always want to copy it.
I know we have a bug which requests it, but even adduser does not do that by default.

--
Martin Sivák
msivak@xxxxxxxxxx
Red Hat Czech
Anaconda team / Brno, CZ

----- Original Message -----
> ---
> modules/create_user.py | 18 +++++++++++++++++-
> 1 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/modules/create_user.py b/modules/create_user.py
> index 7e87dd6..d1b9365 100644
> --- a/modules/create_user.py
> +++ b/modules/create_user.py
> @@ -24,6 +24,7 @@ import os.path
> import pwd
> import unicodedata
> import re
> +import shutil
> 
> from firstboot.config import *
> from firstboot.constants import *
> @@ -230,7 +231,22 @@ class moduleClass(Module):
> gtk.main_iteration(False)
> 
> os.chown("/home/%s" % username, uidNumber, gidNumber)
> - os.path.walk("/home/%s" % username, self._chown, (uidNumber,
> gidNumber))
> + os.path.walk("/home/%s" % username, self._chown, (uidNumber,
> + gidNumber))
> +
> + # copy skel files
> + for fname in os.listdir("/etc/skel"):
> + dst = "/home/%s/%s" % (username, fname)
> + if not os.path.exists(dst):
> + src = "/etc/skel/%s" % fname
> + if os.path.isdir(src):
> + shutil.copytree(src, dst)
> + os.path.walk(dst, self._chown, (uidNumber,
> + gidNumber))
> + else:
> + shutil.copy2(src, dst)
> + os.chown(dst, uidNumber, gidNumber)
> +
> dlg.destroy()
> 
> if len(self._problemFiles) > 0:
> --
> 1.7.3.2
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
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