Gentoo Archives: gentoo-dev

From: Ian Stakenvicius <axs@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] RFC: enewuser should force updates to shell and home
Date: Wed, 13 Jun 2012 16:02:05
Message-Id: 4FD8B910.3090606@gentoo.org
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 Hey all - I'd like to propose that enewuser forces updates to a user's
5 home dir and shell whenever it is called, so that if this changes with
6 new versions of an ebuild it is dealt with automatically rather than
7 having to modify them in pkg_postinst/pkg_setup directly.
8
9 Here's my proposed patch to user.eclass -- please note that I can't
10 conform the syntax for the darwin ('dscl') calls as I don't have
11 access and my googling did not provide an exact-match in terms of
12 usage. The rest i'm highly confident will work based on the manpages
13 I was able to find. If anyone has these platforms and can test/update
14 the calls, I would appreciate it.
15
16
17 - --- user.eclass 2011-12-19 14:38:34.000000000 -0500
18 +++ user.eclass.forcehomedir 2012-06-13 11:54:26.000000000 -0400
19 @@ -230,24 +230,39 @@
20 for g in "${egroups_arr[@]}" ; do
21 dscl . merge "/groups/${g}" users "${euser}"
22 done
23 + ### force updates of some user properties
24 + dscl . change "/users/${euser}" home "${ehome}"
25 + dscl . change "/users/${euser}" shell "${eshell}"
26 ;;
27
28 *-freebsd*|*-dragonfly*)
29 pw useradd "${euser}" "${opts[@]}" || die
30 + ### force updates of some user properties
31 + pw usermod "${euser}" -d "${ehome}" || die
32 + pw usermod "${euser}" -s "${eshell}" || die
33 ;;
34
35 *-netbsd*)
36 useradd "${opts[@]}" "${euser}" || die
37 + ### force updates of some user properties
38 + usermod -d "${ehome}" "${euser}" || die
39 + usermod -s "${eshell}" "${euser}" || die
40 ;;
41
42 *-openbsd*)
43 # all ops the same, except the -g vs -g/-G ...
44 useradd -u ${euid} -s "${eshell}" \
45 -d "${ehome}" -g "${egroups}" "${euser}" || die
46 + ### force updates of some user properties
47 + usermod -d "${ehome}" "${euser}" || die
48 + usermod -s "${eshell}" "${euser}" || die
49 ;;
50
51 *)
52 useradd -r "${opts[@]}" "${euser}" || die
53 + ### force updates of some user properties
54 + usermod -d "${ehome}" "${euser}" || die
55 + usermod -s "${eshell}" "${euser}" || die
56 ;;
57 esac
58 -----BEGIN PGP SIGNATURE-----
59 Version: GnuPG v2.0.17 (GNU/Linux)
60
61 iF4EAREIAAYFAk/YuRAACgkQ2ugaI38ACPCCxgD/TUhHRThNOHOGoR04CwRwx+Nt
62 oEJy0MdknD0KDm/uT5oA/AiYZ9fDthJEmPyOgFra+BnWqLCkexvqz+K5SaoS1Pyw
63 =+xJb
64 -----END PGP SIGNATURE-----

Replies