Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pi64 /var/db/repos/pentoo/dev-go/go-exploitdb # cat /var/tmp/portage/acct-user/vuls-0/temp/environment
- declare -x A=""
- declare -x ABI="arm64"
- declare -x ABI_MIPS=""
- declare -x ABI_PPC=""
- declare -x ABI_RISCV=""
- declare -x ABI_S390=""
- declare -x ABI_X86=""
- declare -- ACCT_USER_ENFORCE_ID=""
- declare -a ACCT_USER_GROUPS=([0]="vuls")
- declare -- ACCT_USER_HOME="/var/lib/vuls"
- declare -- ACCT_USER_HOME_PERMS="0770"
- declare -- ACCT_USER_ID="-1"
- declare -- ACCT_USER_NAME="vuls"
- declare -- ACCT_USER_SHELL="-1"
- declare -x ADA_TARGET=""
- declare -x ALSA_CARDS=""
- declare -x APACHE2_MODULES=""
- declare -x APACHE2_MPMS=""
- declare -x ARCH="arm64"
- declare BDEPEND=""
- declare -x BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_6 python_targets_python2_7"
- declare -x CALLIGRA_FEATURES=""
- declare -x CAMERAS=""
- declare -x CBUILD="aarch64-unknown-linux-gnu"
- declare -x CFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53 "
- declare -x CHOST="aarch64-unknown-linux-gnu"
- declare -x CHOST_arm64="aarch64-unknown-linux-gnu"
- declare -x COLLECTD_PLUGINS=""
- declare -x COMMON_FLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
- declare -x CPU_FLAGS_ARM=""
- declare -x CPU_FLAGS_PPC=""
- declare -x CPU_FLAGS_X86=""
- declare -x CURL_SSL=""
- declare -x CXXFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
- declare -x DCC_EMAILLOG_WHOM_TO_BLAME=""
- declare -x DEFAULT_ABI="arm64"
- declare -x DEFINED_PHASES=" install postinst preinst prerm pretend"
- declare DEPEND=""
- declare DESCRIPTION="User for Vuls"
- declare -x DIROPTIONS="-m0755"
- declare -x EAPI="7"
- declare -x ELIBC="glibc"
- declare -x ENLIGHTENMENT_MODULES=""
- declare -x ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
- declare -- EPOCHREALTIME="1582806396.893105"
- declare -- EPOCHSECONDS="1582806396"
- declare -x EXEOPTIONS="-m0755"
- declare -x FCFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
- declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
- declare -x FFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
- declare -x FFTOOLS=""
- declare -x GCC_SPECS=""
- declare -x GPSD_PROTOCOLS=""
- declare -x GRAPHITE="-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -floop-parallelize-all"
- declare -x GRUB_PLATFORMS=""
- declare -x GSETTINGS_BACKEND="dconf"
- declare HOMEPAGE
- declare -x INHERITED=" user acct-user"
- declare -x INPUT_DEVICES=""
- declare -x INSOPTIONS="-m0644"
- declare IUSE=""
- declare -x IUSE_EFFECTIVE="alpha amd64 amd64-fbsd amd64-linux arm arm64 elibc_AIX elibc_Cygwin elibc_Darwin elibc_DragonFly elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_OpenBSD elibc_SunOS elibc_Winnt elibc_bionic elibc_glibc elibc_mingw elibc_mintlib elibc_musl elibc_uclibc hppa ia64 kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-guest prefix-stack riscv s390 sh sparc sparc-solaris sparc64-solaris userland_BSD userland_GNU x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"
- declare -x IUSE_IMPLICIT="prefix prefix-guest prefix-stack"
- declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
- declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
- declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
- declare -x KERNEL="linux"
- declare -x KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
- declare -x L10N=""
- declare -x LANG="EN_US.UTF-8"
- declare -x LCD_DEVICES=""
- declare -x LC_COLLATE="C"
- declare -x LC_MESSAGES="C"
- declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
- declare -x LIBDIR_arm64="lib64"
- declare -x LIBOPTIONS="-m0644"
- declare -x LIBREOFFICE_EXTENSIONS=""
- declare -x LICENSE=""
- declare -x LIRC_DEVICES=""
- declare -x LLVM_TARGETS=""
- declare -x MAIL="/var/mail/root"
- declare -x MAKEOPTS="-j5 -l4"
- declare -x MANPAGER="manpager"
- declare -x MONKEYD_PLUGINS=""
- declare -x MOTD_SHOWN="pam"
- declare -x MSF_DATABASE_CONFIG="/usr/lib/metasploit/config/database.yml"
- declare -x MSF_LOCAL_LIB="/usr/lib/metasploit/lib/metasm"
- declare -x MSF_ROOT="/usr/lib/metasploit"
- declare -x MULTILIB_ABIS="arm64"
- declare -x NGINX_MODULES_HTTP=""
- declare -x NGINX_MODULES_MAIL=""
- declare -x NGINX_MODULES_STREAM=""
- declare -x OFED_DRIVERS=""
- declare -x OFFICE_IMPLEMENTATION=""
- declare -x OPENGL_PROFILE="xorg-x11"
- declare -x OPENMPI_FABRICS=""
- declare -x OPENMPI_OFED_FEATURES=""
- declare -x OPENMPI_RM=""
- declare -x PATH="/usr/lib/portage/python3.6/ebuild-helpers/xattr:/usr/lib/portage/python3.6/ebuild-helpers:/usr/lib/llvm/9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
- declare PDEPEND=""
- declare -x PHP_TARGETS=""
- declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
- declare -x PORTAGE_BINHOST2="https://raw.githubusercontent.com/necrose99/gentoo-binhost/aarch64-coretexa53-linux-gnu"
- declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
- declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
- declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
- declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/vuls-0/html")
- declare -a PORTAGE_DOSTRIP=([0]="/")
- declare -a PORTAGE_DOSTRIP_SKIP=()
- declare -x PORTAGE_NICENESS="15"
- declare -x POSTGRES_TARGETS=""
- declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"
- declare -x PROPERTIES=""
- declare -x PYTHONDONTWRITEBYTECODE="1"
- declare -x PYTHON_SINGLE_TARGET=""
- declare -x PYTHON_TARGETS=""
- declare -x QEMU_SOFTMMU_TARGETS=""
- declare -x QEMU_USER_TARGETS=""
- declare -x QT_GRAPHICSSYSTEM="raster"
- declare RDEPEND=" acct-group/vuls "
- declare REPOSITORY
- declare REQUIRED_USE=""
- declare -x RESTRICT=""
- declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
- declare -x ROS_MESSAGES=""
- declare -x RUBY_TARGETS=""
- declare -x S="/var/tmp/portage/acct-user/vuls-0/work/vuls-0"
- declare -x SANDBOX_DENY=""
- declare -x SANDBOX_PREDICT=""
- declare -x SANDBOX_READ="/:/var/tmp/portage"
- declare -x SANDBOX_WRITE="/var/tmp/portage"
- declare -x SANE_BACKENDS=""
- declare -x SHELL="/bin/bash"
- declare -x SLOT="0"
- declare SRC_URI
- declare -x SSH_CLIENT="10.0.0.13 63204 22"
- declare -x SSH_CONNECTION="10.0.0.13 63204 10.0.0.25 22"
- declare -x SSH_TTY="/dev/pts/0"
- declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
- declare -x UNCACHED_ERR_FD=""
- declare -x USE="arm64 elibc_glibc kernel_linux userland_GNU"
- declare -x USERLAND="GNU"
- declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
- declare -x USE_EXPAND_UNPREFIXED="ARCH"
- declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm64 hppa ia64 m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos riscv s390 sh sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"
- declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
- declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
- declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
- declare -x UWSGI_PLUGINS=""
- declare -x VIDEO_CARDS=""
- declare -x VOICEMAIL_STORAGE=""
- declare -x XDG_CONFIG_DIRS="/etc/xdg"
- declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
- declare -x XDG_SESSION_COOKIE="pi64-1582800288.394739-2128102357"
- declare -x XFCE_PLUGINS=""
- declare -x XSESSION="Xfce4"
- declare -x XTABLES_ADDONS=""
- declare -- _ACCT_USER_ADD_DEPS_CALLED="1"
- declare -- _ACCT_USER_ECLASS="1"
- declare -x _E_DESTTREE_="/usr"
- declare -x _E_DOCDESTTREE_=""
- declare -x _E_EXEDESTTREE_=""
- declare -x _E_INSDESTTREE_=""
- declare -- f
- declare -a isz=([0]="16" [1]="/var/tmp/portage/acct-user/vuls-0/image")
- declare -a nsz=([0]="4" [1]="/var/tmp/portage/acct-user/vuls-0/work")
- __eapi6_src_install ()
- {
- if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
- emake DESTDIR="${D}" install;
- fi;
- einstalldocs
- }
- __eapi6_src_prepare ()
- {
- if ___is_indexed_array_var PATCHES; then
- [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
- else
- if [[ -n ${PATCHES} ]]; then
- eapply ${PATCHES};
- fi;
- fi;
- eapply_user
- }
- __eapi7_ver_compare ()
- {
- local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C;
- re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$";
- [[ ${va} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${va}";
- an=${BASH_REMATCH[1]};
- al=${BASH_REMATCH[3]};
- as=${BASH_REMATCH[4]};
- ar=${BASH_REMATCH[7]};
- [[ ${vb} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${vb}";
- bn=${BASH_REMATCH[1]};
- bl=${BASH_REMATCH[3]};
- bs=${BASH_REMATCH[4]};
- br=${BASH_REMATCH[7]};
- __eapi7_ver_compare_int "${an%%.*}" "${bn%%.*}" || return;
- while [[ ${an} == *.* && ${bn} == *.* ]]; do
- an=${an#*.};
- bn=${bn#*.};
- a=${an%%.*};
- b=${bn%%.*};
- if [[ ${a} == 0* || ${b} == 0* ]]; then
- [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"};
- [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"};
- [[ ${a} > ${b} ]] && return 3;
- [[ ${a} < ${b} ]] && return 1;
- else
- __eapi7_ver_compare_int "${a}" "${b}" || return;
- fi;
- done;
- [[ ${an} == *.* ]] && return 3;
- [[ ${bn} == *.* ]] && return 1;
- [[ ${al} > ${bl} ]] && return 3;
- [[ ${al} < ${bl} ]] && return 1;
- as=${as#_}${as:+_};
- bs=${bs#_}${bs:+_};
- while [[ -n ${as} && -n ${bs} ]]; do
- a=${as%%_*};
- b=${bs%%_*};
- if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then
- __eapi7_ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || return;
- else
- [[ ${a%%[0-9]*} == p ]] && return 3;
- [[ ${b%%[0-9]*} == p ]] && return 1;
- [[ ${a} > ${b} ]] && return 3 || return 1;
- fi;
- as=${as#*_};
- bs=${bs#*_};
- done;
- if [[ -n ${as} ]]; then
- [[ ${as} == p[_0-9]* ]] && return 3 || return 1;
- else
- if [[ -n ${bs} ]]; then
- [[ ${bs} == p[_0-9]* ]] && return 1 || return 3;
- fi;
- fi;
- __eapi7_ver_compare_int "${ar#-r}" "${br#-r}" || return;
- return 2
- }
- __eapi7_ver_compare_int ()
- {
- local a=$1 b=$2 d=$(( ${#1}-${#2} ));
- if [[ ${d} -gt 0 ]]; then
- printf -v b "%0${d}d%s" 0 "${b}";
- else
- if [[ ${d} -lt 0 ]]; then
- printf -v a "%0$(( -d ))d%s" 0 "${a}";
- fi;
- fi;
- [[ ${a} > ${b} ]] && return 3;
- [[ ${a} == "${b}" ]]
- }
- __eapi7_ver_parse_range ()
- {
- local range=${1};
- local max=${2};
- [[ ${range} == [0-9]* ]] || die "${FUNCNAME}: range must start with a number";
- start=${range%-*};
- [[ ${range} == *-* ]] && end=${range#*-} || end=${start};
- if [[ -n ${end} ]]; then
- [[ ${start} -le ${end} ]] || die "${FUNCNAME}: end of range must be >= start";
- [[ ${end} -le ${max} ]] || end=${max};
- else
- end=${max};
- fi
- }
- __eapi7_ver_split ()
- {
- local v=${1} LC_ALL=C;
- comp=();
- local s c;
- while [[ -n ${v} ]]; do
- s=${v%%[a-zA-Z0-9]*};
- v=${v:${#s}};
- [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*};
- v=${v:${#c}};
- comp+=("${s}" "${c}");
- done
- }
- _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
- }
- _get_next_id ()
- {
- local db=$1;
- shift;
- if [[ -z ${db} ]]; then
- eerror "No database specified !";
- die "Cannot call _get_next_id without a database";
- fi;
- case ${db} in
- passwd | group)
- ;;
- *)
- die "sorry, database '${db}' not yet supported; file a bug"
- ;;
- esac;
- local eid=$2;
- if [[ -z ${eid} || ${eid} -eq -1 ]]; then
- eid="next available";
- else
- if [[ ${eid} -gt 0 ]]; then
- if [[ -n $(egetent ${db} ${eid}) ]]; then
- eid="next available";
- fi;
- else
- eerror "ID given but is not greater than 0 !";
- die "${eid} is not a valid ID";
- fi;
- fi;
- if [[ ${CHOST} != *-linux* && ${eid} == "next available" ]]; then
- for ((eid = 101; eid <= 999; eid++))
- do
- [[ -z $(egetent passwd ${eid}) ]] && break;
- done;
- fi;
- echo ${eid}
- }
- acct-user_add_deps ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- if [[ $(declare -p ACCT_USER_GROUPS) != "declare -a"* ]]; then
- die 'ACCT_USER_GROUPS must be an array.';
- else
- if [[ ${#ACCT_USER_GROUPS[@]} -eq 0 ]]; then
- die 'ACCT_USER_GROUPS must not be empty.';
- fi;
- fi;
- RDEPEND+=${ACCT_USER_GROUPS[*]/#/ acct-group/};
- _ACCT_USER_ADD_DEPS_CALLED=1
- }
- acct-user_pkg_postinst ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}";
- esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}";
- local groups=${ACCT_USER_GROUPS[*]};
- esetgroups "${ACCT_USER_NAME}" "${groups// /,}";
- esetcomment "${ACCT_USER_NAME}" "${DESCRIPTION//[:,=]/;}";
- eunlockuser "${ACCT_USER_NAME}"
- }
- acct-user_pkg_preinst ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- local groups=${ACCT_USER_GROUPS[*]};
- enewuser ${ACCT_USER_ENFORCE_ID:+-F} -M "${ACCT_USER_NAME}" "${ACCT_USER_ID}" "${ACCT_USER_SHELL}" "${ACCT_USER_HOME}" "${groups// /,}";
- if [[ ${ACCT_USER_HOME} != /dev/null ]]; then
- if [[ -z ${ACCT_USER_HOME_OWNER} ]]; then
- ACCT_USER_HOME_OWNER=${ACCT_USER_NAME}:${ACCT_USER_GROUPS[0]};
- fi;
- if [[ ! -e "${ED}/${ACCT_USER_HOME#/}" ]]; then
- eerror "Home directory is missing from the installation image:";
- eerror " ${ACCT_USER_HOME}";
- eerror "Check INSTALL_MASK for entries that would cause this.";
- die "${ACCT_USER_HOME} does not exist";
- fi;
- fowners "${ACCT_USER_HOME_OWNER}" "${ACCT_USER_HOME}";
- fperms "${ACCT_USER_HOME_PERMS}" "${ACCT_USER_HOME}";
- fi
- }
- acct-user_pkg_prerm ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- if [[ -z ${REPLACED_BY_VERSION} ]]; then
- if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
- ewarn "User account not found: ${ACCT_USER_NAME}";
- ewarn "Locking process will be skipped.";
- return;
- fi;
- esetshell "${ACCT_USER_NAME}" -1;
- esetcomment "${ACCT_USER_NAME}" "$(egetcomment "${ACCT_USER_NAME}"); user account removed @ $(date +%Y-%m-%d)";
- elockuser "${ACCT_USER_NAME}";
- fi
- }
- acct-user_pkg_pretend ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- if [[ -z ${_ACCT_USER_ADD_DEPS_CALLED} ]]; then
- die "Ebuild error: acct-user_add_deps must have been called in global scope!";
- fi;
- [[ -n ${ACCT_USER_ID} ]] || die "Ebuild error: ACCT_USER_ID must be set!";
- [[ ${ACCT_USER_ID} -eq -1 ]] && return;
- [[ ${ACCT_USER_ID} -ge 0 ]] || die "Ebuild errors: ACCT_USER_ID=${ACCT_USER_ID} invalid!";
- if [[ -n ${ACCT_USER_ENFORCE_ID} ]]; then
- local user_by_id=$(egetusername "${ACCT_USER_ID}");
- local user_by_name=$(egetent passwd "${ACCT_USER_NAME}");
- if [[ -n ${user_by_id} ]]; then
- if [[ ${user_by_id} != ${ACCT_USER_NAME} ]]; then
- eerror "The required UID is already taken by another user.";
- eerror " UID: ${ACCT_USER_ID}";
- eerror " needed for: ${ACCT_USER_NAME}";
- eerror " current user: ${user_by_id}";
- die "UID ${ACCT_USER_ID} taken already";
- fi;
- else
- if [[ -n ${user_by_name} ]]; then
- eerror "The requested user exists already with wrong UID.";
- eerror " username: ${ACCT_USER_NAME}";
- eerror " requested UID: ${ACCT_USER_ID}";
- eerror " current entry: ${user_by_name}";
- die "Username ${ACCT_USER_NAME} exists with wrong UID";
- fi;
- fi;
- fi
- }
- acct-user_src_install ()
- {
- debug-print-function ${FUNCNAME} "${@}";
- if [[ ${ACCT_USER_HOME} != /dev/null ]]; then
- keepdir "${ACCT_USER_HOME}";
- fi
- }
- eapply ()
- {
- local failed patch_cmd=patch;
- local -x LC_COLLATE=POSIX;
- type -P gpatch > /dev/null && patch_cmd=gpatch;
- function _eapply_patch ()
- {
- local f=${1};
- local prefix=${2};
- ebegin "${prefix:-Applying }${f##*/}";
- local all_opts=(-p1 -f -g0 --no-backup-if-mismatch "${patch_options[@]}");
- if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 < "${f}" &> /dev/null; then
- all_opts+=(-s -F0);
- fi;
- ${patch_cmd} "${all_opts[@]}" < "${f}";
- failed=${?};
- if ! eend "${failed}"; then
- __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
- fi
- };
- local patch_options=() files=();
- local i found_doublehyphen;
- for ((i = 1; i <= ${#@}; ++i ))
- do
- if [[ ${@:i:1} == -- ]]; then
- patch_options=("${@:1:i-1}");
- files=("${@:i+1}");
- found_doublehyphen=1;
- break;
- fi;
- done;
- if [[ -z ${found_doublehyphen} ]]; then
- for ((i = 1; i <= ${#@}; ++i ))
- do
- if [[ ${@:i:1} != -* ]]; then
- patch_options=("${@:1:i-1}");
- files=("${@:i}");
- break;
- fi;
- done;
- for i in "${files[@]}";
- do
- if [[ ${i} == -* ]]; then
- die "eapply: all options must be passed before non-options";
- fi;
- done;
- fi;
- if [[ ${#files[@]} -eq 0 ]]; then
- die "eapply: no files specified";
- fi;
- local f;
- for f in "${files[@]}";
- do
- if [[ -d ${f} ]]; then
- function _eapply_get_files ()
- {
- local LC_ALL=POSIX;
- local prev_shopt=$(shopt -p nullglob);
- shopt -s nullglob;
- local f;
- for f in "${1}"/*;
- do
- if [[ ${f} == *.diff || ${f} == *.patch ]]; then
- files+=("${f}");
- fi;
- done;
- ${prev_shopt}
- };
- local files=();
- _eapply_get_files "${f}";
- [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
- einfo "Applying patches from ${f} ...";
- local f2;
- for f2 in "${files[@]}";
- do
- _eapply_patch "${f2}" ' ';
- [[ ${failed} -ne 0 ]] && return "${failed}";
- done;
- else
- _eapply_patch "${f}";
- [[ ${failed} -ne 0 ]] && return "${failed}";
- fi;
- done;
- return 0
- }
- eapply_user ()
- {
- [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
- local tagfile=${T}/.portage_user_patches_applied;
- [[ -f ${tagfile} ]] && return;
- >> "${tagfile}";
- local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
- local applied d f;
- local -A _eapply_user_patches;
- local prev_shopt=$(shopt -p nullglob);
- shopt -s nullglob;
- for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
- do
- for f in "${d}"/*;
- do
- if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
- _eapply_user_patches[${f##*/}]=${f};
- fi;
- done;
- done;
- if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
- while read -r -d '' f; do
- f=${_eapply_user_patches[${f}]};
- if [[ -s ${f} ]]; then
- eapply "${f}";
- applied=1;
- fi;
- done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
- LC_ALL=C sort -z);
- fi;
- ${prev_shopt};
- [[ -n ${applied} ]] && ewarn "User patches applied."
- }
- 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]*)
- nidump ${db} . | awk -F: "(\$1 ~ /^${key}\$/) {print;exit;}"
- ;;
- *)
- 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]*)
- dscl . -read /${db}/${key} 2> /dev/null | grep RecordName
- ;;
- *)
- dscl . -search /${db} ${mykey} ${key} 2> /dev/null
- ;;
- esac
- ;;
- *-freebsd* | *-dragonfly*)
- case ${db} in
- passwd)
- db="user"
- ;;
- *)
- ;;
- esac;
- 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}
- ;;
- *)
- nscd -i "${db}" 2> /dev/null;
- getent "${db}" "${key}"
- ;;
- esac
- }
- egethome ()
- {
- local pos;
- [[ $# -eq 1 ]] || die "usage: egethome <user>";
- case ${CHOST} in
- *-darwin* | *-freebsd* | *-dragonfly*)
- pos=9
- ;;
- *)
- pos=6
- ;;
- esac;
- egetent passwd "$1" | cut -d: -f${pos}
- }
- egetshell ()
- {
- local pos;
- [[ $# -eq 1 ]] || die "usage: egetshell <user>";
- case ${CHOST} in
- *-darwin* | *-freebsd* | *-dragonfly*)
- pos=10
- ;;
- *)
- pos=7
- ;;
- esac;
- egetent passwd "$1" | cut -d: -f${pos}
- }
- einstalldocs ()
- {
- ( if ! declare -p DOCS &> /dev/null; then
- local d;
- for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
- do
- [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
- done;
- else
- if ___is_indexed_array_var DOCS; then
- [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
- else
- [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
- fi;
- fi );
- ( if ___is_indexed_array_var HTML_DOCS; then
- [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
- else
- [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
- fi )
- }
- eislocked ()
- {
- [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
- if [[ ${EUID} != 0 ]]; then
- einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
- return 0;
- fi;
- case ${CHOST} in
- *-freebsd* | *-dragonfly* | *-netbsd*)
- [[ $(egetent "$1" | cut -d: -f2) == '*LOCKED*'* ]]
- ;;
- *-openbsd*)
- return 2
- ;;
- *)
- [[ $(getent shadow "$1" | cut -d: -f2) == '!'* ]] && [[ $(getent shadow "$1" | cut -d: -f8) == 1 ]]
- ;;
- esac
- }
- elockuser ()
- {
- [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
- if [[ ${EUID} != 0 ]]; then
- einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
- return 0;
- fi;
- eislocked "$1";
- [[ $? -eq 0 ]] && return 0;
- case ${CHOST} in
- *-freebsd* | *-dragonfly*)
- pw lock "$1" || die "Locking account $1 failed";
- pw user mod "$1" -e 1 || die "Expiring account $1 failed"
- ;;
- *-netbsd*)
- usermod -e 1 -C yes "$1" || die "Locking account $1 failed"
- ;;
- *-openbsd*)
- return 2
- ;;
- *)
- usermod -e 1 -L "$1" || die "Locking account $1 failed"
- ;;
- esac;
- elog "User account $1 locked";
- return 0
- }
- enewgroup ()
- {
- _assert_pkg_ebuild_phase ${FUNCNAME};
- local egroup=$1;
- shift;
- if [[ -z ${egroup} ]]; then
- eerror "No group specified !";
- die "Cannot call enewgroup without a group";
- fi;
- if [[ -n $(egetent group "${egroup}") ]]; then
- return 0;
- fi;
- einfo "Adding group '${egroup}' to your system ...";
- local egid=$1;
- shift;
- egid=$(_get_next_id group ${egid});
- einfo " - Groupid: ${egid}";
- if [[ $# -gt 0 ]]; then
- die "extra arguments no longer supported; please file a bug";
- fi;
- case ${CHOST} in
- *-darwin*)
- dscl . create "/groups/${egroup}" gid ${egid};
- dscl . create "/groups/${egroup}" passwd '*'
- ;;
- *-freebsd* | *-dragonfly*)
- pw groupadd "${egroup}" -g ${egid} || die
- ;;
- *-netbsd* | *-openbsd*)
- groupadd -g ${egid} "${egroup}" || die
- ;;
- *)
- groupadd -r ${opts} "${egroup}" || die
- ;;
- esac
- }
- enewuser ()
- {
- _assert_pkg_ebuild_phase ${FUNCNAME};
- local euser=$1;
- shift;
- if [[ -z ${euser} ]]; then
- eerror "No username specified !";
- die "Cannot call enewuser without a username";
- fi;
- if [[ -n $(egetent passwd "${euser}") ]]; then
- return 0;
- fi;
- einfo "Adding user '${euser}' to your system ...";
- local opts=();
- local euid=$1;
- shift;
- euid=$(_get_next_id passwd ${euid});
- if [[ ${euid} != "next available" ]]; then
- opts+=(-u ${euid});
- fi;
- einfo " - Userid: ${euid}";
- 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}");
- local ehome=$1;
- shift;
- if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]]; then
- ehome="/dev/null";
- fi;
- einfo " - Home: ${ehome}";
- opts+=(-d "${ehome}");
- 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)}";
- 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;
- case ${CHOST} in
- *-darwin*)
- 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}";
- 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*)
- 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
- }
- esethome ()
- {
- _assert_pkg_ebuild_phase ${FUNCNAME};
- local euser=$1;
- shift;
- if [[ -z ${euser} ]]; then
- eerror "No username specified !";
- die "Cannot call esethome without a username";
- fi;
- if [[ -z $(egetent passwd "${euser}") ]]; then
- ewarn "User does not exist, cannot set home dir -- skipping.";
- return 1;
- fi;
- 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;
- if [[ $(egethome "${euser}") == ${ehome} ]]; then
- return 0;
- fi;
- einfo "Updating home for user '${euser}' ...";
- einfo " - Home: ${ehome}";
- if [[ ! -e ${ROOT}/${ehome} ]]; then
- einfo " - Creating ${ehome} in ${ROOT}";
- mkdir -p "${ROOT}/${ehome}";
- chown "${euser}" "${ROOT}/${ehome}";
- chmod 755 "${ROOT}/${ehome}";
- fi;
- 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
- }
- eunlockuser ()
- {
- [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
- if [[ ${EUID} != 0 ]]; then
- einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
- return 0;
- fi;
- eislocked "$1";
- [[ $? -eq 1 ]] && return 0;
- case ${CHOST} in
- *-freebsd* | *-dragonfly*)
- pw user mod "$1" -e 0 || die "Unexpiring account $1 failed";
- pw unlock "$1" || die "Unlocking account $1 failed"
- ;;
- *-netbsd*)
- usermod -e 0 -C no "$1" || die "Unlocking account $1 failed"
- ;;
- *-openbsd*)
- return 1
- ;;
- *)
- usermod -e "" -U "$1" 2> /dev/null || die "Unlocking account $1 failed"
- ;;
- esac;
- ewarn "User account $1 unlocked after reinstating.";
- return 0
- }
- get_libdir ()
- {
- local libdir_var="LIBDIR_${ABI}";
- local libdir="lib";
- [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
- echo "${libdir}"
- }
- in_iuse ()
- {
- local use=${1};
- if [[ -z "${use}" ]]; then
- echo "!!! in_iuse() called without a parameter." 1>&2;
- echo "!!! in_iuse <USEFLAG>" 1>&2;
- die "in_iuse() called without a parameter";
- fi;
- local liuse=(${IUSE_EFFECTIVE});
- has "${use}" "${liuse[@]#[+-]}"
- }
- pkg_nofetch ()
- {
- default
- }
- pkg_postinst ()
- {
- acct-user_pkg_postinst "$@"
- }
- pkg_preinst ()
- {
- acct-user_pkg_preinst "$@"
- }
- pkg_prerm ()
- {
- acct-user_pkg_prerm "$@"
- }
- pkg_pretend ()
- {
- acct-user_pkg_pretend "$@"
- }
- src_compile ()
- {
- default
- }
- src_configure ()
- {
- default
- }
- src_install ()
- {
- acct-user_src_install "$@"
- }
- src_prepare ()
- {
- default
- }
- src_test ()
- {
- default
- }
- src_unpack ()
- {
- default
- }
- ver_cut ()
- {
- local range=${1};
- local v=${2:-${PV}};
- local start end;
- local -a comp;
- __eapi7_ver_split "${v}";
- local max=$((${#comp[@]}/2));
- __eapi7_ver_parse_range "${range}" "${max}";
- local IFS=;
- if [[ ${start} -gt 0 ]]; then
- start=$(( start*2 - 1 ));
- fi;
- echo "${comp[*]:start:end*2-start}"
- }
- ver_rs ()
- {
- local v;
- (( ${#} & 1 )) && v=${@: -1} || v=${PV};
- local start end i;
- local -a comp;
- __eapi7_ver_split "${v}";
- local max=$((${#comp[@]}/2 - 1));
- while [[ ${#} -ge 2 ]]; do
- __eapi7_ver_parse_range "${1}" "${max}";
- for ((i = start*2; i <= end*2; i+=2 ))
- do
- [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue;
- comp[i]=${2};
- done;
- shift 2;
- done;
- local IFS=;
- echo "${comp[*]}"
- }
- ver_test ()
- {
- local va op vb;
- if [[ $# -eq 3 ]]; then
- va=${1};
- shift;
- else
- va=${PVR};
- fi;
- [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments";
- op=${1};
- vb=${2};
- case ${op} in
- -eq | -ne | -lt | -le | -gt | -ge)
- ;;
- *)
- die "${FUNCNAME}: invalid operator: ${op}"
- ;;
- esac;
- __eapi7_ver_compare "${va}" "${vb}";
- test $? "${op}" 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement