Advertisement
Necrose99

acct-user/vuls-build-enviorment

Feb 27th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 35.91 KB | None | 0 0
  1. pi64 /var/db/repos/pentoo/dev-go/go-exploitdb # cat /var/tmp/portage/acct-user/vuls-0/temp/environment
  2. declare -x A=""
  3. declare -x ABI="arm64"
  4. declare -x ABI_MIPS=""
  5. declare -x ABI_PPC=""
  6. declare -x ABI_RISCV=""
  7. declare -x ABI_S390=""
  8. declare -x ABI_X86=""
  9. declare -- ACCT_USER_ENFORCE_ID=""
  10. declare -a ACCT_USER_GROUPS=([0]="vuls")
  11. declare -- ACCT_USER_HOME="/var/lib/vuls"
  12. declare -- ACCT_USER_HOME_PERMS="0770"
  13. declare -- ACCT_USER_ID="-1"
  14. declare -- ACCT_USER_NAME="vuls"
  15. declare -- ACCT_USER_SHELL="-1"
  16. declare -x ADA_TARGET=""
  17. declare -x ALSA_CARDS=""
  18. declare -x APACHE2_MODULES=""
  19. declare -x APACHE2_MPMS=""
  20. declare -x ARCH="arm64"
  21. declare BDEPEND=""
  22. declare -x BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_6 python_targets_python2_7"
  23. declare -x CALLIGRA_FEATURES=""
  24. declare -x CAMERAS=""
  25. declare -x CBUILD="aarch64-unknown-linux-gnu"
  26. declare -x CFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53 "
  27. declare -x CHOST="aarch64-unknown-linux-gnu"
  28. declare -x CHOST_arm64="aarch64-unknown-linux-gnu"
  29. declare -x COLLECTD_PLUGINS=""
  30. declare -x COMMON_FLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
  31. declare -x CPU_FLAGS_ARM=""
  32. declare -x CPU_FLAGS_PPC=""
  33. declare -x CPU_FLAGS_X86=""
  34. declare -x CURL_SSL=""
  35. declare -x CXXFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
  36. declare -x DCC_EMAILLOG_WHOM_TO_BLAME=""
  37. declare -x DEFAULT_ABI="arm64"
  38. declare -x DEFINED_PHASES=" install postinst preinst prerm pretend"
  39. declare DEPEND=""
  40. declare DESCRIPTION="User for Vuls"
  41. declare -x DIROPTIONS="-m0755"
  42. declare -x EAPI="7"
  43. declare -x ELIBC="glibc"
  44. declare -x ENLIGHTENMENT_MODULES=""
  45. 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"
  46. declare -- EPOCHREALTIME="1582806396.893105"
  47. declare -- EPOCHSECONDS="1582806396"
  48. declare -x EXEOPTIONS="-m0755"
  49. declare -x FCFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
  50. 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}\""
  51. declare -x FFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mcpu=cortex-a72.cortex-a53"
  52. declare -x FFTOOLS=""
  53. declare -x GCC_SPECS=""
  54. declare -x GPSD_PROTOCOLS=""
  55. declare -x GRAPHITE="-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block  -fgraphite-identity  -floop-parallelize-all"
  56. declare -x GRUB_PLATFORMS=""
  57. declare -x GSETTINGS_BACKEND="dconf"
  58. declare HOMEPAGE
  59. declare -x INHERITED=" user acct-user"
  60. declare -x INPUT_DEVICES=""
  61. declare -x INSOPTIONS="-m0644"
  62. declare IUSE=""
  63. 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"
  64. declare -x IUSE_IMPLICIT="prefix prefix-guest prefix-stack"
  65. declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
  66. declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
  67. declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
  68. declare -x KERNEL="linux"
  69. 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"
  70. declare -x L10N=""
  71. declare -x LANG="EN_US.UTF-8"
  72. declare -x LCD_DEVICES=""
  73. declare -x LC_COLLATE="C"
  74. declare -x LC_MESSAGES="C"
  75. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  76. declare -x LIBDIR_arm64="lib64"
  77. declare -x LIBOPTIONS="-m0644"
  78. declare -x LIBREOFFICE_EXTENSIONS=""
  79. declare -x LICENSE=""
  80. declare -x LIRC_DEVICES=""
  81. declare -x LLVM_TARGETS=""
  82. declare -x MAIL="/var/mail/root"
  83. declare -x MAKEOPTS="-j5 -l4"
  84. declare -x MANPAGER="manpager"
  85. declare -x MONKEYD_PLUGINS=""
  86. declare -x MOTD_SHOWN="pam"
  87. declare -x MSF_DATABASE_CONFIG="/usr/lib/metasploit/config/database.yml"
  88. declare -x MSF_LOCAL_LIB="/usr/lib/metasploit/lib/metasm"
  89. declare -x MSF_ROOT="/usr/lib/metasploit"
  90. declare -x MULTILIB_ABIS="arm64"
  91. declare -x NGINX_MODULES_HTTP=""
  92. declare -x NGINX_MODULES_MAIL=""
  93. declare -x NGINX_MODULES_STREAM=""
  94. declare -x OFED_DRIVERS=""
  95. declare -x OFFICE_IMPLEMENTATION=""
  96. declare -x OPENGL_PROFILE="xorg-x11"
  97. declare -x OPENMPI_FABRICS=""
  98. declare -x OPENMPI_OFED_FEATURES=""
  99. declare -x OPENMPI_RM=""
  100. 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"
  101. declare PDEPEND=""
  102. declare -x PHP_TARGETS=""
  103. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  104. declare -x PORTAGE_BINHOST2="https://raw.githubusercontent.com/necrose99/gentoo-binhost/aarch64-coretexa53-linux-gnu"
  105. declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
  106. declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
  107. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  108. declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/vuls-0/html")
  109. declare -a PORTAGE_DOSTRIP=([0]="/")
  110. declare -a PORTAGE_DOSTRIP_SKIP=()
  111. declare -x PORTAGE_NICENESS="15"
  112. declare -x POSTGRES_TARGETS=""
  113. 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"
  114. declare -x PROPERTIES=""
  115. declare -x PYTHONDONTWRITEBYTECODE="1"
  116. declare -x PYTHON_SINGLE_TARGET=""
  117. declare -x PYTHON_TARGETS=""
  118. declare -x QEMU_SOFTMMU_TARGETS=""
  119. declare -x QEMU_USER_TARGETS=""
  120. declare -x QT_GRAPHICSSYSTEM="raster"
  121. declare RDEPEND=" acct-group/vuls "
  122. declare REPOSITORY
  123. declare REQUIRED_USE=""
  124. declare -x RESTRICT=""
  125. 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}\""
  126. declare -x ROS_MESSAGES=""
  127. declare -x RUBY_TARGETS=""
  128. declare -x S="/var/tmp/portage/acct-user/vuls-0/work/vuls-0"
  129. declare -x SANDBOX_DENY=""
  130. declare -x SANDBOX_PREDICT=""
  131. declare -x SANDBOX_READ="/:/var/tmp/portage"
  132. declare -x SANDBOX_WRITE="/var/tmp/portage"
  133. declare -x SANE_BACKENDS=""
  134. declare -x SHELL="/bin/bash"
  135. declare -x SLOT="0"
  136. declare SRC_URI
  137. declare -x SSH_CLIENT="10.0.0.13 63204 22"
  138. declare -x SSH_CONNECTION="10.0.0.13 63204 10.0.0.25 22"
  139. declare -x SSH_TTY="/dev/pts/0"
  140. declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
  141. declare -x UNCACHED_ERR_FD=""
  142. declare -x USE="arm64 elibc_glibc kernel_linux userland_GNU"
  143. declare -x USERLAND="GNU"
  144. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  145. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  146. 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"
  147. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  148. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
  149. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  150. declare -x UWSGI_PLUGINS=""
  151. declare -x VIDEO_CARDS=""
  152. declare -x VOICEMAIL_STORAGE=""
  153. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  154. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
  155. declare -x XDG_SESSION_COOKIE="pi64-1582800288.394739-2128102357"
  156. declare -x XFCE_PLUGINS=""
  157. declare -x XSESSION="Xfce4"
  158. declare -x XTABLES_ADDONS=""
  159. declare -- _ACCT_USER_ADD_DEPS_CALLED="1"
  160. declare -- _ACCT_USER_ECLASS="1"
  161. declare -x _E_DESTTREE_="/usr"
  162. declare -x _E_DOCDESTTREE_=""
  163. declare -x _E_EXEDESTTREE_=""
  164. declare -x _E_INSDESTTREE_=""
  165. declare -- f
  166. declare -a isz=([0]="16" [1]="/var/tmp/portage/acct-user/vuls-0/image")
  167. declare -a nsz=([0]="4" [1]="/var/tmp/portage/acct-user/vuls-0/work")
  168. __eapi6_src_install ()
  169. {
  170.     if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  171.         emake DESTDIR="${D}" install;
  172.     fi;
  173.     einstalldocs
  174. }
  175. __eapi6_src_prepare ()
  176. {
  177.     if ___is_indexed_array_var PATCHES; then
  178.         [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
  179.     else
  180.         if [[ -n ${PATCHES} ]]; then
  181.             eapply ${PATCHES};
  182.         fi;
  183.     fi;
  184.     eapply_user
  185. }
  186. __eapi7_ver_compare ()
  187. {
  188.     local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C;
  189.     re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$";
  190.     [[ ${va} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${va}";
  191.     an=${BASH_REMATCH[1]};
  192.     al=${BASH_REMATCH[3]};
  193.     as=${BASH_REMATCH[4]};
  194.     ar=${BASH_REMATCH[7]};
  195.     [[ ${vb} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${vb}";
  196.     bn=${BASH_REMATCH[1]};
  197.     bl=${BASH_REMATCH[3]};
  198.     bs=${BASH_REMATCH[4]};
  199.     br=${BASH_REMATCH[7]};
  200.     __eapi7_ver_compare_int "${an%%.*}" "${bn%%.*}" || return;
  201.     while [[ ${an} == *.* && ${bn} == *.* ]]; do
  202.         an=${an#*.};
  203.         bn=${bn#*.};
  204.         a=${an%%.*};
  205.         b=${bn%%.*};
  206.         if [[ ${a} == 0* || ${b} == 0* ]]; then
  207.             [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"};
  208.            [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"};
  209.             [[ ${a} > ${b} ]] && return 3;
  210.             [[ ${a} < ${b} ]] && return 1;
  211.         else
  212.             __eapi7_ver_compare_int "${a}" "${b}" || return;
  213.         fi;
  214.     done;
  215.     [[ ${an} == *.* ]] && return 3;
  216.     [[ ${bn} == *.* ]] && return 1;
  217.     [[ ${al} > ${bl} ]] && return 3;
  218.     [[ ${al} < ${bl} ]] && return 1;
  219.     as=${as#_}${as:+_};
  220.     bs=${bs#_}${bs:+_};
  221.     while [[ -n ${as} && -n ${bs} ]]; do
  222.         a=${as%%_*};
  223.         b=${bs%%_*};
  224.         if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then
  225.             __eapi7_ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || return;
  226.         else
  227.             [[ ${a%%[0-9]*} == p ]] && return 3;
  228.             [[ ${b%%[0-9]*} == p ]] && return 1;
  229.             [[ ${a} > ${b} ]] && return 3 || return 1;
  230.         fi;
  231.         as=${as#*_};
  232.         bs=${bs#*_};
  233.     done;
  234.     if [[ -n ${as} ]]; then
  235.         [[ ${as} == p[_0-9]* ]] && return 3 || return 1;
  236.     else
  237.         if [[ -n ${bs} ]]; then
  238.             [[ ${bs} == p[_0-9]* ]] && return 1 || return 3;
  239.         fi;
  240.     fi;
  241.     __eapi7_ver_compare_int "${ar#-r}" "${br#-r}" || return;
  242.     return 2
  243. }
  244. __eapi7_ver_compare_int ()
  245. {
  246.     local a=$1 b=$2 d=$(( ${#1}-${#2} ));
  247.     if [[ ${d} -gt 0 ]]; then
  248.         printf -v b "%0${d}d%s" 0 "${b}";
  249.     else
  250.         if [[ ${d} -lt 0 ]]; then
  251.             printf -v a "%0$(( -d ))d%s" 0 "${a}";
  252.         fi;
  253.     fi;
  254.     [[ ${a} > ${b} ]] && return 3;
  255.     [[ ${a} == "${b}" ]]
  256. }
  257. __eapi7_ver_parse_range ()
  258. {
  259.     local range=${1};
  260.     local max=${2};
  261.     [[ ${range} == [0-9]* ]] || die "${FUNCNAME}: range must start with a number";
  262.     start=${range%-*};
  263.     [[ ${range} == *-* ]] && end=${range#*-} || end=${start};
  264.     if [[ -n ${end} ]]; then
  265.         [[ ${start} -le ${end} ]] || die "${FUNCNAME}: end of range must be >= start";
  266.         [[ ${end} -le ${max} ]] || end=${max};
  267.     else
  268.         end=${max};
  269.     fi
  270. }
  271. __eapi7_ver_split ()
  272. {
  273.     local v=${1} LC_ALL=C;
  274.     comp=();
  275.     local s c;
  276.     while [[ -n ${v} ]]; do
  277.         s=${v%%[a-zA-Z0-9]*};
  278.         v=${v:${#s}};
  279.         [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*};
  280.         v=${v:${#c}};
  281.         comp+=("${s}" "${c}");
  282.     done
  283. }
  284. _assert_pkg_ebuild_phase ()
  285. {
  286.     case ${EBUILD_PHASE} in
  287.         setup | preinst | postinst)
  288.  
  289.         ;;
  290.         *)
  291.             eerror "'$1()' called from '${EBUILD_PHASE}' phase which is not OK:";
  292.             eerror "You may only call from pkg_{setup,preinst,postinst} functions.";
  293.             eerror "Package fails at QA and at life.  Please file a bug.";
  294.             die "Bad package!  $1 is only for use in some pkg_* functions!"
  295.         ;;
  296.     esac
  297. }
  298. _get_next_id ()
  299. {
  300.     local db=$1;
  301.     shift;
  302.     if [[ -z ${db} ]]; then
  303.         eerror "No database specified !";
  304.         die "Cannot call _get_next_id without a database";
  305.     fi;
  306.     case ${db} in
  307.         passwd | group)
  308.  
  309.         ;;
  310.         *)
  311.             die "sorry, database '${db}' not yet supported; file a bug"
  312.         ;;
  313.     esac;
  314.     local eid=$2;
  315.     if [[ -z ${eid} || ${eid} -eq -1 ]]; then
  316.         eid="next available";
  317.     else
  318.         if [[ ${eid} -gt 0 ]]; then
  319.             if [[ -n $(egetent ${db} ${eid}) ]]; then
  320.                 eid="next available";
  321.             fi;
  322.         else
  323.             eerror "ID given but is not greater than 0 !";
  324.             die "${eid} is not a valid ID";
  325.         fi;
  326.     fi;
  327.     if [[ ${CHOST} != *-linux* && ${eid} == "next available" ]]; then
  328.         for ((eid = 101; eid <= 999; eid++))
  329.         do
  330.             [[ -z $(egetent passwd ${eid}) ]] && break;
  331.         done;
  332.     fi;
  333.     echo ${eid}
  334. }
  335. acct-user_add_deps ()
  336. {
  337.     debug-print-function ${FUNCNAME} "${@}";
  338.     if [[ $(declare -p ACCT_USER_GROUPS) != "declare -a"* ]]; then
  339.         die 'ACCT_USER_GROUPS must be an array.';
  340.     else
  341.         if [[ ${#ACCT_USER_GROUPS[@]} -eq 0 ]]; then
  342.             die 'ACCT_USER_GROUPS must not be empty.';
  343.         fi;
  344.     fi;
  345.     RDEPEND+=${ACCT_USER_GROUPS[*]/#/ acct-group/};
  346.     _ACCT_USER_ADD_DEPS_CALLED=1
  347. }
  348. acct-user_pkg_postinst ()
  349. {
  350.     debug-print-function ${FUNCNAME} "${@}";
  351.     esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}";
  352.     esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}";
  353.     local groups=${ACCT_USER_GROUPS[*]};
  354.     esetgroups "${ACCT_USER_NAME}" "${groups// /,}";
  355.     esetcomment "${ACCT_USER_NAME}" "${DESCRIPTION//[:,=]/;}";
  356.     eunlockuser "${ACCT_USER_NAME}"
  357. }
  358. acct-user_pkg_preinst ()
  359. {
  360.     debug-print-function ${FUNCNAME} "${@}";
  361.     local groups=${ACCT_USER_GROUPS[*]};
  362.     enewuser ${ACCT_USER_ENFORCE_ID:+-F} -M "${ACCT_USER_NAME}" "${ACCT_USER_ID}" "${ACCT_USER_SHELL}" "${ACCT_USER_HOME}" "${groups// /,}";
  363.     if [[ ${ACCT_USER_HOME} != /dev/null ]]; then
  364.         if [[ -z ${ACCT_USER_HOME_OWNER} ]]; then
  365.             ACCT_USER_HOME_OWNER=${ACCT_USER_NAME}:${ACCT_USER_GROUPS[0]};
  366.         fi;
  367.         if [[ ! -e "${ED}/${ACCT_USER_HOME#/}" ]]; then
  368.             eerror "Home directory is missing from the installation image:";
  369.             eerror "  ${ACCT_USER_HOME}";
  370.             eerror "Check INSTALL_MASK for entries that would cause this.";
  371.             die "${ACCT_USER_HOME} does not exist";
  372.         fi;
  373.         fowners "${ACCT_USER_HOME_OWNER}" "${ACCT_USER_HOME}";
  374.         fperms "${ACCT_USER_HOME_PERMS}" "${ACCT_USER_HOME}";
  375.     fi
  376. }
  377. acct-user_pkg_prerm ()
  378. {
  379.     debug-print-function ${FUNCNAME} "${@}";
  380.     if [[ -z ${REPLACED_BY_VERSION} ]]; then
  381.         if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
  382.             ewarn "User account not found: ${ACCT_USER_NAME}";
  383.             ewarn "Locking process will be skipped.";
  384.             return;
  385.         fi;
  386.         esetshell "${ACCT_USER_NAME}" -1;
  387.         esetcomment "${ACCT_USER_NAME}" "$(egetcomment "${ACCT_USER_NAME}"); user account removed @ $(date +%Y-%m-%d)";
  388.         elockuser "${ACCT_USER_NAME}";
  389.     fi
  390. }
  391. acct-user_pkg_pretend ()
  392. {
  393.     debug-print-function ${FUNCNAME} "${@}";
  394.     if [[ -z ${_ACCT_USER_ADD_DEPS_CALLED} ]]; then
  395.         die "Ebuild error: acct-user_add_deps must have been called in global scope!";
  396.     fi;
  397.     [[ -n ${ACCT_USER_ID} ]] || die "Ebuild error: ACCT_USER_ID must be set!";
  398.     [[ ${ACCT_USER_ID} -eq -1 ]] && return;
  399.     [[ ${ACCT_USER_ID} -ge 0 ]] || die "Ebuild errors: ACCT_USER_ID=${ACCT_USER_ID} invalid!";
  400.     if [[ -n ${ACCT_USER_ENFORCE_ID} ]]; then
  401.         local user_by_id=$(egetusername "${ACCT_USER_ID}");
  402.         local user_by_name=$(egetent passwd "${ACCT_USER_NAME}");
  403.         if [[ -n ${user_by_id} ]]; then
  404.             if [[ ${user_by_id} != ${ACCT_USER_NAME} ]]; then
  405.                 eerror "The required UID is already taken by another user.";
  406.                 eerror "  UID: ${ACCT_USER_ID}";
  407.                 eerror "  needed for: ${ACCT_USER_NAME}";
  408.                 eerror "  current user: ${user_by_id}";
  409.                 die "UID ${ACCT_USER_ID} taken already";
  410.             fi;
  411.         else
  412.             if [[ -n ${user_by_name} ]]; then
  413.                 eerror "The requested user exists already with wrong UID.";
  414.                 eerror "  username: ${ACCT_USER_NAME}";
  415.                 eerror "  requested UID: ${ACCT_USER_ID}";
  416.                 eerror "  current entry: ${user_by_name}";
  417.                 die "Username ${ACCT_USER_NAME} exists with wrong UID";
  418.             fi;
  419.         fi;
  420.     fi
  421. }
  422. acct-user_src_install ()
  423. {
  424.     debug-print-function ${FUNCNAME} "${@}";
  425.     if [[ ${ACCT_USER_HOME} != /dev/null ]]; then
  426.         keepdir "${ACCT_USER_HOME}";
  427.     fi
  428. }
  429. eapply ()
  430. {
  431.     local failed patch_cmd=patch;
  432.     local -x LC_COLLATE=POSIX;
  433.     type -P gpatch > /dev/null && patch_cmd=gpatch;
  434.     function _eapply_patch ()
  435.     {
  436.         local f=${1};
  437.         local prefix=${2};
  438.         ebegin "${prefix:-Applying }${f##*/}";
  439.         local all_opts=(-p1 -f -g0 --no-backup-if-mismatch "${patch_options[@]}");
  440.         if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 < "${f}" &> /dev/null; then
  441.             all_opts+=(-s -F0);
  442.         fi;
  443.         ${patch_cmd} "${all_opts[@]}" < "${f}";
  444.         failed=${?};
  445.         if ! eend "${failed}"; then
  446.             __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  447.         fi
  448.     };
  449.     local patch_options=() files=();
  450.     local i found_doublehyphen;
  451.     for ((i = 1; i <= ${#@}; ++i ))
  452.     do
  453.         if [[ ${@:i:1} == -- ]]; then
  454.             patch_options=("${@:1:i-1}");
  455.             files=("${@:i+1}");
  456.             found_doublehyphen=1;
  457.             break;
  458.         fi;
  459.     done;
  460.     if [[ -z ${found_doublehyphen} ]]; then
  461.         for ((i = 1; i <= ${#@}; ++i ))
  462.         do
  463.             if [[ ${@:i:1} != -* ]]; then
  464.                 patch_options=("${@:1:i-1}");
  465.                 files=("${@:i}");
  466.                 break;
  467.             fi;
  468.         done;
  469.         for i in "${files[@]}";
  470.         do
  471.             if [[ ${i} == -* ]]; then
  472.                 die "eapply: all options must be passed before non-options";
  473.             fi;
  474.         done;
  475.     fi;
  476.     if [[ ${#files[@]} -eq 0 ]]; then
  477.         die "eapply: no files specified";
  478.     fi;
  479.     local f;
  480.     for f in "${files[@]}";
  481.     do
  482.         if [[ -d ${f} ]]; then
  483.             function _eapply_get_files ()
  484.             {
  485.                 local LC_ALL=POSIX;
  486.                 local prev_shopt=$(shopt -p nullglob);
  487.                 shopt -s nullglob;
  488.                 local f;
  489.                 for f in "${1}"/*;
  490.                 do
  491.                     if [[ ${f} == *.diff || ${f} == *.patch ]]; then
  492.                         files+=("${f}");
  493.                     fi;
  494.                 done;
  495.                 ${prev_shopt}
  496.             };
  497.             local files=();
  498.             _eapply_get_files "${f}";
  499.             [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
  500.             einfo "Applying patches from ${f} ...";
  501.             local f2;
  502.             for f2 in "${files[@]}";
  503.             do
  504.                 _eapply_patch "${f2}" '  ';
  505.                 [[ ${failed} -ne 0 ]] && return "${failed}";
  506.             done;
  507.         else
  508.             _eapply_patch "${f}";
  509.             [[ ${failed} -ne 0 ]] && return "${failed}";
  510.         fi;
  511.     done;
  512.     return 0
  513. }
  514. eapply_user ()
  515. {
  516.     [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
  517.     local tagfile=${T}/.portage_user_patches_applied;
  518.     [[ -f ${tagfile} ]] && return;
  519.      >> "${tagfile}";
  520.     local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  521.     local applied d f;
  522.     local -A _eapply_user_patches;
  523.     local prev_shopt=$(shopt -p nullglob);
  524.     shopt -s nullglob;
  525.     for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
  526.     do
  527.         for f in "${d}"/*;
  528.         do
  529.             if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
  530.                 _eapply_user_patches[${f##*/}]=${f};
  531.             fi;
  532.         done;
  533.     done;
  534.     if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
  535.         while read -r -d '' f; do
  536.             f=${_eapply_user_patches[${f}]};
  537.             if [[ -s ${f} ]]; then
  538.                 eapply "${f}";
  539.                 applied=1;
  540.             fi;
  541.         done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
  542.                                 LC_ALL=C sort -z);
  543.     fi;
  544.     ${prev_shopt};
  545.     [[ -n ${applied} ]] && ewarn "User patches applied."
  546. }
  547. egetent ()
  548. {
  549.     local db=$1 key=$2;
  550.     [[ $# -ge 3 ]] && die "usage: egetent <database> <key>";
  551.     case ${db} in
  552.         passwd | group)
  553.  
  554.         ;;
  555.         *)
  556.             die "sorry, database '${db}' not yet supported; file a bug"
  557.         ;;
  558.     esac;
  559.     case ${CHOST} in
  560.         *-darwin[678])
  561.             case ${key} in
  562.                 *[!0-9]*)
  563.                     nidump ${db} . | awk -F: "(\$1 ~ /^${key}\$/) {print;exit;}"
  564.                 ;;
  565.                 *)
  566.                     nidump ${db} . | awk -F: "(\$3 == ${key}) {print;exit;}"
  567.                 ;;
  568.             esac
  569.         ;;
  570.         *-darwin*)
  571.             local mykey;
  572.             case ${db} in
  573.                 passwd)
  574.                     db="Users" mykey="UniqueID"
  575.                 ;;
  576.                 group)
  577.                     db="Groups" mykey="PrimaryGroupID"
  578.                 ;;
  579.             esac;
  580.             case ${key} in
  581.                 *[!0-9]*)
  582.                     dscl . -read /${db}/${key} 2> /dev/null | grep RecordName
  583.                 ;;
  584.                 *)
  585.                     dscl . -search /${db} ${mykey} ${key} 2> /dev/null
  586.                 ;;
  587.             esac
  588.         ;;
  589.         *-freebsd* | *-dragonfly*)
  590.             case ${db} in
  591.                 passwd)
  592.                     db="user"
  593.                 ;;
  594.                 *)
  595.  
  596.                 ;;
  597.             esac;
  598.             local opts;
  599.             if [[ ${key} == [[:digit:]]* ]]; then
  600.                 [[ ${db} == "user" ]] && opts="-u" || opts="-g";
  601.             fi;
  602.             pw show ${db} ${opts} "${key}" -q
  603.         ;;
  604.         *-netbsd* | *-openbsd*)
  605.             grep "${key}:\*:" /etc/${db}
  606.         ;;
  607.         *)
  608.             nscd -i "${db}" 2> /dev/null;
  609.             getent "${db}" "${key}"
  610.         ;;
  611.     esac
  612. }
  613. egethome ()
  614. {
  615.     local pos;
  616.     [[ $# -eq 1 ]] || die "usage: egethome <user>";
  617.     case ${CHOST} in
  618.         *-darwin* | *-freebsd* | *-dragonfly*)
  619.             pos=9
  620.         ;;
  621.         *)
  622.             pos=6
  623.         ;;
  624.     esac;
  625.     egetent passwd "$1" | cut -d: -f${pos}
  626. }
  627. egetshell ()
  628. {
  629.     local pos;
  630.     [[ $# -eq 1 ]] || die "usage: egetshell <user>";
  631.     case ${CHOST} in
  632.         *-darwin* | *-freebsd* | *-dragonfly*)
  633.             pos=10
  634.         ;;
  635.         *)
  636.             pos=7
  637.         ;;
  638.     esac;
  639.     egetent passwd "$1" | cut -d: -f${pos}
  640. }
  641. einstalldocs ()
  642. {
  643.     ( if ! declare -p DOCS &> /dev/null; then
  644.         local d;
  645.         for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  646.         do
  647.             [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
  648.         done;
  649.     else
  650.         if ___is_indexed_array_var DOCS; then
  651.             [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
  652.         else
  653.             [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
  654.         fi;
  655.     fi );
  656.     ( if ___is_indexed_array_var HTML_DOCS; then
  657.         [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
  658.     else
  659.         [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
  660.     fi )
  661. }
  662. eislocked ()
  663. {
  664.     [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
  665.     if [[ ${EUID} != 0 ]]; then
  666.         einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
  667.         return 0;
  668.     fi;
  669.     case ${CHOST} in
  670.         *-freebsd* | *-dragonfly* | *-netbsd*)
  671.             [[ $(egetent "$1" | cut -d: -f2) == '*LOCKED*'* ]]
  672.         ;;
  673.         *-openbsd*)
  674.             return 2
  675.         ;;
  676.         *)
  677.             [[ $(getent shadow "$1" | cut -d: -f2) == '!'* ]] && [[ $(getent shadow "$1" | cut -d: -f8) == 1 ]]
  678.         ;;
  679.     esac
  680. }
  681. elockuser ()
  682. {
  683.     [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
  684.     if [[ ${EUID} != 0 ]]; then
  685.         einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
  686.         return 0;
  687.     fi;
  688.     eislocked "$1";
  689.     [[ $? -eq 0 ]] && return 0;
  690.     case ${CHOST} in
  691.         *-freebsd* | *-dragonfly*)
  692.             pw lock "$1" || die "Locking account $1 failed";
  693.             pw user mod "$1" -e 1 || die "Expiring account $1 failed"
  694.         ;;
  695.         *-netbsd*)
  696.             usermod -e 1 -C yes "$1" || die "Locking account $1 failed"
  697.         ;;
  698.         *-openbsd*)
  699.             return 2
  700.         ;;
  701.         *)
  702.             usermod -e 1 -L "$1" || die "Locking account $1 failed"
  703.         ;;
  704.     esac;
  705.     elog "User account $1 locked";
  706.     return 0
  707. }
  708. enewgroup ()
  709. {
  710.     _assert_pkg_ebuild_phase ${FUNCNAME};
  711.     local egroup=$1;
  712.     shift;
  713.     if [[ -z ${egroup} ]]; then
  714.         eerror "No group specified !";
  715.         die "Cannot call enewgroup without a group";
  716.     fi;
  717.     if [[ -n $(egetent group "${egroup}") ]]; then
  718.         return 0;
  719.     fi;
  720.     einfo "Adding group '${egroup}' to your system ...";
  721.     local egid=$1;
  722.     shift;
  723.     egid=$(_get_next_id group ${egid});
  724.     einfo " - Groupid: ${egid}";
  725.     if [[ $# -gt 0 ]]; then
  726.         die "extra arguments no longer supported; please file a bug";
  727.     fi;
  728.     case ${CHOST} in
  729.         *-darwin*)
  730.             dscl . create "/groups/${egroup}" gid ${egid};
  731.             dscl . create "/groups/${egroup}" passwd '*'
  732.         ;;
  733.         *-freebsd* | *-dragonfly*)
  734.             pw groupadd "${egroup}" -g ${egid} || die
  735.         ;;
  736.         *-netbsd* | *-openbsd*)
  737.             groupadd -g ${egid} "${egroup}" || die
  738.         ;;
  739.         *)
  740.             groupadd -r ${opts} "${egroup}" || die
  741.         ;;
  742.     esac
  743. }
  744. enewuser ()
  745. {
  746.     _assert_pkg_ebuild_phase ${FUNCNAME};
  747.     local euser=$1;
  748.     shift;
  749.     if [[ -z ${euser} ]]; then
  750.         eerror "No username specified !";
  751.         die "Cannot call enewuser without a username";
  752.     fi;
  753.     if [[ -n $(egetent passwd "${euser}") ]]; then
  754.         return 0;
  755.     fi;
  756.     einfo "Adding user '${euser}' to your system ...";
  757.     local opts=();
  758.     local euid=$1;
  759.     shift;
  760.     euid=$(_get_next_id passwd ${euid});
  761.     if [[ ${euid} != "next available" ]]; then
  762.         opts+=(-u ${euid});
  763.     fi;
  764.     einfo " - Userid: ${euid}";
  765.     local eshell=$1;
  766.     shift;
  767.     if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]]; then
  768.         if [[ ! -e ${ROOT}${eshell} ]]; then
  769.             eerror "A shell was specified but it does not exist !";
  770.             die "${eshell} does not exist in ${ROOT}";
  771.         fi;
  772.         if [[ ${eshell} == */false || ${eshell} == */nologin ]]; then
  773.             eerror "Do not specify ${eshell} yourself, use -1";
  774.             die "Pass '-1' as the shell parameter";
  775.         fi;
  776.     else
  777.         for eshell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null;
  778.         do
  779.             [[ -x ${ROOT}${eshell} ]] && break;
  780.         done;
  781.         if [[ ${eshell} == "/dev/null" ]]; then
  782.             eerror "Unable to identify the shell to use, proceeding with userland default.";
  783.             case ${USERLAND} in
  784.                 GNU)
  785.                     eshell="/bin/false"
  786.                 ;;
  787.                 BSD)
  788.                     eshell="/sbin/nologin"
  789.                 ;;
  790.                 Darwin)
  791.                     eshell="/usr/sbin/nologin"
  792.                 ;;
  793.                 *)
  794.                     die "Unable to identify the default shell for userland ${USERLAND}"
  795.                 ;;
  796.             esac;
  797.         fi;
  798.     fi;
  799.     einfo " - Shell: ${eshell}";
  800.     opts+=(-s "${eshell}");
  801.     local ehome=$1;
  802.     shift;
  803.     if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]]; then
  804.         ehome="/dev/null";
  805.     fi;
  806.     einfo " - Home: ${ehome}";
  807.     opts+=(-d "${ehome}");
  808.     local egroups=$1;
  809.     shift;
  810.     local g egroups_arr;
  811.     IFS="," read -r -a egroups_arr <<< "${egroups}";
  812.     shift;
  813.     if [[ ${#egroups_arr[@]} -gt 0 ]]; then
  814.         local defgroup exgroups;
  815.         for g in "${egroups_arr[@]}";
  816.         do
  817.             if [[ -z $(egetent group "${g}") ]]; then
  818.                 eerror "You must add group ${g} to the system first";
  819.                 die "${g} is not a valid GID";
  820.             fi;
  821.             if [[ -z ${defgroup} ]]; then
  822.                 defgroup=${g};
  823.             else
  824.                 exgroups+=",${g}";
  825.             fi;
  826.         done;
  827.         opts+=(-g "${defgroup}");
  828.         if [[ ! -z ${exgroups} ]]; then
  829.             opts+=(-G "${exgroups:1}");
  830.         fi;
  831.     fi;
  832.     einfo " - Groups: ${egroups:-(none)}";
  833.     if [[ $# -gt 0 ]]; then
  834.         die "extra arguments no longer supported; please file a bug";
  835.     else
  836.         local comment="added by portage for ${PN}";
  837.         opts+=(-c "${comment}");
  838.         einfo " - GECOS: ${comment}";
  839.     fi;
  840.     case ${CHOST} in
  841.         *-darwin*)
  842.             dscl . create "/users/${euser}" uid ${euid};
  843.             dscl . create "/users/${euser}" shell "${eshell}";
  844.             dscl . create "/users/${euser}" home "${ehome}";
  845.             dscl . create "/users/${euser}" realname "added by portage for ${PN}";
  846.             for g in "${egroups_arr[@]}";
  847.             do
  848.                 dscl . merge "/groups/${g}" users "${euser}";
  849.             done
  850.         ;;
  851.         *-freebsd* | *-dragonfly*)
  852.             pw useradd "${euser}" "${opts[@]}" || die
  853.         ;;
  854.         *-netbsd*)
  855.             useradd "${opts[@]}" "${euser}" || die
  856.         ;;
  857.         *-openbsd*)
  858.             useradd -u ${euid} -s "${eshell}" -d "${ehome}" -g "${egroups}" "${euser}" || die
  859.         ;;
  860.         *)
  861.             useradd -r "${opts[@]}" "${euser}" || die
  862.         ;;
  863.     esac;
  864.     if [[ ! -e ${ROOT}/${ehome} ]]; then
  865.         einfo " - Creating ${ehome} in ${ROOT}";
  866.         mkdir -p "${ROOT}/${ehome}";
  867.         chown "${euser}" "${ROOT}/${ehome}";
  868.         chmod 755 "${ROOT}/${ehome}";
  869.     fi
  870. }
  871. esethome ()
  872. {
  873.     _assert_pkg_ebuild_phase ${FUNCNAME};
  874.     local euser=$1;
  875.     shift;
  876.     if [[ -z ${euser} ]]; then
  877.         eerror "No username specified !";
  878.         die "Cannot call esethome without a username";
  879.     fi;
  880.     if [[ -z $(egetent passwd "${euser}") ]]; then
  881.         ewarn "User does not exist, cannot set home dir -- skipping.";
  882.         return 1;
  883.     fi;
  884.     local ehome=$1;
  885.     shift;
  886.     if [[ -z ${ehome} ]]; then
  887.         eerror "No home directory specified !";
  888.         die "Cannot call esethome without a home directory or '-1'";
  889.     fi;
  890.     if [[ ${ehome} == "-1" ]]; then
  891.         ehome="/dev/null";
  892.     fi;
  893.     if [[ $(egethome "${euser}") == ${ehome} ]]; then
  894.         return 0;
  895.     fi;
  896.     einfo "Updating home for user '${euser}' ...";
  897.     einfo " - Home: ${ehome}";
  898.     if [[ ! -e ${ROOT}/${ehome} ]]; then
  899.         einfo " - Creating ${ehome} in ${ROOT}";
  900.         mkdir -p "${ROOT}/${ehome}";
  901.         chown "${euser}" "${ROOT}/${ehome}";
  902.         chmod 755 "${ROOT}/${ehome}";
  903.     fi;
  904.     case ${CHOST} in
  905.         *-darwin*)
  906.             dscl . change "/users/${euser}" home "${ehome}"
  907.         ;;
  908.         *-freebsd* | *-dragonfly*)
  909.             pw usermod "${euser}" -d "${ehome}" && return 0;
  910.             [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home";
  911.             eerror "There was an error when attempting to update the home directory for ${euser}";
  912.             eerror "Please update it manually on your system:";
  913.             eerror "\t pw usermod \"${euser}\" -d \"${ehome}\""
  914.         ;;
  915.         *)
  916.             usermod -d "${ehome}" "${euser}" && return 0;
  917.             [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home";
  918.             eerror "There was an error when attempting to update the home directory for ${euser}";
  919.             eerror "Please update it manually on your system (as root):";
  920.             eerror "\t usermod -d \"${ehome}\" \"${euser}\""
  921.         ;;
  922.     esac
  923. }
  924. eunlockuser ()
  925. {
  926.     [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>";
  927.     if [[ ${EUID} != 0 ]]; then
  928.         einfo "Insufficient privileges to execute ${FUNCNAME[0]}";
  929.         return 0;
  930.     fi;
  931.     eislocked "$1";
  932.     [[ $? -eq 1 ]] && return 0;
  933.     case ${CHOST} in
  934.         *-freebsd* | *-dragonfly*)
  935.             pw user mod "$1" -e 0 || die "Unexpiring account $1 failed";
  936.             pw unlock "$1" || die "Unlocking account $1 failed"
  937.         ;;
  938.         *-netbsd*)
  939.             usermod -e 0 -C no "$1" || die "Unlocking account $1 failed"
  940.         ;;
  941.         *-openbsd*)
  942.             return 1
  943.         ;;
  944.         *)
  945.             usermod -e "" -U "$1" 2> /dev/null || die "Unlocking account $1 failed"
  946.         ;;
  947.     esac;
  948.     ewarn "User account $1 unlocked after reinstating.";
  949.     return 0
  950. }
  951. get_libdir ()
  952. {
  953.     local libdir_var="LIBDIR_${ABI}";
  954.     local libdir="lib";
  955.     [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
  956.     echo "${libdir}"
  957. }
  958. in_iuse ()
  959. {
  960.     local use=${1};
  961.     if [[ -z "${use}" ]]; then
  962.         echo "!!! in_iuse() called without a parameter." 1>&2;
  963.         echo "!!! in_iuse <USEFLAG>" 1>&2;
  964.         die "in_iuse() called without a parameter";
  965.     fi;
  966.     local liuse=(${IUSE_EFFECTIVE});
  967.     has "${use}" "${liuse[@]#[+-]}"
  968. }
  969. pkg_nofetch ()
  970. {
  971.     default
  972. }
  973. pkg_postinst ()
  974. {
  975.     acct-user_pkg_postinst "$@"
  976. }
  977. pkg_preinst ()
  978. {
  979.     acct-user_pkg_preinst "$@"
  980. }
  981. pkg_prerm ()
  982. {
  983.     acct-user_pkg_prerm "$@"
  984. }
  985. pkg_pretend ()
  986. {
  987.     acct-user_pkg_pretend "$@"
  988. }
  989. src_compile ()
  990. {
  991.     default
  992. }
  993. src_configure ()
  994. {
  995.     default
  996. }
  997. src_install ()
  998. {
  999.     acct-user_src_install "$@"
  1000. }
  1001. src_prepare ()
  1002. {
  1003.     default
  1004. }
  1005. src_test ()
  1006. {
  1007.     default
  1008. }
  1009. src_unpack ()
  1010. {
  1011.     default
  1012. }
  1013. ver_cut ()
  1014. {
  1015.     local range=${1};
  1016.     local v=${2:-${PV}};
  1017.     local start end;
  1018.     local -a comp;
  1019.     __eapi7_ver_split "${v}";
  1020.     local max=$((${#comp[@]}/2));
  1021.     __eapi7_ver_parse_range "${range}" "${max}";
  1022.     local IFS=;
  1023.     if [[ ${start} -gt 0 ]]; then
  1024.         start=$(( start*2 - 1 ));
  1025.     fi;
  1026.     echo "${comp[*]:start:end*2-start}"
  1027. }
  1028. ver_rs ()
  1029. {
  1030.     local v;
  1031.     (( ${#} & 1 )) && v=${@: -1} || v=${PV};
  1032.     local start end i;
  1033.     local -a comp;
  1034.     __eapi7_ver_split "${v}";
  1035.     local max=$((${#comp[@]}/2 - 1));
  1036.     while [[ ${#} -ge 2 ]]; do
  1037.         __eapi7_ver_parse_range "${1}" "${max}";
  1038.         for ((i = start*2; i <= end*2; i+=2 ))
  1039.         do
  1040.             [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue;
  1041.             comp[i]=${2};
  1042.         done;
  1043.         shift 2;
  1044.     done;
  1045.     local IFS=;
  1046.     echo "${comp[*]}"
  1047. }
  1048. ver_test ()
  1049. {
  1050.     local va op vb;
  1051.     if [[ $# -eq 3 ]]; then
  1052.         va=${1};
  1053.         shift;
  1054.     else
  1055.         va=${PVR};
  1056.     fi;
  1057.     [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments";
  1058.     op=${1};
  1059.     vb=${2};
  1060.     case ${op} in
  1061.         -eq | -ne | -lt | -le | -gt | -ge)
  1062.  
  1063.         ;;
  1064.         *)
  1065.             die "${FUNCNAME}: invalid operator: ${op}"
  1066.         ;;
  1067.     esac;
  1068.     __eapi7_ver_compare "${va}" "${vb}";
  1069.     test $? "${op}" 2
  1070. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement