public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] RFC: enewuser should force updates to shell and home
@ 2012-06-13 16:00 Ian Stakenvicius
  2012-06-13 17:19 ` Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Ian Stakenvicius @ 2012-06-13 16:00 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hey all - I'd like to propose that enewuser forces updates to a user's
home dir and shell whenever it is called, so that if this changes with
new versions of an ebuild it is dealt with automatically rather than
having to modify them in pkg_postinst/pkg_setup directly.

Here's my proposed patch to user.eclass -- please note that I can't
conform the syntax for the darwin ('dscl') calls as I don't have
access and my googling did not provide an exact-match in terms of
usage.  The rest i'm highly confident will work based on the manpages
I was able to find.  If anyone has these platforms and can test/update
the calls, I would appreciate it.


- --- user.eclass 2011-12-19 14:38:34.000000000 -0500
+++ user.eclass.forcehomedir    2012-06-13 11:54:26.000000000 -0400
@@ -230,24 +230,39 @@
                for g in "${egroups_arr[@]}" ; do
                        dscl . merge "/groups/${g}" users "${euser}"
                done
+               ### force updates of some user properties
+               dscl . change "/users/${euser}" home "${ehome}"
+               dscl . change "/users/${euser}" shell "${eshell}"
                ;;

        *-freebsd*|*-dragonfly*)
                pw useradd "${euser}" "${opts[@]}" || die
+               ### force updates of some user properties
+               pw usermod "${euser}" -d "${ehome}" || die
+               pw usermod "${euser}" -s "${eshell}" || die
                ;;

        *-netbsd*)
                useradd "${opts[@]}" "${euser}" || die
+               ### force updates of some user properties
+               usermod -d "${ehome}" "${euser}" || die
+               usermod -s "${eshell}" "${euser}" || die
                ;;

        *-openbsd*)
                # all ops the same, except the -g vs -g/-G ...
                useradd -u ${euid} -s "${eshell}" \
                        -d "${ehome}" -g "${egroups}" "${euser}" || die
+               ### force updates of some user properties
+               usermod -d "${ehome}" "${euser}" || die
+               usermod -s "${eshell}" "${euser}" || die
                ;;

        *)
                useradd -r "${opts[@]}" "${euser}" || die
+               ### force updates of some user properties
+               usermod -d "${ehome}" "${euser}" || die
+               usermod -s "${eshell}" "${euser}" || die
                ;;
        esac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iF4EAREIAAYFAk/YuRAACgkQ2ugaI38ACPCCxgD/TUhHRThNOHOGoR04CwRwx+Nt
oEJy0MdknD0KDm/uT5oA/AiYZ9fDthJEmPyOgFra+BnWqLCkexvqz+K5SaoS1Pyw
=+xJb
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-06-15 14:35 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-13 16:00 [gentoo-dev] RFC: enewuser should force updates to shell and home Ian Stakenvicius
2012-06-13 17:19 ` Michał Górny
2012-06-13 17:21   ` Ian Stakenvicius
2012-06-13 18:45     ` Ian Stakenvicius
2012-06-13 18:47       ` Ian Stakenvicius
2012-06-13 18:09 ` Fabian Groffen
2012-06-13 18:32   ` Ian Stakenvicius
2012-06-13 18:56     ` Mike Gilbert
2012-06-13 19:04     ` Mike Frysinger
2012-06-13 19:11       ` Ian Stakenvicius
2012-06-13 19:14         ` Mike Frysinger
2012-06-13 19:35           ` [gentoo-dev] RFC: esethome Ian Stakenvicius
2012-06-13 20:51             ` Mike Frysinger
2012-06-15 13:16               ` Ian Stakenvicius
2012-06-15 13:27               ` Peter Stuge
2012-06-15 13:35                 ` Ian Stakenvicius
2012-06-15 13:39                   ` Fabian Groffen
2012-06-15 13:41                   ` Peter Stuge
2012-06-15 13:53                     ` Fabian Groffen
2012-06-15 14:05                       ` Peter Stuge
2012-06-15 14:23                         ` Mike Gilbert
2012-06-15 14:34                           ` Peter Stuge
2012-06-13 18:18 ` [gentoo-dev] RFC: enewuser should force updates to shell and home Mike Gilbert
2012-06-13 18:22   ` Samuli Suominen
2012-06-13 18:27   ` Ian Stakenvicius

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox