commit:     a94e38544f0927e94325ad851a55c26763cae33a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 27 12:59:06 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 27 12:59:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a94e3854

net-misc/hylafaxplus: drop use of eval; misc QA fixes

- Drop use of eval
- Use edo
- Avoid bashisms in init script
- Fix docdir
- Add missing libcrypt dep

Closes: https://bugs.gentoo.org/849269
Closes: https://bugs.gentoo.org/821286
Closes: https://bugs.gentoo.org/835835
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/hylafaxplus/files/hylafaxplus-init-r1   | 176 +++++++++++++++++++++++
 net-misc/hylafaxplus/hylafaxplus-7.0.3-r2.ebuild | 159 ++++++++++++++++++++
 2 files changed, 335 insertions(+)

diff --git a/net-misc/hylafaxplus/files/hylafaxplus-init-r1 
b/net-misc/hylafaxplus/files/hylafaxplus-init-r1
new file mode 100644
index 000000000000..37e459f79c99
--- /dev/null
+++ b/net-misc/hylafaxplus/files/hylafaxplus-init-r1
@@ -0,0 +1,176 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Author Geaaru
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="zap"
+
+depend() {
+       use lo
+}
+
+checkconfig() {
+       ebegin "Check hylafax server configuration..."
+
+       if [ x$spooldir = x ] ; then
+               eerror "No spooldir directory defined"
+               return 1
+       else
+               SPOOL=$spooldir
+               einfo "Use spool directory $SPOOL"
+       fi
+
+       if [ x$mode = x ] ; then
+               eerror "No mode defined"
+               return 1
+       fi
+
+       if [ ! -f $SPOOL/etc/setup.cache ] ; then
+               eerror "No $SPOOL/etc/setup.cache file founded. Use faxsetup 
command"
+               return 1
+       fi
+
+       if [ x$hfaxd = x -o ! -f $hfaxd ] ; then
+               eerror "No hfaxd daemon founded"
+               return 1
+       fi
+
+       if [ x$faxq = x -o ! -f $faxq ] ; then
+               eerror "No faxq program founded"
+               return 1
+       fi
+
+       if [ x$faxgetty = x -o ! -f $faxgetty ] ; then
+               eerror "No faxgetty program founded"
+               return 1
+       fi
+
+       if [ x$faxbind = x ] ; then
+               eerror "No binding address supply"
+               return 1
+       fi
+
+       if [ x$piddir = x ] ; then
+               PIDDIR=$SPOOL
+       else
+               PIDDIR=$piddir
+       fi
+
+
+       hfaxd_args="-l $faxbind -q $SPOOL"
+
+       case $mode in
+               newproto)
+                       if [ x$faxport = x ] ; then
+                               eerror "No faxport defined"
+                               return 1
+                       fi
+                       hfaxd_args="$hfaxd_args -i $faxport"
+                       ;;
+               oldproto)
+                       if [ x$oldprotoport = x ] ; then
+                               eerror "No oldprotoport defined"
+                               return 1
+                       fi
+                       hfaxd_args="$hfaxd_args -o $oldprotoport"
+                       ;;
+               snpp)
+                       if [ x$snppport = x ] ; then
+                               eerror "No snppport defined"
+                               return 1
+                       fi
+                       hfaxd_args="$hfaxd_args -s $snppport"
+                       ;;
+               any)
+                       if [ x$faxport = x -o x$snppport = x -o x$oldprotoport 
= x ] ; then
+                               eerror "No port data founded for old services"
+                               return 1
+                       fi
+                       hfaxd_args="$hfaxd_args -i $faxport -s $snppport -o 
$oldprotoport"
+                       ;;
+               *)
+                       eerror "Invalid mode"
+                       return 1
+                       ;;
+
+       esac
+
+       faxq_args="-q $SPOOL"
+
+       # workaround for manage save of pidfile with start-stop-daemon
+       hfaxd_args="$hfaxd_args -d"
+       faxq_args="$faxq_args -D"
+               
+       return 0
+}
+
+start() {
+       local result
+
+       checkconfig || return 1
+
+       ebegin "Starting HylaFAX server daemons"
+
+       start_faxq
+       result=$?
+
+       if [ $result -ne 0 ]  ; then
+               eerror "Error on start $faxq daemon"
+               return 1
+       fi
+
+       start_hfaxd
+       result=$?
+
+       eend $result
+}
+
+start_hfaxd() {
+       local arguments="--start \
+                        --make-pidfile --pidfile $PIDDIR/hfaxd.pid"
+       
+       einfo "Starting $hfaxd with args $hfaxd_args"
+
+       start-stop-daemon -b ${arguments} --exec $hfaxd -- $hfaxd_args > 
/dev/null 2>&1
+
+       return $?;
+}
+
+start_faxq() {
+       local arguments="--start \
+                        --make-pidfile --pidfile $PIDDIR/faxq.pid"
+       einfo "Starting $faxq ... "
+
+       start-stop-daemon -b ${arguments} --exec $faxq -- $faxq_args > 
/dev/null 2>&1
+       
+       return $?
+}
+
+stop() {
+       checkconfig || return 1
+
+       ebegin "Stopping HylaFAX server daemons"
+       
+       start-stop-daemon --stop --quiet --pidfile $PIDDIR/hfaxd.pid
+       start-stop-daemon --stop --quiet --pidfile $PIDDIR/faxq.pid
+       eend $?
+}
+
+zap() {
+       checkconfig || return 1
+
+       ebegin "Zap HylaFAX server daemon files"
+
+       if [ -f $PIDFILE/hfaxd.pid ] ; then
+               rm -f $PIDFILE/hfaxd.pid
+       fi
+
+       if [ -f $PIDFILE/faxq.pid ] ; then
+               rm -f $PIDFILE/faxq.pid
+       fi
+}
+
+restart() {
+       stop
+       start
+}

diff --git a/net-misc/hylafaxplus/hylafaxplus-7.0.3-r2.ebuild 
b/net-misc/hylafaxplus/hylafaxplus-7.0.3-r2.ebuild
new file mode 100644
index 000000000000..1207db6e57cb
--- /dev/null
+++ b/net-misc/hylafaxplus/hylafaxplus-7.0.3-r2.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit edo pam toolchain-funcs
+
+MY_PN="${PN/plus/}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Enterprise client-server fax package for class 1 and 2 fax modems"
+HOMEPAGE="https://hylafax.sourceforge.io/";
+SRC_URI="mirror://sourceforge/hylafax/${MY_P}.tar.gz"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="hylafaxplus"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="html jbig lcms ldap mgetty pam"
+
+DEPEND="
+       app-text/ghostscript-gpl
+       media-libs/tiff[jbig?]
+       media-libs/libjpeg-turbo:=
+       >=sys-libs/zlib-1.1.4
+       virtual/awk
+       virtual/libcrypt:=
+       virtual/mta
+       jbig? ( media-libs/jbigkit )
+       lcms? ( media-libs/lcms )
+       ldap? ( net-nds/openldap:= )
+       mgetty? ( net-dialup/mgetty[-fax] )
+       pam? ( sys-libs/pam )
+"
+RDEPEND="
+       ${DEPEND}
+       !net-dialup/mgetty[fax]
+       !net-dialup/sendpage
+       net-mail/metamail
+"
+
+CONFIG_PROTECT="${CONFIG_PROTECT} /var/spool/fax/etc /usr/lib/fax"
+CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK} /var/spool/fax/etc/xferfaxlog"
+
+PATCHES=(
+       "${FILESDIR}"/ldconfig-patch
+       "${FILESDIR}"/${PN}-7.0.2-tiff-4.2.patch
+)
+
+src_prepare() {
+       default
+
+       # Force it not to strip binaries
+       for dir in etc util faxalter faxcover faxd faxmail faxrm faxstat \
+               hfaxd sendfax sendpage ; do
+                       sed -i -e "s:-idb:-idb \"nostrip\" -idb:g" \
+                               "${dir}"/Makefile.in || die "sed on 
${dir}/Makefile.in failed"
+       done
+
+       sed -i -e "s:hostname:hostname -f:g" util/{faxrcvd,pollrcvd}.sh.in || 
die "sed on hostname failed"
+
+       # Respect LDFLAGS (at least partially)
+       sed -i -e "/^LDFLAGS/s/LDOPTS}/LDOPTS} ${LDFLAGS}/" defs.in || die "sed 
on defs.in failed"
+
+       sed -i -e "s|-fpic|-fPIC|g" \
+               configure || die
+}
+
+src_configure() {
+       local my_conf=(
+               --with-DIR_BIN=/usr/bin
+               --with-DIR_SBIN=/usr/sbin
+               --with-DIR_LIB=/usr/$(get_libdir)
+               --with-DIR_LIBEXEC=/usr/sbin
+               --with-DIR_LIBDATA=/usr/$(get_libdir)/fax
+               --with-DIR_LOCALE=/usr/share/locale
+               --with-DIR_LOCKS=/var/lock
+               --with-DIR_MAN=/usr/share/man
+               --with-DIR_SPOOL=/var/spool/fax
+               --with-DIR_HTML=/usr/share/doc/${PF}/html
+               --with-DIR_CGI="${WORKDIR}"
+               --with-PATH_DPSRIP=/var/spool/fax/bin/ps2fax
+               --with-PATH_IMPRIP=""
+               --with-SYSVINIT=no
+               --with-REGEX=yes
+               --with-LIBTIFF="-ltiff -ljpeg -lz"
+               --with-OPTIMIZER="${CFLAGS}"
+               --with-DSO=auto
+               --with-HTML=$(usex html)
+       )
+
+       if use mgetty; then
+               my_conf+=(
+                       --with-PATH_GETTY=/sbin/mgetty
+                       --with-PATH_EGETTY=/sbin/mgetty
+                       --with-PATH_VGETTY=/usr/sbin/vgetty
+               )
+       else
+               # GETTY defaults to /sbin/agetty
+               my_conf+=(
+                       --with-PATH_EGETTY=/bin/false
+                       --with-PATH_VGETTY=/bin/false
+               )
+       fi
+
+       # --enable-pam isn't valid
+       use pam || my_conf+=( $(use_enable pam) )
+       use lcms || my_conf+=( $(use_enable lcms) )
+       use ldap || my_conf+=( $(use_enable ldap) )
+       use jbig || my_conf+=( $(use_enable jbig) )
+
+       tc-export CC CXX AR RANLIB
+
+       edo ./configure --nointeractive "${my_conf[@]}"
+}
+
+src_compile() {
+       # Parallel building is borked, bug #????
+       emake -j1
+}
+
+src_install() {
+       dodir /usr/{bin,sbin} /usr/$(get_libdir)/fax /usr/share/man
+       dodir /var/spool /var/spool/fax
+       fowners uucp:uucp /var/spool/fax
+       fperms 0600 /var/spool/fax
+
+       dodir /usr/share/doc/${PF}/samples
+       emake DESTDIR="${D}" \
+               BIN="${D}/usr/bin" \
+               SBIN="${D}/usr/sbin" \
+               LIBDIR="${D}/usr/$(get_libdir)" \
+               LIB="${D}/usr/$(get_libdir)" \
+               LIBEXEC="${D}/usr/sbin" \
+               LIBDATA="${D}/usr/$(get_libdir)/fax" \
+               DIR_LOCALE="${D}/usr/share/locale" \
+               MAN="${D}/usr/share/man" \
+               SPOOL="${D}/var/spool/fax" \
+               HTMLDIR="${D}/usr/share/doc/${PF}/html" \
+               install
+
+       keepdir /var/spool/fax/{archive,client,etc,pollq,recvq,tmp}
+       keepdir /var/spool/fax/{status,sendq,log,info,doneq,docq,dev}
+
+       einfo "Adding env.d entry for ${PN}"
+       newenvd - 99hylafaxplus <<-EOF
+               PATH="/var/spool/fax/bin"
+               CONFIG_PROTECT="/var/spool/fax/etc /usr/$(get_libdir)/fax"
+               CONFIG_PROTECT_MASK="/var/spool/fax/etc/xferfaxlog"
+       EOF
+
+       newconfd "${FILESDIR}"/${PN}-conf ${PN}
+       newinitd "${FILESDIR}"/${PN}-init-r1 ${PN}
+
+       use pam && pamd_mimic_system ${MY_PN} auth account session
+
+       einstalldocs
+       docinto samples
+}

Reply via email to