Debian Avantfax install script improvement WORK IN PROGRESS!!!!!
Avantfax works really well on Debian but it is not officially supported by Avantfax so the install script is lacking, i would like to improve that and any feedback would be appreciated.
The first time i installed Avantfax on Debian Etch there was only an install script for Red Hat and SuSe so everything needed to be done manually, i made some notes at the time here http://www.songshu.org/index.php/avantfax-on-debian
Since AvantFAX 3.1.0 there is a debian install script available that comes a long way but is not yet perfect and it requires some extra manual steps and tinkering, also an install script to set up mail2fax is missing for Debian.
This is an attempt to improve the following Debian scripts that can be found in AvantFAX 3.1.6
debian install script
This script comes a long way accept that the apache virtual host is not set up correctly. and the specified directory /etc/apache2/logs does not exist so apache will refuse to start.
The following section needs improvement.
cat >> /etc/apache2/sites-enabled/000-default << EOF
<VirtualHost *:80>
DocumentRoot $INSTDIR
ServerName avantfax
ErrorLog logs/avantfax-error_log
CustomLog logs/avantfax-access_log common
</VirtualHost>
EOF
What we see here is that the virtualhost is added below in the 000-default file, this does not work since the default will not be changed and a new virtual host is not added.
Also we could move the avantfax logs to the debian default log section /var/logs/
The suggestion is to have it add a separate new virtual host for the chosen domain name as specified in the debian-prefs.txt.
cat >> /etc/apache2/sites-available/$FAXDOMAIN << EOF
<VirtualHost *:80>
DocumentRoot $INSTDIR
ServerName $FAXDOMAIN
ErrorLog /var/log/avantfax-error_log
CustomLog /var/log/avantfax-access_log common
</VirtualHost>
EOF
After the new virtual host file is added to the sites-available we can add the following to have it added to the apache sites-enabled section.
a2ensite $FAXDOMAIN /etc/init.d/apache2 reload a2dissite 000-default /etc/init.d/apache2 reload
debian-prefs
email2fax
setup-postfix
This script is completely non-debian so i suggest to make ad a new debian-setup-postfix.sh script
The following section can be removed
# INSTALL REQUIRED APPS IF NOT ALREADY INSTALLED echo “Installing required packages” yast –install postfix
It mentions yast and that should be replaced with apt-get but AvantFax depends on a functioning hylafax and the installation of hylafax in its turn depends on an installed MTA so it will default to install exim4 if no other MTA is present, using this scripts means you want to use postfix as MTA so this should already be installed before Hylafax.
The following section is ment to stop postfix and alter the master.cf file
# CONFIGURE POSTFIX
/sbin/service postfix stop
echo “Configuring Email to FAX for domain ${FAXDOMAIN}”
cat >> /etc/postfix/master.cf << EOF
fax unix - n n - 1 pipe
flags= user=$FAXMAILUSER argv=/usr/bin/faxmail -d -n -NT ${user}
EOF
Debian uses init so this section should read as follows
# CONFIGURE POSTFIX
/etc/init.d/postfix stop
echo “Configuring Email to FAX for domain ${FAXDOMAIN}”
cat >> /etc/postfix/master.cf << EOF
fax unix - n n - 1 pipe
flags= user=$FAXMAILUSER argv=/usr/bin/faxmail -d -n -NT ${user}
EOF
Faxmail will start complaining it can not locate the fonts so we need to specify the ghostscript font directory to Hylafax
cat >> /etc/hylafax/hyla.conf << EOF FontMap: /usr/share/ghostscript/8.62/lib/ EOF
The following section at the end of this script will start postfix after having it stopped at the beginning of the configuration, again we use init.
/sbin/chkconfig postfix on /sbin/service postfix start
so we replace this with
/etc/init.d/postfix start