/[gentoo-x86]/eclass/user.eclass
Gentoo

Diff of /eclass/user.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.19 Revision 1.21
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.19 2012/06/18 16:51:34 axs Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.21 2012/06/22 18:57:33 axs Exp $
4 4
5# @ECLASS: user.eclass 5# @ECLASS: user.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org (Linux) 7# base-system@gentoo.org (Linux)
8# Joe Jezak <josejx@gmail.com> (OS X) 8# Joe Jezak <josejx@gmail.com> (OS X)
422 if [[ ${ehome} == "-1" ]] ; then 422 if [[ ${ehome} == "-1" ]] ; then
423 ehome="/dev/null" 423 ehome="/dev/null"
424 fi 424 fi
425 einfo " - Home: ${ehome}" 425 einfo " - Home: ${ehome}"
426 426
427 # update the home directory 427 # ensure home directory exists, otherwise update will fail
428 case ${CHOST} in
429 *-darwin*)
430 dscl . change "/users/${euser}" home "${ehome}"
431 ;;
432
433 *-freebsd*|*-dragonfly*)
434 pw usermod "${euser}" -d "${ehome}" || die
435 ;;
436
437 *)
438 usermod -d "${ehome}" "${euser}" || die
439 ;;
440 esac
441
442 if [[ ! -e ${ROOT}/${ehome} ]] ; then 428 if [[ ! -e ${ROOT}/${ehome} ]] ; then
443 einfo " - Creating ${ehome} in ${ROOT}" 429 einfo " - Creating ${ehome} in ${ROOT}"
444 mkdir -p "${ROOT}/${ehome}" 430 mkdir -p "${ROOT}/${ehome}"
445 chown "${euser}" "${ROOT}/${ehome}" 431 chown "${euser}" "${ROOT}/${ehome}"
446 chmod 755 "${ROOT}/${ehome}" 432 chmod 755 "${ROOT}/${ehome}"
447 fi 433 fi
434
435 # update the home directory
436 case ${CHOST} in
437 *-darwin*)
438 dscl . change "/users/${euser}" home "${ehome}"
439 ;;
440
441 *-freebsd*|*-dragonfly*)
442 pw usermod "${euser}" -d "${ehome}" && return 0
443 [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
444 eerror "There was an error when attempting to update the home directory for ${euser}"
445 eerror "Please update it manually on your system:"
446 eerror "\t pw usermod \"${euser}\" -d \"${ehome}\""
447 ;;
448
449 *)
450 usermod -d "${ehome}" "${euser}" && return 0
451 [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
452 eerror "There was an error when attempting to update the home directory for ${euser}"
453 eerror "Please update it manually on your system (as root):"
454 eerror "\t usermod -d \"${ehome}\" \"${euser}\""
455 ;;
456 esac
448} 457}
449 458
450fi 459fi

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20