commit:     ebdd8464a4a6072da5f2fd6775ae062a080c3776
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 27 01:08:42 2017 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon Nov 27 01:08:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/android.git/commit/?id=ebdd8464

db.eclass, user.eclass: upstreamed.

 eclass/db.eclass   | 210 ------------------------
 eclass/user.eclass | 474 -----------------------------------------------------
 2 files changed, 684 deletions(-)

diff --git a/eclass/db.eclass b/eclass/db.eclass
deleted file mode 100644
index f7070d4..0000000
--- a/eclass/db.eclass
+++ /dev/null
@@ -1,210 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.49 2013/07/21 09:23:45 
pacho Exp $
-# This is a common location for functions used in the sys-libs/db ebuilds
-#
-# Bugs: [email protected]
-
-inherit eutils multilib
-
-IUSE="doc test examples"
-
-EXPORT_FUNCTIONS src_test
-
-DEPEND="test? ( >=dev-lang/tcl-8.4 )"
-
-RDEPEND=""
-
-db_fix_so() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
-       LIB="${EROOT}/usr/$(get_libdir)"
-
-       cd "${LIB}"
-
-       # first clean up old symlinks
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" 
-delete
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname 
"[23]")" -delete
-       find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete 
#519364
-       find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" 
-delete #519364
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete
-
-       # now rebuild all the correct ones
-       for ext in so a dylib sl; do
-               for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
-                       target=`find . -maxdepth 1 -type f -name 
"${name}-*.${ext}" |sort -n |tail -n 1`
-                       [ -n "${target}" ] || continue;
-                       case ${CHOST} in 
-                       *-aix*)
-                               aixdll --merge-runtime \
-                                       --keepdir=false \
-                                       --target="${name}.${ext}" \
-                                       --current="${target}" \
-                                       `find . -maxdepth 1 -type f -name 
"${name}-*.${ext}"`
-                               ;;
-                       *)
-                               ln -sf ${target//.\//} ${name}.${ext}
-                               ;;
-                       esac;
-               done;
-       done;
-
-       # db[23] gets some extra-special stuff
-       if [ -f libdb1$(get_libname 2) ]; then
-               ln -sf libdb1$(get_libname 2) libdb$(get_libname 2)
-               ln -sf libdb1$(get_libname 2) libdb1$(get_libname)
-               ln -sf libdb1$(get_libname 2) libdb-1$(get_libame)
-       fi
-       # what do we do if we ever get 3.3 ?
-       for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
-               if [ -f $i-3$(get_libname 2) ]; then
-                       ln -sf $i-3$(get_libname 2) $i-3$(get_libname)
-                       ln -sf $i-3$(get_libname 2) $i$(get_libname 3)
-               fi
-       done
-
-       # do the same for headers now
-       # but since there are only two of them, just overwrite them
-       cd "${EROOT}"/usr/include
-       target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ 
-f2- | tail -n1`
-       if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] 
|| [[ -h db.h ]] ); then
-               einfo "Creating db.h symlinks to ${target}"
-               ln -sf "${target}"/db.h .
-               ln -sf "${target}"/db_185.h .
-       elif [ ! -e "${target}/db.h" ]; then
-               if [ -n "${target}" ]; then
-                       ewarn "Could not find ${target}/db.h"
-               elif [ -h db.h ]; then
-                       einfo "Apparently you just removed the last instance of 
$PN. Removing the symlinks"
-                       rm -f db.h db_185.h
-               fi
-       fi
-}
-
-db_src_install_doc() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-       # not everybody wants this wad of documentation as it is primarily API 
docs
-       if use doc; then
-               dodir /usr/share/doc/${PF}/html
-               mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/
-               rm -rf "${ED}"/usr/docs
-       else
-               rm -rf "${ED}"/usr/docs
-       fi
-
-       db_src_install_examples
-}
-
-db_src_install_examples() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-       if use examples ; then
-               local langs="c cxx stl"
-               [[ "${IUSE/java}" != "${IUSE}" ]] \
-                       && use java \
-                       && langs="${langs} java"
-               for i in $langs ; do
-                       destdir="/usr/share/doc/${PF}/"
-                       src="${S}/../examples_${i}/"
-                       if [ -f "${src}" ]; then
-                               dodir "${destdir}"
-                               cp -ra "${src}" "${ED}${destdir}/"
-                       fi
-               done
-       fi
-}
-
-db_src_install_usrbinslot() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-       # slot all program names to avoid overwriting
-       for fname in "${ED}"/usr/bin/db*
-       do
-               dn="$(dirname "${fname}")"
-               bn="$(basename "${fname}")"
-               bn="${bn/db/db${SLOT}}"
-               mv "${fname}" "${dn}/${bn}" || \
-                       die "Failed to rename ${fname} to ${dn}/${bn}"
-       done
-}
-
-db_src_install_headerslot() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-       # install all headers in a slotted location
-       dodir /usr/include/db${SLOT}
-       mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/
-}
-
-db_src_install_usrlibcleanup() {
-       has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
-       LIB="${ED}/usr/$(get_libdir)"
-       # Clean out the symlinks so that they will not be recorded in the
-       # contents (bug #60732)
-
-       if [ "${ED}" = "" ]; then
-               die "Calling clean_links while \$ED not defined"
-       fi
-
-       if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
-               einfo "Moving libdb.a to a versioned name"
-               mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a"
-       fi
-
-       if [ -e "${LIB}"/libdb_cxx.a ] && [ ! -e "${LIB}"/libdb_cxx-${SLOT}.a 
]; then
-               einfo "Moving libdb_cxx.a to a versioned name"
-               mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
-       fi
-
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" 
-delete
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname 
"[23]")" -delete
-       find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete 
#519364
-       find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" 
-delete #519364
-       einfo "removing unversioned static archives"
-       find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete
-
-       rm -f \
-               "${ED}"/usr/include/{db,db_185}.h \
-               "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
-}
-
-db_src_test() {
-       if [[ $UID -eq 0 ]]; then
-               M="You must run the testsuite as non-root, skipping"
-               ewarn "${M}"
-               elog "${M}"
-               return 0
-       fi
-
-       if use tcl; then
-               einfo "Running sys-libs/db testsuite"
-               ewarn "This can take 6+ hours on modern machines"
-               # Fix stuff that fails with relative paths, and upstream moving 
files
-               # around...
-               local test_parallel=''
-               for t in \
-                       "${S}"/test/parallel.tcl \
-                       "${S}"/../test/parallel.tcl \
-                       "${S}"/test/tcl/parallel.tcl \
-                       "${S}"/../test/tcl/parallel.tcl \
-                       ; do
-                       [[ -f "${t}" ]] && test_parallel="${t}" && break
-               done
-
-               sed -ri \
-                       -e '/regsub .test_path ./s,(regsub),#\1,g' \
-                       -e '/regsub .src_root ./s,(regsub),#\1,g' \
-                       -e '/regsub .tcl_utils ./s,(regsub),#\1,g' \
-                       "${test_parallel}"
-               cd "${S}"
-               for t in \
-                       ../test/test.tcl \
-                       ../test/tcl/test.tcl \
-                       ; do
-                       [[ -f "${t}" ]] && testbase="${t}" && break
-               done
-               echo "source ${t}" > testrunner.tcl
-               echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
-
-               tclsh testrunner.tcl
-               egrep -qs '^FAIL' ALL.OUT* && die "Some tests failed, please 
see ${S}/ALL.OUT*"
-       else
-               eerror "You must have USE=tcl to run the sys-libs/db testsuite."
-       fi
-}

diff --git a/eclass/user.eclass b/eclass/user.eclass
deleted file mode 100644
index 9fddbbb..0000000
--- a/eclass/user.eclass
+++ /dev/null
@@ -1,474 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-# @ECLASS: user.eclass
-# @MAINTAINER:
-# [email protected] (Linux)
-# Joe Jezak <[email protected]> (OS X)
-# [email protected] (OS X)
-# Aaron Walker <[email protected]> (FreeBSD)
-# @BLURB: user management in ebuilds
-# @DESCRIPTION:
-# The user eclass contains a suite of functions that allow ebuilds
-# to quickly make sure users in the installed system are sane.
-
-if [[ -z ${_USER_ECLASS} ]]; then
-_USER_ECLASS=1
-
-# @FUNCTION: _assert_pkg_ebuild_phase
-# @INTERNAL
-# @USAGE: <calling func name>
-_assert_pkg_ebuild_phase() {
-       case ${EBUILD_PHASE} in
-       setup|preinst|postinst) ;;
-       *)
-               eerror "'$1()' called from '${EBUILD_PHASE}' phase which is not 
OK:"
-               eerror "You may only call from pkg_{setup,preinst,postinst} 
functions."
-               eerror "Package fails at QA and at life.  Please file a bug."
-               die "Bad package!  $1 is only for use in some pkg_* functions!"
-       esac
-}
-
-# @FUNCTION: egetent
-# @USAGE: <database> <key>
-# @DESCRIPTION:
-# Small wrapper for getent (Linux), nidump (< Mac OS X 10.5),
-# dscl (Mac OS X 10.5), and pw (FreeBSD) used in enewuser()/enewgroup().
-#
-# Supported databases: group passwd
-egetent() {
-       local db=$1 key=$2
-
-       [[ $# -ge 3 ]] && die "usage: egetent <database> <key>"
-
-       case ${db} in
-       passwd|group) ;;
-       *) die "sorry, database '${db}' not yet supported; file a bug" ;;
-       esac
-
-       case ${CHOST} in
-       *-darwin[678])
-               case ${key} in
-               *[!0-9]*) # Non numeric
-                       nidump ${db} . | awk -F: "(\$1 ~ /^${key}\$/) 
{print;exit;}"
-                       ;;
-               *)      # Numeric
-                       nidump ${db} . | awk -F: "(\$3 == ${key}) {print;exit;}"
-                       ;;
-               esac
-               ;;
-       *-darwin*)
-               local mykey
-               case ${db} in
-               passwd) db="Users"  mykey="UniqueID" ;;
-               group)  db="Groups" mykey="PrimaryGroupID" ;;
-               esac
-
-               case ${key} in
-               *[!0-9]*) # Non numeric
-                       dscl . -read /${db}/${key} 2>/dev/null |grep RecordName
-                       ;;
-               *)      # Numeric
-                       dscl . -search /${db} ${mykey} ${key} 2>/dev/null
-                       ;;
-               esac
-               ;;
-       *-freebsd*|*-dragonfly*)
-               case ${db} in
-               passwd) db="user" ;;
-               *) ;;
-               esac
-
-               # lookup by uid/gid
-               local opts
-               if [[ ${key} == [[:digit:]]* ]] ; then
-                       [[ ${db} == "user" ]] && opts="-u" || opts="-g"
-               fi
-
-               pw show ${db} ${opts} "${key}" -q
-               ;;
-       *-netbsd*|*-openbsd*)
-               grep "${key}:\*:" /etc/${db}
-               ;;
-       *)
-               # ignore output if nscd doesn't exist, or we're not running as 
root
-               nscd -i "${db}" 2>/dev/null
-               getent "${db}" "${key}"
-               ;;
-       esac
-}
-
-# @FUNCTION: enewuser
-# @USAGE: <user> [uid] [shell] [homedir] [groups]
-# @DESCRIPTION:
-# Same as enewgroup, you are not required to understand how to properly add
-# a user to the system.  The only required parameter is the username.
-# Default uid is (pass -1 for this) next available, default shell is
-# /bin/false, default homedir is /dev/null, and there are no default groups.
-enewuser() {
-       if [[ ${EUID} != 0 ]] ; then
-               einfo "Donot have enough privilege to execute ${FUNCNAME[0]}"
-               return 0
-       fi
-       _assert_pkg_ebuild_phase ${FUNCNAME}
-
-       # get the username
-       local euser=$1; shift
-       if [[ -z ${euser} ]] ; then
-               eerror "No username specified !"
-               die "Cannot call enewuser without a username"
-       fi
-
-       # lets see if the username already exists
-       if [[ -n $(egetent passwd "${euser}") ]] ; then
-               return 0
-       fi
-       einfo "Adding user '${euser}' to your system ..."
-
-       # options to pass to useradd
-       local opts=()
-
-       # handle uid
-       local euid=$1; shift
-       if [[ -n ${euid} && ${euid} != -1 ]] ; then
-               if [[ ${euid} -gt 0 ]] ; then
-                       if [[ -n $(egetent passwd ${euid}) ]] ; then
-                               euid="next"
-                       fi
-               else
-                       eerror "Userid given but is not greater than 0 !"
-                       die "${euid} is not a valid UID"
-               fi
-       else
-               euid="next"
-       fi
-       if [[ ${euid} == "next" ]] ; then
-               for ((euid = 101; euid <= 999; euid++)); do
-                       [[ -z $(egetent passwd ${euid}) ]] && break
-               done
-       fi
-       opts+=( -u ${euid} )
-       einfo " - Userid: ${euid}"
-
-       # handle shell
-       local eshell=$1; shift
-       if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]] ; then
-               if [[ ! -e ${ROOT}${eshell} ]] ; then
-                       eerror "A shell was specified but it does not exist !"
-                       die "${eshell} does not exist in ${ROOT}"
-               fi
-               if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then
-                       eerror "Do not specify ${eshell} yourself, use -1"
-                       die "Pass '-1' as the shell parameter"
-               fi
-       else
-               for eshell in /sbin/nologin /usr/sbin/nologin /bin/false 
/usr/bin/false /dev/null ; do
-                       [[ -x ${ROOT}${eshell} ]] && break
-               done
-
-               if [[ ${eshell} == "/dev/null" ]] ; then
-                       eerror "Unable to identify the shell to use, proceeding 
with userland default."
-                       case ${USERLAND} in
-                               GNU)    eshell="/bin/false" ;;
-                               BSD)    eshell="/sbin/nologin" ;;
-                               Darwin) eshell="/usr/sbin/nologin" ;;
-                               *) die "Unable to identify the default shell 
for userland ${USERLAND}"
-                       esac
-               fi
-       fi
-       einfo " - Shell: ${eshell}"
-       opts+=( -s "${eshell}" )
-
-       # handle homedir
-       local ehome=$1; shift
-       if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]] ; then
-               ehome="/dev/null"
-       fi
-       einfo " - Home: ${ehome}"
-       opts+=( -d "${ehome}" )
-
-       # handle groups
-       local egroups=$1; shift
-       local g egroups_arr
-       IFS="," read -r -a egroups_arr <<<"${egroups}"
-       shift
-       if [[ ${#egroups_arr[@]} -gt 0 ]] ; then
-               local defgroup exgroups
-               for g in "${egroups_arr[@]}" ; do
-                       if [[ -z $(egetent group "${g}") ]] ; then
-                               eerror "You must add group ${g} to the system 
first"
-                               die "${g} is not a valid GID"
-                       fi
-                       if [[ -z ${defgroup} ]] ; then
-                               defgroup=${g}
-                       else
-                               exgroups+=",${g}"
-                       fi
-               done
-               opts+=( -g "${defgroup}" )
-               if [[ ! -z ${exgroups} ]] ; then
-                       opts+=( -G "${exgroups:1}" )
-               fi
-       fi
-       einfo " - Groups: ${egroups:-(none)}"
-
-       # handle extra args
-       if [[ $# -gt 0 ]] ; then
-               die "extra arguments no longer supported; please file a bug"
-       else
-               local comment="added by portage for ${PN}"
-               opts+=( -c "${comment}" )
-               einfo " - GECOS: ${comment}"
-       fi
-
-       # add the user
-       case ${CHOST} in
-       *-darwin*)
-               ### Make the user
-               dscl . create "/users/${euser}" uid ${euid}
-               dscl . create "/users/${euser}" shell "${eshell}"
-               dscl . create "/users/${euser}" home "${ehome}"
-               dscl . create "/users/${euser}" realname "added by portage for 
${PN}"
-               ### Add the user to the groups specified
-               for g in "${egroups_arr[@]}" ; do
-                       dscl . merge "/groups/${g}" users "${euser}"
-               done
-               ;;
-
-       *-freebsd*|*-dragonfly*)
-               pw useradd "${euser}" "${opts[@]}" || die
-               ;;
-
-       *-netbsd*)
-               useradd "${opts[@]}" "${euser}" || die
-               ;;
-
-       *-openbsd*)
-               # all ops the same, except the -g vs -g/-G ...
-               useradd -u ${euid} -s "${eshell}" \
-                       -d "${ehome}" -g "${egroups}" "${euser}" || die
-               ;;
-
-       *)
-               useradd -r "${opts[@]}" "${euser}" || die
-               ;;
-       esac
-
-       if [[ ! -e ${ROOT}/${ehome} ]] ; then
-               einfo " - Creating ${ehome} in ${ROOT}"
-               mkdir -p "${ROOT}/${ehome}"
-               chown "${euser}" "${ROOT}/${ehome}"
-               chmod 755 "${ROOT}/${ehome}"
-       fi
-}
-
-# @FUNCTION: enewgroup
-# @USAGE: <group> [gid]
-# @DESCRIPTION:
-# This function does not require you to understand how to properly add a
-# group to the system.  Just give it a group name to add and enewgroup will
-# do the rest.  You may specify the gid for the group or allow the group to
-# allocate the next available one.
-enewgroup() {
-       if [[ ${EUID} != 0 ]] ; then
-               einfo "Donot have enough privilege to execute ${FUNCNAME[0]}"
-               return 0
-       fi
-       _assert_pkg_ebuild_phase ${FUNCNAME}
-
-       # get the group
-       local egroup=$1; shift
-       if [[ -z ${egroup} ]] ; then
-               eerror "No group specified !"
-               die "Cannot call enewgroup without a group"
-       fi
-
-       # see if group already exists
-       if [[ -n $(egetent group "${egroup}") ]] ; then
-               return 0
-       fi
-       einfo "Adding group '${egroup}' to your system ..."
-
-       # handle gid
-       local egid=$1; shift
-       if [[ ! -z ${egid} ]] ; then
-               if [[ ${egid} -gt 0 ]] ; then
-                       if [[ -n $(egetent group ${egid}) ]] ; then
-                               egid="next available; requested gid taken"
-                       fi
-               else
-                       eerror "Groupid given but is not greater than 0 !"
-                       die "${egid} is not a valid GID"
-               fi
-       else
-               egid="next available"
-       fi
-       einfo " - Groupid: ${egid}"
-
-       # handle extra
-       if [[ $# -gt 0 ]] ; then
-               die "extra arguments no longer supported; please file a bug"
-       fi
-
-       # Some targets need to find the next available GID manually
-       _enewgroup_next_gid() {
-               if [[ ${egid} == *[!0-9]* ]] ; then
-                       # Non numeric
-                       for ((egid = 101; egid <= 999; egid++)) ; do
-                               [[ -z $(egetent group ${egid}) ]] && break
-                       done
-               fi
-       }
-
-       # add the group
-       case ${CHOST} in
-       *-darwin*)
-               _enewgroup_next_gid
-               dscl . create "/groups/${egroup}" gid ${egid}
-               dscl . create "/groups/${egroup}" passwd '*'
-               ;;
-
-       *-freebsd*|*-dragonfly*)
-               _enewgroup_next_gid
-               pw groupadd "${egroup}" -g ${egid} || die
-               ;;
-
-       *-netbsd*)
-               _enewgroup_next_gid
-               groupadd -g ${egid} "${egroup}" || die
-               ;;
-
-       *)
-               local opts
-               if [[ ${egid} == *[!0-9]* ]] ; then
-                       # Non numeric; let groupadd figure out a GID for us
-                       opts=""
-               else
-                       opts="-g ${egid}"
-               fi
-               # We specify -r so that we get a GID in the system range from 
login.defs
-               groupadd -r ${opts} "${egroup}" || die
-               ;;
-       esac
-}
-
-# @FUNCTION: egethome
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the home directory for the specified user.
-egethome() {
-       local pos
-
-       [[ $# -eq 1 ]] || die "usage: egethome <user>"
-
-       case ${CHOST} in
-       *-darwin*|*-freebsd*|*-dragonfly*)
-               pos=9
-               ;;
-       *)      # Linux, NetBSD, OpenBSD, etc...
-               pos=6
-               ;;
-       esac
-
-       egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: egetshell
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the shell for the specified user.
-egetshell() {
-       local pos
-
-       [[ $# -eq 1 ]] || die "usage: egetshell <user>"
-
-       case ${CHOST} in
-       *-darwin*|*-freebsd*|*-dragonfly*)
-               pos=10
-               ;;
-       *)      # Linux, NetBSD, OpenBSD, etc...
-               pos=7
-               ;;
-       esac
-
-       egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: esethome
-# @USAGE: <user> <homedir>
-# @DESCRIPTION:
-# Update the home directory in a platform-agnostic way.
-# Required parameters is the username and the new home directory.
-# Specify -1 if you want to set home to the enewuser default
-# of /dev/null.
-# If the new home directory does not exist, it is created.
-# Any previously existing home directory is NOT moved.
-esethome() {
-       _assert_pkg_ebuild_phase ${FUNCNAME}
-
-       # get the username
-       local euser=$1; shift
-       if [[ -z ${euser} ]] ; then
-               eerror "No username specified !"
-               die "Cannot call esethome without a username"
-       fi
-
-       # lets see if the username already exists
-       if [[ -z $(egetent passwd "${euser}") ]] ; then
-               ewarn "User does not exist, cannot set home dir -- skipping."
-               return 1
-       fi
-
-       # handle homedir
-       local ehome=$1; shift
-       if [[ -z ${ehome} ]] ; then
-               eerror "No home directory specified !"
-               die "Cannot call esethome without a home directory or '-1'"
-       fi
-
-       if [[ ${ehome} == "-1" ]] ; then
-               ehome="/dev/null"
-       fi
-
-       # exit with no message if home dir is up to date
-       if [[ $(egethome "${euser}") == ${ehome} ]]; then
-               return 0
-       fi
-
-       einfo "Updating home for user '${euser}' ..."
-       einfo " - Home: ${ehome}"
-
-       # ensure home directory exists, otherwise update will fail
-       if [[ ! -e ${ROOT}/${ehome} ]] ; then
-               einfo " - Creating ${ehome} in ${ROOT}"
-               mkdir -p "${ROOT}/${ehome}"
-               chown "${euser}" "${ROOT}/${ehome}"
-               chmod 755 "${ROOT}/${ehome}"
-       fi
-
-       # update the home directory
-       case ${CHOST} in
-       *-darwin*)
-               dscl . change "/users/${euser}" home "${ehome}"
-               ;;
-
-       *-freebsd*|*-dragonfly*)
-               pw usermod "${euser}" -d "${ehome}" && return 0
-               [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
-               eerror "There was an error when attempting to update the home 
directory for ${euser}"
-               eerror "Please update it manually on your system:"
-               eerror "\t pw usermod \"${euser}\" -d \"${ehome}\""
-               ;;
-
-       *)
-               usermod -d "${ehome}" "${euser}" && return 0
-               [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
-               eerror "There was an error when attempting to update the home 
directory for ${euser}"
-               eerror "Please update it manually on your system (as root):"
-               eerror "\t usermod -d \"${ehome}\" \"${euser}\""
-               ;;
-       esac
-}
-
-fi

Reply via email to