summarylogtreecommitdiffstats
path: root/hylafax.install
diff options
context:
space:
mode:
Diffstat (limited to 'hylafax.install')
-rw-r--r--hylafax.install101
1 files changed, 69 insertions, 32 deletions
diff --git a/hylafax.install b/hylafax.install
index 695c97bb1604..d37b448035a8 100644
--- a/hylafax.install
+++ b/hylafax.install
@@ -1,87 +1,124 @@
+_hyhome='/var/spool/hylafax'
+_hyfax='/usr/lib/fax'
+#_hyuser='fax'
+_hyuser='uucp'
+_hygroup='uucp'
+
_print_install() {
- printf "\n"
- echo "Run faxsetup to configure and be sure to set..."
- echo " The device to configure is usually ttyS0, ttyUSB0, or ttyACM0"
- echo " The number of pages to accept to more than 25"
- echo " The country code and area code"
- echo " The faxclass to 2.0"
- echo " Most other defaults are OK"
- printf "\n"
+ echo -e '\n'
+ echo 'Run faxsetup to configure and be sure to set...'
+ echo ' The device to configure is usually ttyS0, ttyUSB0, or ttyACM0'
+ echo ' The number of pages to accept to more than 25'
+ echo ' The country code and area code'
+ echo ' The Fax Class to 2.0'
+ echo ' Most other defaults are OK'
+ echo -e '\n'
}
_print_remove() {
- printf "\n\n"
- echo "You may manually remove /var/spool/hylafax and /usr/lib/fax if you do not need anything."
- echo "You may also remove any aliases added to /etc/mail/aliases."
- printf "\n"
+ echo -e '\n\n'
+ echo "You may manually remove ${_hyhome} and ${_hyfax} if you do not need anything."
+ echo 'You may also remove any aliases added to /etc/mail/aliases.'
+ echo -e '\n'
}
post_install() {
- groupadd -g 14 'uucp' &>/dev/null
- useradd -u 10 -g 'uucp' -d '/' -s '/bin/false' 'uucp' &>/dev/null
+ set -u
+ #groupadd -g 14 "${_hygroup}" &>/dev/null
+ useradd -u 10 -g "${_hygroup}" -d "${_hyhome}" -s '/bin/false' "${_hyuser}" &>/dev/null
#useradd -u 69 -g 'daemon' -d '/' -s '/bin/false' 'fax' &>/dev/null
post_upgrade
- usermod -d '/' 'uucp' &>/dev/null
- #usermod -d '/' 'fax' &>/dev/null
+ #usermod -d '/' "${_hyuser}" &>/dev/null
_print_install
mandb -q
+ set +u
}
# define _clean_or_copy_doit() to tell this what to do
_clean_or_copy() {
for _outfile in 'archive' 'faxrcvd' 'notify' 'pollrcvd'; do
- _clean_or_copy_doit "/var/spool/hylafax/bin/${_outfile}.hylafaxplus.default" "/var/spool/hylafax/bin/${_outfile}"
+ _clean_or_copy_doit "${_hyhome}/bin/${_outfile}.hylafaxplus.default" "${_hyhome}/bin/${_outfile}"
done
- for _outfile in /var/spool/hylafax/etc/*.default; do
- _clean_or_copy_doit "${_outfile}" "`expr "${_outfile}" : '^\(.\+\).default$'`"
+ for _outfile in ${_hyhome}/etc/*.default; do
+ _clean_or_copy_doit "${_outfile}" "$(expr "${_outfile}" : '^\(.\+\).default$')"
done
}
post_upgrade() {
- # Only some of the files and folders are chown uucp
- chown 'uucp' '/var/spool/hylafax'/{,archive,bin,client,config,dev,docq,doneq,etc}
- chown 'uucp' '/var/spool/hylafax'/{FIFO,info,log,pollq,recvq,sendq,status,tmp}
+ set -u
+ # Only some of the files and folders are chown
+ chown "${_hyuser}:${_hygroup}" "${_hyhome}"/{,archive,bin,client,config,dev,docq,doneq,etc}
+ chown "${_hyuser}:${_hygroup}" "${_hyhome}"/{info,log,pollq,recvq,sendq,status,tmp}
+ chown "${_hyuser}:${_hygroup}" "${_hyhome}/FIFO" "${_hyhome}"/FIFO.* 2> /dev/null
+ # Don't overwrite existing configuration files.
_clean_or_copy_doit() {
cp -np "$1" "$2"
chmod 'u+w' "$2"
}
_clean_or_copy
- cp -n /dev/null "/var/spool/hylafax/etc/xferfaxlog" # This doesn't modify the timestamp of an existing file
- chown 'uucp:uucp' '/var/spool/hylafax/etc/'{hosts.hfaxd,lutRS18.pcf,xferfaxlog}
- #chown -R uucp /var/spool/hylafax/etc/templates
+ cp -n /dev/null "${_hyhome}/etc/xferfaxlog" # This doesn't modify the timestamp of an existing file
+ chown "${_hyuser}:${_hygroup}" "${_hyhome}/etc"/{hosts.hfaxd,lutRS18.pcf,xferfaxlog}
+ # chown -R "${_hyuser}:${_hygroup}"\ "${_hyhome}/etc/templates"
systemctl daemon-reload
systemctl enable 'hylafax.timer'
systemctl start 'hylafax.timer'
- if [ ! -z "`command -v 'avantfaxsetup.sh'`" ]; then
- avantfaxsetup.sh 2 'install'
+ # Now done by pacman hook
+ #if [ ! -z "$(command -v 'avantfaxsetup.sh')" ]; then
+ # avantfaxsetup.sh 2 'install'
+ #fi
+ set +u
+}
+
+_pre_upgrade_fix_faxcover() {
+ # Two fax covers in different places causes problems. Since I didn't notice this before I can't trash the covers
+ if [ ! -L "${_hyfax}/faxcover.ps" ]; then
+ if [ "$(md5sum < "${_hyfax}/faxcover.ps" | cut -d' ' -f1)" != '756ff1ce327f89d5651cdb99f02efc25' ]; then
+ if [ "$(md5sum < "${_hyhome}/etc/cover.templ")" = "$(md5sum < "${_hyhome}/etc/cover.templ.default")" ]; then
+ mv "${_hyfax}/faxcover.ps" "${_hyhome}/etc/cover.templ"
+ else
+ mv "${_hyfax}/faxcover.ps"{,.pacsave}
+ echo "Modified faxcover.ps has been saved as ${_hyfax}/faxcover.ps.pacsave"
+ fi
+ fi
fi
}
pre_upgrade() {
+ set -u
+ _pre_upgrade_fix_faxcover
_clean_or_copy_doit() {
- if [ "`md5sum < "$1"`" = "`md5sum < "$2"`" ]; then
+ # Delete unmodified files
+ if [ "$(md5sum < "$1")" = "$(md5sum < "$2")" ]; then
rm -f "$2"
fi
}
_clean_or_copy
+ set +u
}
pre_remove() {
+ set -u
pre_upgrade
- userdel 'uucp' &>/dev/null
- ##groupdel 'uucp' &>/dev/null
- #userdel 'fax' &>/dev/null
+ userdel "${_hyuser}" &>/dev/null
+ ##groupdel "${_hygroup}" &>/dev/null
# we could put this into pre_upgrade() but I'd rather let the admin restart when convenient.
systemctl stop 'hfaxd.service'
+ systemctl disable 'hfaxd.service'
systemctl stop 'faxq.service'
+ systemctl disable 'faxq.service'
systemctl stop 'faxgetty@*.service'
+ rm -f '/etc/systemd/system/multi-user.target.wants'/faxgetty@*.service # systemctl disable doesn't accept wildcards/PATTERN
systemctl stop 'hylafax.timer'
- #rm -f '/var/spool/hylafax/bin/'{pdf2fax,ps2fax} '/var/spool/hylafax/dev/null'
+ systemctl disable 'hylafax.timer'
+ #rm -f "${_hyhome}/bin"/{pdf2fax,ps2fax} "${_hyhome}/dev/null"
_print_remove
+ set +u
}
post_remove() {
+ set -u
systemctl daemon-reload
mandb -q
+ set +u
}