declare -x ABI="amd64" declare -x ABI_MIPS="" declare -x ABI_PPC="" declare -x ABI_RISCV="" declare -x ABI_S390="" declare -x ABI_X86="64" declare -x ADA_TARGET="" declare -x ALSA_CARDS="" declare -x APACHE2_MODULES="" declare -x APACHE2_MPMS="" declare -x ARCH="amd64" declare BDEPEND="" declare -x BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_6 python_targets_python2_7 multilib hardened pic xtpax -jit -orc" declare -x CALLIGRA_FEATURES="" declare -x CAMERAS="" declare -x CBUILD="x86_64-pc-linux-gnu" declare -x CFLAGS="-O2 -pipe -march=native -fno-common" declare -x CFLAGS_amd64="-m64" declare -x CFLAGS_x32="-mx32" declare -x CFLAGS_x86="-m32" declare -x CHOST="x86_64-pc-linux-gnu" declare -x CHOST_amd64="x86_64-pc-linux-gnu" declare -x CHOST_x32="x86_64-pc-linux-gnux32" declare -x CHOST_x86="i686-pc-linux-gnu" declare -x COLLECTD_PLUGINS="" declare -x COMMON_FLAGS="-O2 -pipe -march=native -fno-common" declare -x CONF_PREFIX="/usr" 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=native -fno-common" declare -x DEFAULT_ABI="amd64" declare -x DEFINED_PHASES=" configure install preinst setup" declare DEPEND=" net-mail/mailbase ldap? ( net-nds/openldap ) mysql? ( dev-db/mysql-connector-c:0= ) postgres? ( dev-db/postgresql ) sqlite? ( dev-db/sqlite:3 ) " declare DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" declare -x DIROPTIONS="-m0755" declare -- DRIVERS_IUSE="+hash mysql postgres sqlite" declare -- DSPAM_CONF="/etc/dspam" declare -- DSPAM_DRIVERS="hash_drv,pgsql_drv,hash_drv,pgsql_drv" declare -- DSPAM_DRIVERS_EXTRAS="" declare -- DSPAM_HOME="/var/spool/dspam" declare -- DSPAM_LOG="/var/log/dspam" declare -- DSPAM_MODE="2510" declare -x EAPI="7" declare -- ECONF_SOURCE="." declare -x EDENHOME="/usr/lib64/eden" declare -x EGO_BUILD_FLAGS="-p 1" declare -x ELIBC="glibc" declare -x EMBOSS_ACDROOT="/usr/share/EMBOSS/acd" declare -x EMBOSS_DATA="/usr/share/EMBOSS/data" 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="1580321350.084394" declare -- EPOCHSECONDS="1580321350" declare -x EXEOPTIONS="-m0755" declare -x FCFLAGS="-O2 -pipe -march=native -fno-common" 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=native -fno-common" declare -x FFTOOLS="" declare -x FLTK_DOCDIR="/usr/share/doc/fltk-1.3.5-r4/html" declare -x FRACTDIR="/usr/share/xfractint" declare -x GCC_COLORS="" declare -x GCC_SPECS="" declare -x GO19CONCURRENTCOMPILATION="0" declare -x GOMAXPROCS="1" declare -x GPSD_PROTOCOLS="" declare -x GREP_COLORS="never" declare -x GRUB_PLATFORMS="" declare -x GSETTINGS_BACKEND="dconf" declare HOMEPAGE="http://dspam.sourceforge.net/" declare -x INHERITED=" user" declare -x INPUT_DEVICES="" declare -x INSOPTIONS="-m0644" declare IUSE="clamav daemon debug ldap static-libs syslog virtual-users user-homedirs +hash mysql postgres sqlite small-scale +domain-scale large-scale " declare -x IUSE_EFFECTIVE="abi_x86_64 alpha amd64 amd64-fbsd amd64-linux arm arm64 clamav daemon debug domain-scale 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 hash hppa ia64 kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux large-scale ldap m68k m68k-mint mips mysql postgres ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-guest prefix-stack riscv s390 sh small-scale sparc sparc-solaris sparc64-solaris sqlite static-libs syslog user-homedirs userland_BSD userland_GNU virtual-users x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt" declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack" declare -x JAVAC="/bin/javac" declare -x JDK_HOME="" declare -x KERNEL="linux" declare -x KEYWORDS="amd64 ~arm ~arm64 ~ppc x86" declare -x L10N="" declare -x LADSPA_PATH="/usr/lib64/ladspa" 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 LDFLAGS_amd64="-m elf_x86_64" declare -x LDFLAGS_x32="-m elf32_x86_64" declare -x LDFLAGS_x86="-m elf_i386" declare -x LIBDIR_amd64="lib64" declare -x LIBDIR_x32="libx32" declare -x LIBDIR_x86="lib" declare -x LIBOPTIONS="-m0644" declare -x LIBREOFFICE_EXTENSIONS="" declare -x LICENSE="AGPL-3" declare -x LIRC_DEVICES="" declare -x LLVM_TARGETS="" declare -x LV2_PATH="/usr/lib64/lv2" declare -x MAKEOPTS="-j1" declare -x MANPAGER="manpager" declare -x MONKEYD_PLUGINS="" declare -x MULTILIB_ABIS="amd64 x86" declare -x MULTILIB_STRICT_DENY="64-bit.*shared object" declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib" declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)" declare -x NGINX_MODULES_HTTP="" declare -x NGINX_MODULES_MAIL="" declare -x NGINX_MODULES_STREAM="" declare -x NINJAFLAGS="-j1" declare -x OFED_DRIVERS="" declare -x OFFICE_IMPLEMENTATION="" declare -x OMP_DYNAMIC="FALSE" declare -x OMP_NESTED="FALSE" declare -x OMP_NUM_THREADS="1" 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 -x PAX_MARKINGS="none" declare PDEPEND="" declare -x PHP_TARGETS="" declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig" 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/dspam-3.10.2-r2/html") declare -a PORTAGE_DOSTRIP=([0]="/") declare -a PORTAGE_DOSTRIP_SKIP=() declare -x PORT_LOGDIR="/var/log/portage" declare -x POSTGRES_TARGETS="" declare -x PROFILE_IS_HARDENED="1" 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 RDEPEND=" net-mail/mailbase ldap? ( net-nds/openldap ) mysql? ( dev-db/mysql-connector-c:0= ) postgres? ( dev-db/postgresql ) sqlite? ( dev-db/sqlite:3 ) clamav? ( app-antivirus/clamav ) syslog? ( virtual/logger ) " declare REPOSITORY declare REQUIRED_USE=" || ( hash mysql postgres sqlite ) static-libs? ( ^^ ( hash mysql postgres sqlite ) ) ^^ ( small-scale domain-scale large-scale ) virtual-users? ( !user-homedirs ) " 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 RUSTFLAGS="-C codegen-units=1" declare -x RUST_TEST_TASKS="1" declare -x RUST_TEST_THREADS="1" declare -x S="/var/tmp/portage/mail-filter/dspam-3.10.2-r2/work/dspam-3.10.2" declare -x SANDBOX_DEBUG="0" declare -x SANDBOX_DENY="" declare -x SANDBOX_PREDICT="/var/tmp/portage/mail-filter/dspam-3.10.2-r2/homedir:/var/cache/man:/dev/random:/proc/self/coredump_filter:/var/cache/fontconfig" declare -x SANDBOX_READ="/:/var/tmp/portage" declare -x SANDBOX_VERBOSE="1" declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/ptmx:/dev/pts/:/dev/pty:/dev/shm:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp/:/var/tmp/portage:/var/tmp/portage/mail-filter/dspam-3.10.2-r2/homedir/.bash_history" declare -x SANE_BACKENDS="" declare -- SCALES_IUSE="small-scale +domain-scale large-scale" declare -x SHELL="/bin/bash" declare -x SLOT="0" declare SRC_URI="mirror://sourceforge/dspam/dspam-3.10.2.tar.gz" declare -x SYMLINK_LIB="no" declare -x TERMINFO="/etc/terminfo" declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1" declare -x USE="abi_x86_64 amd64 domain-scale elibc_glibc hash kernel_linux postgres 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 XFCE_PLUGINS="" declare -x XTABLES_ADDONS="" declare -x _E_DESTTREE_="/usr" declare -x _E_DOCDESTTREE_="" declare -x _E_EXEDESTTREE_="" declare -x _E_INSDESTTREE_="" declare -- _USER_ECLASS="1" __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 | prerm | postrm) ;; *) eerror "'$1()' called from '${EBUILD_PHASE}' phase which is not OK:"; eerror "You may only call from pkg_{setup,{pre,post}{inst,rm}} 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 } _enewgroup_next_gid () { if [[ ${egid} == *[!0-9]* ]]; then for ((egid = 999; egid >= 101; egid--)) do [[ -z $(egetent group ${egid}) ]] && break; done; [[ ${egid} -ge 101 ]] || die "${FUNCNAME}: no free GID found"; fi } dspam_setup_storage_drivers () { if use hash; then DSPAM_DRIVERS+=",hash_drv"; fi; if use mysql; then DSPAM_DRIVERS+=",mysql_drv"; DSPAM_DRIVERS_EXTRAS+="--with-mysql-includes=/usr/include/mysql "; fi; if use postgres; then DSPAM_DRIVERS+=",pgsql_drv"; fi; if use sqlite; then DSPAM_DRIVERS+=",sqlite3_drv"; fi; if ! use static-libs; then DSPAM_DRIVERS+=${DSPAM_DRIVERS}; fi; DSPAM_DRIVERS=${DSPAM_DRIVERS:1}; einfo "Building with drivers: ${DSPAM_DRIVERS}" } dspam_setup_user () { local euid egid; for euid in {1000..5000}; do [ -z "$(egetent passwd ${euid})" ] && break; done; for egid in {1000..5000}; do [ -z "$(egetent group ${egid})" ] && break; done; enewgroup dspam ${egid}; enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail } 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." } egetcomment () { local pos; [[ $# -eq 1 ]] || die "usage: egetshell "; case ${CHOST} in *-freebsd* | *-dragonfly*) pos=8 ;; *) pos=5 ;; esac; egetent passwd "$1" | cut -d: -f${pos} } egetent () { local db=$1 key=$2; [[ $# -ge 3 ]] && die "usage: egetent "; case ${db} in passwd | group) ;; *) die "sorry, database '${db}' not yet supported; file a bug" ;; esac; case ${CHOST} in *-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 ;; *-openbsd*) grep "${key}:\*:" /etc/${db} ;; *) type -p nscd > /dev/null && nscd -i "${db}" 2> /dev/null; getent "${db}" "${key}" ;; esac } egetgroupname () { [[ $# -eq 1 ]] || die "usage: egetgroupname "; egetent group "$1" | cut -d: -f1 } egetgroups () { [[ $# -eq 1 ]] || die "usage: egetgroups "; local egroups_arr; read -r -a egroups_arr < <(id -G -n "$1"); local g groups=${egroups_arr[0]}; while read -r g; do [[ -n ${g} ]] && groups+=",${g}"; done < <(printf '%s\n' "${egroups_arr[@]:1}" | sort); echo "${groups}" } egethome () { local pos; [[ $# -eq 1 ]] || die "usage: egethome "; case ${CHOST} in *-freebsd* | *-dragonfly*) pos=9 ;; *) pos=6 ;; esac; egetent passwd "$1" | cut -d: -f${pos} } egetshell () { local pos; [[ $# -eq 1 ]] || die "usage: egetshell "; case ${CHOST} in *-freebsd* | *-dragonfly*) pos=10 ;; *) pos=7 ;; esac; egetent passwd "$1" | cut -d: -f${pos} } egetusername () { [[ $# -eq 1 ]] || die "usage: egetusername "; egetent passwd "$1" | cut -d: -f1 } 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 ) } enewgroup () { if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}"; return 0; fi; _assert_pkg_ebuild_phase ${FUNCNAME}; local force_gid=; while [[ $1 == -* ]]; do case $1 in -F) force_gid=1 ;; *) die "${FUNCNAME}: invalid option ${1}" ;; esac; shift; done; 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; if [[ ! -z ${egid} ]]; then if [[ ${egid} -gt 0 ]]; then if [[ -n $(egetent group ${egid}) ]]; then [[ -n ${force_gid} ]] && die "${FUNCNAME}: GID ${egid} already taken"; 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 [[ -n ${force_gid} ]] && die "${FUNCNAME}: -F with gid==-1 makes no sense"; egid="next available"; fi; einfo " - Groupid: ${egid}"; if [[ $# -gt 0 ]]; then die "extra arguments no longer supported; please file a bug"; fi; function _enewgroup_next_gid () { if [[ ${egid} == *[!0-9]* ]]; then for ((egid = 999; egid >= 101; egid--)) do [[ -z $(egetent group ${egid}) ]] && break; done; [[ ${egid} -ge 101 ]] || die "${FUNCNAME}: no free GID found"; fi }; case ${CHOST} in *-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 opts=""; else opts="-g ${egid}"; fi; groupadd -r ${opts} "${egroup}" || die ;; esac } enewuser () { if [[ ${EUID} != 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}"; return 0; fi; _assert_pkg_ebuild_phase ${FUNCNAME}; local create_home=1 force_uid=; while [[ $1 == -* ]]; do case $1 in -F) force_uid=1 ;; -M) create_home= ;; *) die "${FUNCNAME}: invalid option ${1}" ;; esac; shift; done; 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; if [[ -n ${euid} && ${euid} != -1 ]]; then if [[ ${euid} -gt 0 ]]; then if [[ -n $(egetent passwd ${euid}) ]]; then [[ -n ${force_uid} ]] && die "${FUNCNAME}: UID ${euid} already taken"; euid="next"; fi; else eerror "Userid given but is not greater than 0 !"; die "${euid} is not a valid UID"; fi; else [[ -n ${force_uid} ]] && die "${FUNCNAME}: -F with uid==-1 makes no sense"; euid="next"; fi; if [[ ${euid} == "next" ]]; then for ((euid = 999; euid >= 101; euid--)) do [[ -z $(egetent passwd ${euid}) ]] && break; done; [[ ${euid} -ge 101 ]] || die "${FUNCNAME}: no free UID found"; fi; opts+=(-u ${euid}); 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 eshell=$(user_get_nologin); 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}"; 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 *-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 -M -N -r "${opts[@]}" "${euser}" || die ;; esac; if [[ -n ${create_home} && ! -e ${ROOT}/${ehome} ]]; then einfo " - Creating ${ehome} in ${ROOT}"; mkdir -p "${ROOT}/${ehome}"; chown "${euser}" "${ROOT}/${ehome}"; chmod 755 "${ROOT}/${ehome}"; fi } esetcomment () { _assert_pkg_ebuild_phase ${FUNCNAME}; local euser=$1; shift; if [[ -z ${euser} ]]; then eerror "No username specified !"; die "Cannot call esetcomment without a username"; fi; if [[ -z $(egetent passwd "${euser}") ]]; then ewarn "User does not exist, cannot set comment -- skipping."; return 1; fi; local ecomment=$1; shift; if [[ -z ${ecomment} ]]; then eerror "No comment specified !"; die "Cannot call esetcomment without a comment"; fi; if [[ $(egetcomment "${euser}") == ${ecomment} ]]; then return 0; fi; einfo "Updating comment for user '${euser}' ..."; einfo " - Comment: ${ecomment}"; case ${CHOST} in *-freebsd* | *-dragonfly*) pw usermod "${euser}" -c "${ecomment}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update comment"; eerror "There was an error when attempting to update the comment for ${euser}"; eerror "Please update it manually on your system:"; eerror "\t pw usermod \"${euser}\" -c \"${ecomment}\"" ;; *) usermod -c "${ecomment}" "${euser}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update comment"; eerror "There was an error when attempting to update the comment for ${euser}"; eerror "Please update it manually on your system (as root):"; eerror "\t usermod -c \"${ecomment}\" \"${euser}\"" ;; esac } esetgroups () { _assert_pkg_ebuild_phase ${FUNCNAME}; [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} "; local euser=$1; shift; if [[ -z $(egetent passwd "${euser}") ]]; then ewarn "User does not exist, cannot set group -- skipping."; return 1; fi; local egroups=$1; shift; local g egroups_arr=(); IFS="," read -r -a egroups_arr <<< "${egroups}"; [[ ${#egroups_arr[@]} -gt 0 ]] || die "${FUNCNAME}: no groups specified"; 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; done; local defgroup=${egroups_arr[0]} exgroups_arr=(); readarray -t exgroups_arr < <(printf '%s\n' "${egroups_arr[@]:1}" | sort); local exgroups=${exgroups_arr[*]}; exgroups=${exgroups// /,}; egroups=${defgroup}${exgroups:+,${exgroups}}; if [[ $(egetgroups "${euser}") == ${egroups} ]]; then return 0; fi; local opts=(-g "${defgroup}" -G "${exgroups}"); einfo "Updating groups for user '${euser}' ..."; einfo " - Groups: ${egroups}"; case ${CHOST} in *-freebsd* | *-dragonfly*) pw usermod "${euser}" "${opts[@]}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update groups"; eerror "There was an error when attempting to update the groups for ${euser}"; eerror "Please update it manually on your system:"; eerror "\t pw usermod \"${euser}\" ${opts[*]}" ;; *) usermod "${opts[@]}" "${euser}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update groups"; eerror "There was an error when attempting to update the groups for ${euser}"; eerror "Please update it manually on your system (as root):"; eerror "\t usermod ${opts[*]} \"${euser}\"" ;; esac } 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 *-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 } esetshell () { _assert_pkg_ebuild_phase ${FUNCNAME}; local euser=$1; shift; if [[ -z ${euser} ]]; then eerror "No username specified !"; die "Cannot call esetshell without a username"; fi; if [[ -z $(egetent passwd "${euser}") ]]; then ewarn "User does not exist, cannot set shell -- skipping."; return 1; fi; local eshell=$1; shift; if [[ -z ${eshell} ]]; then eerror "No shell specified !"; die "Cannot call esetshell without a shell or '-1'"; fi; if [[ ${eshell} == "-1" ]]; then eshell=$(user_get_nologin); fi; if [[ $(egetshell "${euser}") == ${eshell} ]]; then return 0; fi; einfo "Updating shell for user '${euser}' ..."; einfo " - Shell: ${eshell}"; case ${CHOST} in *-freebsd* | *-dragonfly*) pw usermod "${euser}" -s "${eshell}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update shell"; eerror "There was an error when attempting to update the shell for ${euser}"; eerror "Please update it manually on your system:"; eerror "\t pw usermod \"${euser}\" -s \"${eshell}\"" ;; *) usermod -s "${eshell}" "${euser}" && return 0; [[ $? == 8 ]] && eerror "${euser} is in use, cannot update shell"; eerror "There was an error when attempting to update the shell for ${euser}"; eerror "Please update it manually on your system (as root):"; eerror "\t usermod -s \"${eshell}\" \"${euser}\"" ;; esac } 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 " 1>&2; die "in_iuse() called without a parameter"; fi; local liuse=(${IUSE_EFFECTIVE}); has "${use}" "${liuse[@]#[+-]}" } pkg_nofetch () { default } pkg_preinst () { if [ -d "${ROOT}/etc/mail/dspam" ]; then ewarn "The configuration directory of DSPAM has been relocated from /etc/mail/dspam to ${DSPAM_CONF}."; if [ -h "${ROOT}${DSPAM_CONF}" ]; then ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..."; rm "${ROOT}${DSPAM_CONF}" && mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}"; eend $?; else if [ -d "${ROOT}${DSPAM_CONF}" ]; then ewarn "You have both /etc/mail/dspam and ${DSPAM_CONF} directories, please delete the former."; else ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..."; mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}"; eend $?; fi; fi; fi } pkg_setup () { dspam_setup_storage_drivers; dspam_setup_user } src_compile () { default } src_configure () { econf --sysconfdir=${DSPAM_CONF} --with-dspam-home=${DSPAM_HOME} --with-dspam-home-group=dspam --with-dspam-mode=${DSPAM_MODE} --with-dspam-group=dspam --with-logdir=${DSPAM_LOG} --enable-external-lookup --enable-long-usernames --enable-split-configuration $(use_enable clamav) $(use_enable daemon) $(use_enable debug) $(use_enable debug bnr-debug) $(use_enable debug verbose-debug) $(use_enable domain-scale) $(use_enable large-scale) $(use_enable static-libs static) $(use_enable syslog) $(use_enable user-homedirs homedir) $(use_enable virtual-users) --with-storage-driver=${DSPAM_DRIVERS} ${DSPAM_DRIVERS_EXTRAS} $(use mysql || use postgres && echo "--enable-preferences-extension") $(use syslog || echo "--with-logfile=${DSPAM_LOG}/dspam.log") } src_install () { default; if use daemon; then newinitd "${FILESDIR}/dspam.initd" dspam; newconfd "${FILESDIR}/dspam.confd" dspam; fi; if use mysql; then insinto "/usr/share/${PN}/mysql"; local files="mysql_objects-4.1.sql mysql_objects-space.sql mysql_objects-speed.sql purge-4.1.sql purge.sql"; if use virtual-users; then files+=" virtual_user_aliases.sql virtual_users.sql"; fi; for file in $files; do doins src/tools.mysql_drv/${file}; done; fi; if use postgres; then insinto "/usr/share/${PN}/pgsql"; local files="pgsql_objects.sql purge-pe.sql purge.sql"; if use virtual-users; then files+=" virtual_users.sql"; fi; for file in $files; do doins src/tools.pgsql_drv/${file}; done; fi; if use sqlite; then insinto "/usr/share/${PN}/sqlite"; newins src/tools.sqlite_drv/purge-3.sql purge.sql; fi; insinto "${DSPAM_HOME}/txt"; doins txt/*.txt; local i; for i in spam nonspam; do echo "Scanned and tagged with DSPAM ${PV} on Gentoo Linux as ${i} by ISP" > "${T}/msgtag.${i}"; doins "${T}/msgtag.${i}"; done; newbin contrib/dspam_maintenance/dspam_maintenance.sh dspam_maintenance; exeinto /etc/cron.daily; newexe "${FILESDIR}/dspam.cron-r4" dspam; insinto /etc/logrotate.d; newins "${FILESDIR}/dspam.logrotate" dspam; dodoc CHANGELOG README* RELEASE.NOTES UPGRADING doc/*.txt; dodir /var/log/dspam; fowners dspam:dspam /var/log/dspam; fperms 0750 /var/log/dspam; fowners root:dspam /usr/bin/dspamc; fperms g+s /usr/bin/dspamc } src_prepare () { default } src_test () { default } src_unpack () { default } user_get_nologin () { local eshell; 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 ewarn "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; echo "${eshell}" } 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 }