1 |
On Wednesday 13 June 2012 15:35:40 Ian Stakenvicius wrote: |
2 |
> --- user.eclass [some timestamp] |
3 |
> +++ user.eclass.esethome [some other timestamp] |
4 |
> @@ -388,3 +388,63 @@ |
5 |
> } |
6 |
> |
7 |
> fi |
8 |
> + |
9 |
> +# @FUNCTION: esethome |
10 |
|
11 |
has to be inside the giant if block. so put this above the "fi". |
12 |
|
13 |
> +# @USAGE: <user> <homedir> |
14 |
> +# @DESCRIPTION: |
15 |
> +# Update the home directory in a platform-agnostic way. |
16 |
> +# Required parameters is the username and the new home directory. |
17 |
> +# Specify -1 if you want to set home to the enewuser default |
18 |
> +# of /dev/null. |
19 |
> +# If the new home directory does not exist, it is created. |
20 |
> +# Any previously existing home directory is NOT moved. |
21 |
> +esethome() { |
22 |
> + _assert_pkg_ebuild_phase ${FUNCNAME} |
23 |
> + |
24 |
> + # get the username |
25 |
> + local euser=$1; shift |
26 |
> + if [[ -z ${euser} ]] ; then |
27 |
> + eerror "No username specified !" |
28 |
> + die "Cannot call esethome without a username" |
29 |
> + fi |
30 |
> + |
31 |
> + # lets see if the username already exists |
32 |
> + if [[ ! -n $(egetent passwd "${euser}") ]] ; then |
33 |
|
34 |
"! -n" -> "-z" |
35 |
-mike |