Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 32253 - HylaFAX init-script is not usuable here is my version
Summary: HylaFAX init-script is not usuable here is my version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Steve Arnold
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-29 02:14 UTC by Patrick Daxboeck
Modified: 2003-10-31 21:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/init.d/hylafax (hylafax,3.45 KB, text/plain)
2003-10-29 02:17 UTC, Patrick Daxboeck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Daxboeck 2003-10-29 02:14:14 UTC
HylaFAX script /etc/init.d/hylafax ist not usuable for automatic startup, thus 
I created my own version which is modified from the original: 
 
#!/sbin/runscript 
 
depend() { 
        need net 
} 
 
checkconfig() { 
        SPOOL=/var/spool/fax 
        if [ ! -f $SPOOL/etc/setup.cache ] ; then 
                eerror "No $SPOOL/etc/setup.cache file exists! Use 
faxsetup(8C) !" 
        fi 
 
} 
 
start() { 
        ebegin "Starting HylaFAX Servers." 
        SPOOL=/var/spool/fax 
        checkconfig || return 1 
 
        . $SPOOL/etc/setup.cache 
 
        # Just in case these are not in setup.cache yet 
        if [ -z "$HFAXD_SERVER" ]; then 
                HFAXD_SERVER=yes 
        fi 
        if [ -z "$FAXQ_SERVER" ]; then 
                FAXQ_SERVER=yes 
        fi 
        if [ -z "$HFAXD_OLD_PROTOCOL" ]; then 
                HFAXD_OLD_PROTOCOL=no 
        fi 
        if [ -z "$HFAXD_SNPP_SERVER" ]; then 
                HFAXD_SNPP_SERVER=no 
        fi 
 
        IS_ON=/etc/chkconfig            # NB: chkconfig is IRIX- and 
Linux-specific 
        FAXQ=$SBIN/faxq 
        HFAXD=$LIBEXEC/hfaxd 
        FAXQUIT=$SBIN/faxquit 
        FAXPORT=hylafax                 # designated port for new protocol 
        SNPPPORT=444                    # official port for SNPP 
 
        if test ! -x $IS_ON ; then 
                IS_ON=true 
        fi 
 
        if $IS_ON verbose ; then 
                ECHO=echo 
        else            # For a quiet startup and shutdown 
                ECHO=: 
        fi 
# 
# Figure out which brand of echo we have and define prompt 
# and printf shell functions accordingly.  Note that we 
# assume that if the System V-style echo is not present, 
# then the BSD printf program is available.  These functions 
# are defined here so that they can be tailored on a per-site, 
# etc. basis. 
# 
        if [ `echo foo\\\c`@ = "foo@" ]; then 
# System V-style echo supports \r 
# and \c which is all that we need 
                printf() 
                { 
                        $ECHO "$*\\c" 
                } 
        elif [ "`echo -n foo`@" = "foo@" ]; then 
# BSD-style echo; use echo -n to get 
# a line without the trailing newline 
                printf() 
                { 
                        $ECHO -n "$*" 
                } 
        else 
# something else; do without 
                printf() 
                { 
                        $ECHO "$*" 
                } 
        fi 
 
# 
# 
# killall -SIGNAL process-name 
# 
# Emulate the necessary functionality of the 
# killall program 
# 
        killall() 
        { 
# NB: ps ax should give an error on System V, so we try it first! 
                pid="`ps ax 2>/dev/null | $AWK \"\ 
                /[\/ (]$2[ )]/  {print \\$1;} 
                /[\/ ]$2\$/     {print \\$1;}\"`" 
                test "$pid" || 
                pid="`ps -e 2>/dev/null | $AWK \"/ $2[ ]*\$/ {print \\$1;}\"`" 
                test "$pid" && kill $1 $pid; return 
        } 
 
        if $IS_ON fax && test -x $FAXQ; then 
                if test $FAXQ_SERVER = yes ; then 
                        killall -15 faxq 
                fi 
                if test $HFAXD_SERVER = yes ; then 
                        killall -15 hfaxd 
                fi 
                printf "HylaFAX:" 
                if test $FAXQ_SERVER = yes ; then 
                        $FAXQ; printf " faxq" 
                fi 
                if test $HFAXD_SERVER = yes ; then 
                        HFAXD_OPT="-i $FAXPORT" 
#                       HFAXD="$HFAXD -i $FAXPORT" 
                        HFAXMSG=" hfaxd" 
                        if [ $HFAXD_OLD_PROTOCOL = yes ]; then 
                                HFAXD_OPT="$HFAXD_OPT -o 4557" 
#                               HFAXD="$HFAXD -o 4557" 
                                HFAXMSG="$HFAXMSG (with old protocol" 
                        else 
                                HFAXMSG="$HFAXMSG (without old protocol" 
                        fi 
                        if [ $HFAXD_SNPP_SERVER = yes ]; then 
                                HFAXD_OPT="$HFAXD_OPT -s $SNPPPORT" 
#                               HFAXD="$HFAXD -s $SNPPPORT" 
                                HFAXMSG="$HFAXMSG & with SNPP support)" 
 
                                HFAXMSG="$HFAXMSG & without SNPP support)" 
                        fi 
#                       $HFAXD ; printf "$HFAXMSG" 
                        echo $HFAXMSG 
                        echo $HFAXD $HFAXD_OPT 
                        /sbin/start-stop-daemon --start --quiet --exec $HFAXD 
-- $HFAXD_OPT 
                fi 
                if test $FAXQ_SERVER != yes -a $HFAXD_SERVER != yes ; then 
                        printf " not started (script disabled by configure)" 
                fi 
                $ECHO "." 
        fi 
        eend $? 
 
} 
 
stop() { 
        ebegin "Stopping HylaFAX Servers." 
        checkconfig || return 2 
        . $SPOOL/etc/setup.cache 
        FAXQUIT=$SBIN/faxquit 
        HFAXD=$LIBEXEC/hfaxd 
 
#        $ECHO "Stopping HylaFAX Servers." 
        $FAXQUIT >/dev/null 2>&1 
        /sbin/start-stop-daemon --stop --quiet --exec $HFAXD 
        eend $? 
#        killall -15 hfaxd 
 
} 
 

Reproducible: Always
Steps to Reproduce:
1. Install HylaFAX 
2. rc-update add hylafax 
3. reboot and wait for the error message 
Actual Results:  
HylaFax was not active 

Expected Results:  
HylaFAX starting upon reboot 
(solution presented above) 

Again, here is my fix, a new init-script /etc/init.d/hylafax 
 
#!/sbin/runscript 
 
depend() { 
        need net 
} 
 
checkconfig() { 
        SPOOL=/var/spool/fax 
        if [ ! -f $SPOOL/etc/setup.cache ] ; then 
                eerror "No $SPOOL/etc/setup.cache file exists! Use 
faxsetup(8C) !" 
        fi 
 
} 
 
start() { 
        ebegin "Starting HylaFAX Servers." 
        SPOOL=/var/spool/fax 
        checkconfig || return 1 
 
        . $SPOOL/etc/setup.cache 
 
        # Just in case these are not in setup.cache yet 
        if [ -z "$HFAXD_SERVER" ]; then 
                HFAXD_SERVER=yes 
        fi 
        if [ -z "$FAXQ_SERVER" ]; then 
                FAXQ_SERVER=yes 
        fi 
        if [ -z "$HFAXD_OLD_PROTOCOL" ]; then 
                HFAXD_OLD_PROTOCOL=no 
        fi 
        if [ -z "$HFAXD_SNPP_SERVER" ]; then 
                HFAXD_SNPP_SERVER=no 
        fi 
 
        IS_ON=/etc/chkconfig            # NB: chkconfig is IRIX- and 
Linux-specific 
        FAXQ=$SBIN/faxq 
        HFAXD=$LIBEXEC/hfaxd 
        FAXQUIT=$SBIN/faxquit 
        FAXPORT=hylafax                 # designated port for new protocol 
        SNPPPORT=444                    # official port for SNPP 
 
        if test ! -x $IS_ON ; then 
                IS_ON=true 
        fi 
 
        if $IS_ON verbose ; then 
                ECHO=echo 
        else            # For a quiet startup and shutdown 
                ECHO=: 
        fi 
# 
# Figure out which brand of echo we have and define prompt 
# and printf shell functions accordingly.  Note that we 
# assume that if the System V-style echo is not present, 
# then the BSD printf program is available.  These functions 
# are defined here so that they can be tailored on a per-site, 
# etc. basis. 
# 
        if [ `echo foo\\\c`@ = "foo@" ]; then 
# System V-style echo supports \r 
# and \c which is all that we need 
                printf() 
                { 
                        $ECHO "$*\\c" 
                } 
        elif [ "`echo -n foo`@" = "foo@" ]; then 
# BSD-style echo; use echo -n to get 
# a line without the trailing newline 
                printf() 
                { 
                        $ECHO -n "$*" 
                } 
        else 
# something else; do without 
                printf() 
                { 
                        $ECHO "$*" 
                } 
        fi 
 
# 
# 
# killall -SIGNAL process-name 
# 
# Emulate the necessary functionality of the 
# killall program 
# 
        killall() 
        { 
# NB: ps ax should give an error on System V, so we try it first! 
                pid="`ps ax 2>/dev/null | $AWK \"\ 
                /[\/ (]$2[ )]/  {print \\$1;} 
                /[\/ ]$2\$/     {print \\$1;}\"`" 
                test "$pid" || 
                pid="`ps -e 2>/dev/null | $AWK \"/ $2[ ]*\$/ {print \\$1;}\"`" 
                test "$pid" && kill $1 $pid; return 
        } 
 
        if $IS_ON fax && test -x $FAXQ; then 
                if test $FAXQ_SERVER = yes ; then 
                        killall -15 faxq 
                fi 
                if test $HFAXD_SERVER = yes ; then 
                        killall -15 hfaxd 
                fi 
                printf "HylaFAX:" 
                if test $FAXQ_SERVER = yes ; then 
                        $FAXQ; printf " faxq" 
                fi 
                if test $HFAXD_SERVER = yes ; then 
                        HFAXD_OPT="-i $FAXPORT" 
#                       HFAXD="$HFAXD -i $FAXPORT" 
                        HFAXMSG=" hfaxd" 
                        if [ $HFAXD_OLD_PROTOCOL = yes ]; then 
                                HFAXD_OPT="$HFAXD_OPT -o 4557" 
#                               HFAXD="$HFAXD -o 4557" 
                                HFAXMSG="$HFAXMSG (with old protocol" 
                        else 
                                HFAXMSG="$HFAXMSG (without old protocol" 
                        fi 
                        if [ $HFAXD_SNPP_SERVER = yes ]; then 
                                HFAXD_OPT="$HFAXD_OPT -s $SNPPPORT" 
#                               HFAXD="$HFAXD -s $SNPPPORT" 
                                HFAXMSG="$HFAXMSG & with SNPP support)" 
 
                                HFAXMSG="$HFAXMSG & without SNPP support)" 
                        fi 
#                       $HFAXD ; printf "$HFAXMSG" 
                        echo $HFAXMSG 
                        echo $HFAXD $HFAXD_OPT 
                        /sbin/start-stop-daemon --start --quiet --exec $HFAXD 
-- $HFAXD_OPT 
                fi 
                if test $FAXQ_SERVER != yes -a $HFAXD_SERVER != yes ; then 
                        printf " not started (script disabled by configure)" 
                fi 
                $ECHO "." 
        fi 
        eend $? 
 
} 
 
stop() { 
        ebegin "Stopping HylaFAX Servers." 
        checkconfig || return 2 
        . $SPOOL/etc/setup.cache 
        FAXQUIT=$SBIN/faxquit 
        HFAXD=$LIBEXEC/hfaxd 
 
#        $ECHO "Stopping HylaFAX Servers." 
        $FAXQUIT >/dev/null 2>&1 
        /sbin/start-stop-daemon --stop --quiet --exec $HFAXD 
        eend $? 
#        killall -15 hfaxd 
 
}
Comment 1 Patrick Daxboeck 2003-10-29 02:17:50 UTC
Created attachment 19927 [details]
/etc/init.d/hylafax

This is a new HylaFAX init-script: /etc/init.d/hylafax for HylaFax to actually
work upon a reboot.
Comment 2 Steve Arnold archtester gentoo-dev 2003-10-30 01:32:38 UTC
Thanks, I'll take a look and test it.
Comment 3 Steve Arnold archtester gentoo-dev 2003-10-31 21:11:09 UTC
It looks like the current quasi-rh style init script is generated by the
Hylafax configure script.  I know the older 4.1.5 init script worked for
me, so I'm not sure what changed (or what broke) since then.  However, Patrick's
new one is much more Gentoo-like and (after fixing a missing else clause)
seems to work for me, so...

There's a 4.1.7 version with the new init script; it seemed significant enough
for an r2 bump (but it's ~x86 for now).  Please test and let me know if it
works for you.  Thanks.