HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
sysv-init-patch.sh
I was reviewing the patches and couldn't resist fixing and enhancing
Nico's sysv-init patch. I borrowed some ideas from Robert's beta.
I've added new config.site/config.local options
#
#DIR_SYSVINIT="/etc/init.d" # location of SysV-style init script
#DIR_SYSVINITSTART="../rc2.d" # location of SysV-style start script
#DIR_SYSVINITSTOP="../rc0.d" # location of SysV-style stop script
#NAME_SYSVINITSTART="S80fax" # name of SysV-style start script
#NAME_SYSVINITSTOP="K80fax" # name of SysV-style stop script
#FAXQ_SERVER=yes # init script starts faxq
#HFAXD_SERVER=yes # init script starts hfaxd
#HFAXD_OLD_PROTOCOL=no # don't start old protocol
#HFAXD_SNPP_SERVER=no # don't start paging protocol
The patch was made against an unpatched hylafax-v4.0pl2
--
Tim Rice Multitalents (707) 887-1469 (voice)
tim@trr.metro.net
#!/bin/sh
#
# sysv-init-patch.sh by Nico Kadel-Garcia 18-Nov-1998
# corrected/enhanced by Tim Rice 1-Jul-1999
#
# This is a shell script that configures the HylaFAX SysV-style bootup script
# for SunOS and other systems without the default init.d directory.
#
# New config.site/config.local options
#
#DIR_SYSVINIT="/etc/init.d" # location of SysV-style init script
#DIR_SYSVINITSTART="../rc2.d" # location of SysV-style start script
#DIR_SYSVINITSTOP="../rc0.d" # location of SysV-style stop script
#NAME_SYSVINITSTART="S80fax" # name of SysV-style start script
#NAME_SYSVINITSTOP="K80fax" # name of SysV-style stop script
#FAXQ_SERVER=yes # init script starts faxq
#HFAXD_SERVER=yes # init script starts hfaxd
#HFAXD_OLD_PROTOCOL=no # don't start old protocol
#HFAXD_SNPP_SERVER=no # don't start paging protocol
patch -p0 -V never < $0
exit 0
# Here is the actual patch
*** config.site.orig Sat Feb 14 02:46:31 1998
--- config.site Sun Jun 27 20:59:20 1999
***************
*** 47,52 ****
--- 47,61 ----
#HTML="no" # install HTML documentation (yes|no)
#PS="auto" # PostScript support to use (auto|gs|dps|imp)
#SYSVINIT="auto" # install SysV-style init support (auto|yes|no)
+ #DIR_SYSVINIT="/etc/init.d" # location of SysV-style init script
+ #DIR_SYSVINITSTART="../rc2.d" # location of SysV-style start script
+ #DIR_SYSVINITSTOP="../rc0.d" # location of SysV-style stop script
+ #NAME_SYSVINITSTART="S80fax" # name of SysV-style start script
+ #NAME_SYSVINITSTOP="K80fax" # name of SysV-style stop script
+ #FAXQ_SERVER=yes # init script starts faxq
+ #HFAXD_SERVER=yes # init script starts hfaxd
+ #HFAXD_OLD_PROTOCOL=no # don't start old protocol
+ #HFAXD_SNPP_SERVER=no # don't start paging protocol
#SGI2FAX="auto" # configure SGI image support (auto|yes|no)
#DPS="no" # install SGI DPS-based RIP (yes|no)
#GS="no" # install Ghostscript RIP (yes|no)
*** configure.orig Sat Feb 14 02:46:28 1998
--- configure Thu Jul 1 10:50:48 1999
***************
*** 60,65 ****
--- 60,69 ----
HTML=no
PS=auto
SYSVINIT=auto
+ FAXQ_SERVER=yes # init script starts faxq
+ HFAXD_SERVER=yes # init script starts hfaxd
+ HFAXD_OLD_PROTOCOL=no # don't start old protocol
+ HFAXD_SNPP_SERVER=no # don't start paging protocol
SGI2FAX=auto
PORT=auto
LIBMALLOC=auto
***************
*** 150,159 ****
--- 154,167 ----
ECHO
FAXGID
FAXUID
+ FAXQ_SERVER
FILLORDER
GETTY
GREP
GSRIP PATH_GSRIP
+ HFAXD_SERVER
+ HFAXD_OLD_PROTOCOL
+ HFAXD_SNPP_SERVER
HTML
HTMLDIR DIR_HTML
HTMLPATH
***************
*** 209,214 ****
--- 217,227 ----
SYSGID
SYSUID
SYSVINIT
+ SYSVINITDIR DIR_SYSVINIT
+ SYSVINITSTARTDIR DIR_SYSVINITSTART
+ SYSVINITSTARTNAME NAME_SYSVINITSTART
+ SYSVINITSTOPDIR DIR_SYSVINITSTOP
+ SYSVINITSTOPNAME NAME_SYSVINITSTOP
TIFFBIN
UTMP
UUCP_LOCKDIR DIR_LOCKS
***************
*** 3219,3226 ****
esac
fi
if [ "$SYSVINIT" = auto ]; then
! if test -d /etc/rc0.d -a -d /etc/rc2.d -a -d /etc/init.d; then
SYSVINIT=yes
Note "Looks like a SysV-style init is used, enabling installation of startup code."
else
--- 3232,3256 ----
esac
fi
+ # Location SysV style init scripts
+ if [ -z "$DIR_SYSVINIT" ]; then
+ DIR_SYSVINITS="
+ /etc/rc.d/init.d
+ /etc/init.d
+ "
+ case $TARGET in
+ *-sunos*) DIR_SYSVINITS="$DIR_SYSVINITS $DIR_SBIN";;
+ *-hpux*) DIR_SYSVINITS="/sbin/init.d $DIR_SYSVINITS";;
+ *) ;;
+ esac
+ DIR_SYSVINIT=
+ for i in $DIR_SYSVINITS; do
+ test -d $i && { DIR_SYSVINIT=$i; break; }
+ done
+ fi
+
if [ "$SYSVINIT" = auto ]; then
! if test -d $DIR_SYSVINIT; then
SYSVINIT=yes
Note "Looks like a SysV-style init is used, enabling installation of startup code."
else
***************
*** 3228,3233 ****
--- 3258,3306 ----
fi
fi
+ if [ "$SYSVINIT" = yes ]; then
+ Note "Looks like SysV init scripts go in $DIR_SYSVINIT."
+ fi
+
+ if [ "$SYSVINIT" = yes ]; then
+ if [ -z "$DIR_SYSVINITSTART" ]; then
+ case $TARGET in
+ *-linux*) DIR_SYSVINITSTART="
+ ../rc2.d
+ ../rc3.d
+ ../rc4.d
+ ../rc5.d
+ ";;
+ *) DIR_SYSVINITSTART="../rc2.d";;
+ esac
+ fi
+ if [ -z "$DIR_SYSVINITSTOP" ]; then
+ case $TARGET in
+ *-linux*) DIR_SYSVINITSTOP="
+ ../rc0.d
+ ../rc1.d
+ ../rc2.d
+ ../rc6.d
+ ";;
+ *) DIR_SYSVINITSTOP="../rc0.d";;
+ esac
+ fi
+ if [ -z "$NAME_SYSVINITSTART" ]; then
+ case $TARGET in
+ *-hpux*) NAME_SYSVINITSTART="S905hylafax" ;;
+ *-linux*) NAME_SYSVINITSTART="S97fax" ;;
+ *) NAME_SYSVINITSTART="S80fax" ;;
+ esac
+ fi
+ if [ -z "$NAME_SYSVINITSTOP" ]; then
+ case $TARGET in
+ *-hpux*) NAME_SYSVINITSTOP="K095hylafax" ;;
+ *-linux*) NAME_SYSVINITSTOP="K05fax" ;;
+ *) NAME_SYSVINITSTOP="K80fax" ;;
+ esac
+ fi
+ fi
+
Note "Done selecting programs."
#
***************
*** 3864,3874 ****
param=`grep "$pat" $1 | sed -e 's/ .*//;q'`
}
! printConfig()
{
cat<<EOF
! HylaFAX configuration parameters are:
[ 1] Directory for applications: $DIR_BIN
[ 2] Directory for lib data files: $DIR_LIBDATA
--- 3937,3947 ----
param=`grep "$pat" $1 | sed -e 's/ .*//;q'`
}
! printConfig1()
{
cat<<EOF
! HylaFAX configuration parameters (part 1 of 2) are:
[ 1] Directory for applications: $DIR_BIN
[ 2] Directory for lib data files: $DIR_LIBDATA
***************
*** 3885,3895 ****
[13] Manual page installation scheme: $MANSCHEME
[14] Default page size: $PAGESIZE
[15] Default vertical res (lpi): $DEFVRES
[16] Location of getty program: $PATH_GETTY
[17] Location of voice getty program: $PATH_VGETTY
[18] Location of sendmail program: $PATH_SENDMAIL
[19] Location of TIFF tools: $TIFFBIN
!
EOF
}
--- 3958,3985 ----
[13] Manual page installation scheme: $MANSCHEME
[14] Default page size: $PAGESIZE
[15] Default vertical res (lpi): $DEFVRES
+ EOF
+ }
+
+ printConfig2()
+ {
+ cat<<EOF
+
+ HylaFAX configuration parameters (part 2 of 2) are:
+
[16] Location of getty program: $PATH_GETTY
[17] Location of voice getty program: $PATH_VGETTY
[18] Location of sendmail program: $PATH_SENDMAIL
[19] Location of TIFF tools: $TIFFBIN
! [20] Location of SysV init scripts: $DIR_SYSVINIT
! [21] Location of SysV start scripts: $DIR_SYSVINITSTART
! [22] Location of SysV stop scripts: $DIR_SYSVINITSTOP
! [23] Name of SysV start script: $NAME_SYSVINITSTART
! [24] Name of SysV stop script: $NAME_SYSVINITSTOP
! [25] Init script starts faxq: $FAXQ_SERVER
! [26] Init script starts hfaxd $HFAXD_SERVER
! [27] Start old protocol: $HFAXD_OLD_PROTOCOL
! [28] Start paging protocol: $HFAXD_SNPP_SERVER
EOF
}
***************
*** 3947,3952 ****
--- 4037,4070 ----
;;
19) promptForNonNullStringParameter "$TIFFBIN" \
"Location of TIFF tools"; TIFFBIN="$param"
+ ;;
+ 20) promptForNonNullStringParameter "$DIR_SYSVINIT" \
+ "Location of SysV init scripts"; DIR_SYSVINIT="$param"
+ ;;
+ 21) promptForNonNullStringParameter "$DIR_SYSVINITSTART" \
+ "Location of SysV start scripts"; DIR_SYSVINITSTART="$param"
+ ;;
+ 22) promptForNonNullStringParameter "$DIR_SYSVINITSTOP" \
+ "Location of SysV stop scripts"; DIR_SYSVINITSTOP="$param"
+ ;;
+ 23) promptForNonNullStringParameter "$NAME_SYSVINITSTART" \
+ "Name of SysV start script"; NAME_SYSVINITSTART="$param"
+ ;;
+ 24) promptForNonNullStringParameter "$NAME_SYSVINITSTOP" \
+ "Name of SysV stop script"; NAME_SYSVINITSTOP="$param"
+ ;;
+ 25) promptForNonNullStringParameter "$FAXQ_SERVER" \
+ "Init script starts faxq"; FAXQ_SERVER="$param"
+ ;;
+ 26) promptForNonNullStringParameter "$HFAXD_SERVER" \
+ "Init script starts hfaxd"; HFAXD_SERVER="$param"
+ ;;
+ 27) promptForNonNullStringParameter "$HFAXD_OLD_PROTOCOL" \
+ "Start old protocol"; HFAXD_OLD_PROTOCOL="$param"
+ ;;
+ 28) promptForNonNullStringParameter "$HFAXD_SNPP_SERVER" \
+ "Start paging protocol"; HFAXD_SNPP_SERVER="$param"
+ ;;
esac
}
***************
*** 3959,3975 ****
ok=skip
while [ "$ok" != y ] && [ "$ok" != yes ]; do
if [ "$ok" != skip ]; then
! for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do
promptForParameter $i;
done
fi
! printConfig
checkForExecutable $PATH_SENDMAIL
checkForExecutable $PATH_GETTY
prompt "Are these ok [yes]?"; read ok
test -z "$ok" && ok=yes
case "$ok" in
! [1-9]|1[0-9]) promptForParameter $ok;;
[yY]*|[nN]*) continue;;
?*)
echo ""
--- 4077,4118 ----
ok=skip
while [ "$ok" != y ] && [ "$ok" != yes ]; do
if [ "$ok" != skip ]; then
! for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
promptForParameter $i;
done
fi
! printConfig1
! prompt "Are these ok [yes]?"; read ok
! test -z "$ok" && ok=yes
! case "$ok" in
! [1-9]|1[0-5]) promptForParameter $ok;;
! [yY]*|[nN]*) continue;;
! ?*)
! echo ""
! echo "\"y\", \"yes\", or <RETURN> accepts the displayed parameters."
! echo "A number lets you change the numbered parameter."
! echo ""
! ;;
! esac
! ok=skip
! done
! fi
!
! if [ $QUIET = no ]; then
! ok=skip
! while [ "$ok" != y ] && [ "$ok" != yes ]; do
! if [ "$ok" != skip ]; then
! for i in 16 17 18 19 20 21 22 23 24 25 26 27 28; do
! promptForParameter $i;
! done
! fi
! printConfig2
checkForExecutable $PATH_SENDMAIL
checkForExecutable $PATH_GETTY
prompt "Are these ok [yes]?"; read ok
test -z "$ok" && ok=yes
case "$ok" in
! 1[6-9]|2[0-8]) promptForParameter $ok;;
[yY]*|[nN]*) continue;;
?*)
echo ""
*** etc/Makefile.in.orig Sat Feb 14 02:46:58 1998
--- etc/Makefile.in Tue Jun 22 18:11:01 1999
***************
*** 41,46 ****
--- 41,51 ----
SRCDIR = ${DEPTH}/${TOPSRCDIR}/etc
VPATH = ../@SRCDIR@/etc
+ DIR_SYSVINIT = @SYSVINITDIR@
+ DIR_SYSVINITSTART = @SYSVINITSTARTDIR@
+ DIR_SYSVINITSTOP = @SYSVINITSTOPDIR@
+ NAME_SYSVINITSTART = @SYSVINITSTARTNAME@
+ NAME_SYSVINITSTOP = @SYSVINITSTOPNAME@
DIALRULES=dialrules \
dialrules.sf-ba \
***************
*** 92,100 ****
# System V-specific init support.
#
installSysVInit: hylafax
! ${PUTSERVER} -F /etc/init.d -m 755 -O hylafax
! ${PUTSERVER} -F /etc/rc2.d -lns /etc/init.d/hylafax S80fax
! ${PUTSERVER} -F /etc/rc0.d -lns /etc/init.d/hylafax K80fax
if test -d /etc/config; then \
${PUTSERVER} -F /etc/config -m 644 -src config.fax -O fax; \
fi
--- 97,118 ----
# System V-specific init support.
#
installSysVInit: hylafax
! ${PUTSERVER} -F ${DIR_SYSVINIT} -m 755 -O hylafax
! echo checking ${DIR_SYSVINITSTART} directories
! test -n "${DIR_SYSVINITSTART}"; then \
! for i in ${DIR_SYSVINITSTART}; do \
! if test -d ${DIR_SYSVINIT}/$$i; then \
! ${PUTSERVER} -F ${DIR_SYSVINIT}/$$i -lns ../`basename ${DIR_SYSVINIT}`/hylafax ${NAME_SYSVINITSTART}; \
! fi; \
! done
! fi
! test -n "${DIR_SYSVINITSTOP}"; then \
! for i in ${DIR_SYSVINITSTOP}; do \
! if test -d ${DIR_SYSVINIT}/$$i; then \
! ${PUTSERVER} -F ${DIR_SYSVINIT}/$$i -lns ../`basename ${DIR_SYSVINIT}`/hylafax ${NAME_SYSVINITSTOP}; \
! fi; \
! done
! fi
if test -d /etc/config; then \
${PUTSERVER} -F /etc/config -m 644 -src config.fax -O fax; \
fi
*** etc/faxsetup.sh.in.orig Sat Feb 14 02:47:05 1998
--- etc/faxsetup.sh.in Thu Jul 1 20:33:17 1999
***************
*** 104,109 ****
--- 104,118 ----
POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions
#
+ # Location of sysv init script
+ #
+ DIR_SYSVINIT=@SYSVINITDIR@
+ FAXQ_SERVER=@FAXQ_SERVER@
+ HFAXD_SERVER=@HFAXD_SERVER@
+ HFAXD_OLD_PROTOCOL=@HFAXD_OLD_PROTOCOL@
+ HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@
+
+ #
# These are the configuration parameters written to the
# setup.cache file and read in by all the HylaFAX scripts.
#
***************
*** 121,128 ****
--- 130,141 ----
CP
DPSRIP PATH_DPSRIP
ECHO
+ FAXQ_SERVER
GREP
GSRIP PATH_GSRIP
+ HFAXD_SERVER
+ HFAXD_OLD_PROTOCOL
+ HFAXD_SNPP_SERVER
IMPRIP PATH_IMPRIP
LIBDATA DIR_LIBDATA
LIBEXEC DIR_LIBEXEC
***************
*** 1648,1654 ****
#
if onServer; then
signalINETD=no
! if [ -f /etc/init.d/hylafax ]; then
true # started by init at boot time
elif [ -f $INETDCONF ]; then
E="hylafax stream tcp nowait $FAX $DIR_LIBEXEC/hfaxd hfaxd -I"
--- 1661,1667 ----
#
if onServer; then
signalINETD=no
! if [ -f ${DIR_SYSVINIT}/hylafax ]; then
true # started by init at boot time
elif [ -f $INETDCONF ]; then
E="hylafax stream tcp nowait $FAX $DIR_LIBEXEC/hfaxd hfaxd -I"
***************
*** 2136,2144 ****
prompt "Should I restart the HylaFAX server processes [yes]?"; read x
if isOK "$x"; then
echo ""
! if [ -x /etc/init.d/hylafax ]; then
! echo /etc/init.d/hylafax start
! /etc/init.d/hylafax start
else
echo $DIR_SBIN/faxq; $DIR_SBIN/faxq
fi
--- 2149,2157 ----
prompt "Should I restart the HylaFAX server processes [yes]?"; read x
if isOK "$x"; then
echo ""
! if [ -x ${DIR_SYSVINIT}/hylafax ]; then
! echo ${DIR_SYSVINIT}/hylafax start
! ${DIR_SYSVINIT}/hylafax start
else
echo $DIR_SBIN/faxq; $DIR_SBIN/faxq
fi
*** etc/hylafax.in.orig Sat Feb 14 02:47:01 1998
--- etc/hylafax.in Thu Jul 1 20:44:52 1999
***************
*** 56,62 ****
}
. $SPOOL/etc/setup.cache
! IS_ON=/etc/chkconfig # NB: chkconfig is IRIX-specific
FAXQ=$SBIN/faxq
HFAXD=$LIBEXEC/hfaxd
FAXQUIT=$SBIN/faxquit
--- 56,75 ----
}
. $SPOOL/etc/setup.cache
! if [ -z $HFAXD_SERVER ]; then
! HFAXD_SERVER=@HFAXD_SERVER@
! fi
! if [ -z $FAXQ_SERVER ]; then
! FAXQ_SERVER=@FAXQ_SERVER@
! fi
! if [ -z $HFAXD_OLD_PROTOCOL ]; then
! HFAXD_OLD_PROTOCOL=@HFAXD_OLD_PROTOCOL@
! fi
! if [ -z $HFAXD_SNPP_SERVER ]; then
! HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@
! fi
!
! IS_ON=/etc/chkconfig # NB: chkconfig is IRIX- and Linux-specific
FAXQ=$SBIN/faxq
HFAXD=$LIBEXEC/hfaxd
FAXQUIT=$SBIN/faxquit
***************
*** 104,112 ****
killall -15 faxq
killall -15 hfaxd
$ECHO "HylaFAX:\c"
! $FAXQ; $ECHO " faxq\c"
! $HFAXD -i $FAXPORT -o 4557 -s $SNPPPORT
! $ECHO " hfaxd (w/ compatibility & SNPP)\c"
$ECHO "."
fi
;;
--- 117,142 ----
killall -15 faxq
killall -15 hfaxd
$ECHO "HylaFAX:\c"
! if test $FAXQ_SERVER = yes ; then
! $FAXQ; $ECHO " faxq\c"
! fi
! if test $HFAXD_SERVER = yes ; then
! HFAXD="$HFAXD -i $FAXPORT"
! HFAXMSG=" hfaxd"
! if [ $HFAXD_OLD_PROTOCOL = yes ]; then
! HFAXD="$HFAXD -o 4557"
! HFAXMSG="$HFAXMSG (with old protocol"
! else
! HFAXMSG="$HFAXMSG (without old protocol"
! fi
! if [ $HFAXD_SNPP_SERVER = yes ]; then
! HFAXD="$HFAXD -s $SNPPPORT"
! HFAXMSG="$HFAXMSG & with SNPP support)\c"
! else
! HFAXMSG="$HFAXMSG & without SNPP support)\c"
! fi
! $HFAXD ; $ECHO "$HFAXMSG"
! fi
$ECHO "."
fi
;;
***************
*** 115,121 ****
$FAXQUIT >/dev/null 2>&1
killall -15 hfaxd
;;
*)
! echo "usage: /etc/init.d/hylafax {start|stop}"
;;
esac
--- 145,157 ----
$FAXQUIT >/dev/null 2>&1
killall -15 hfaxd
;;
+ 'start_msg')
+ $ECHO "Starting HylaFAX Servers."
+ ;;
+ 'stop_msg')
+ $ECHO "Stopping HylaFAX Servers."
+ ;;
*)
! $ECHO "usage: hylafax {start|stop|start_msg|stop_msg}"
;;
esac
*** pkg/sproto.stub.in.orig Sat Feb 14 02:50:31 1998
--- pkg/sproto.stub.in Fri Jun 25 20:28:11 1999
***************
*** 1,10 ****
d none /etc ? ? ?
! d none /etc/init.d ? ? ?
! f none /etc/init.d/hylafax=../etc/hylafax 0755 @SYSUID@ @SYSGID@
! d none /etc/rc0.d ? ? ?
! s none /etc/rc0.d/K80fax=/etc/init.d/hylafax
! d none /etc/rc2.d ? ? ?
! s none /etc/rc2.d/S80fax=/etc/init.d/hylafax
d none /etc/config ? ? ?
f none /etc/config/fax=../etc/config.fax 0644 @SYSUID@ @SYSGID@
d none @BIN@ ? ? ?
--- 1,10 ----
d none /etc ? ? ?
! d none @SYSVINITDIR@ ? ? ?
! f none @SYSVINITDIR@/hylafax=../etc/hylafax 0755 @SYSUID@ @SYSGID@
! d none @SYSVINITDIR@/@SYSVINITSTOPDIR@ ? ? ?
! s none @SYSVINITDIR@/@SYSVINITSTOPDIR@/@SYSVINITSTOPNAME@=@SYSVINITDIR@/hylafax
! d none @SYSVINITDIR@/@SYSVINITSTARTDIR@ ? ? ?
! s none @SYSVINITDIR@/@SYSVINITSTARTDIR@/@SYSVINITSTARTNAME@=@SYSVINITDIR@/hylafax
d none /etc/config ? ? ?
f none /etc/config/fax=../etc/config.fax 0644 @SYSUID@ @SYSGID@
d none @BIN@ ? ? ?