summaryrefslogtreecommitdiff
blob: e79d7b444a12650d0a23e76ed0b06aa261a785aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6
inherit autotools eutils versionator

FAX_SPOOL_DIR="${ROOT}/var/spool/fax"

MY_PV1="$(get_version_component_range 1-4)"
MY_PV2="$(get_version_component_range 5)"
MY_PV3="$(get_version_component_range 6)"
MY_P="${PN}_${MY_PV1}.svn.${MY_PV2}"

DESCRIPTION="capi4hylafax adds a faxcapi modem to the hylafax enviroment"
SRC_URI="mirror://debian/pool/main/c/capi4hylafax/${MY_P}.orig.tar.gz
	mirror://debian/pool/main/c/capi4hylafax/${MY_P}-${MY_PV3}.debian.tar.gz"
HOMEPAGE="http://packages.qa.debian.org/c/capi4hylafax.html"

S="${WORKDIR}/${PN}-svn"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="amd64 x86"

DEPEND="
	app-shells/bash:0
	media-libs/tiff:0
	net-libs/libcapi
	sys-libs/zlib
	virtual/jpeg:0
"
RDEPEND="
	${DEPEND}
	dev-util/dialog
"

DOCS=( AUTHORS ChangeLog Readme_src )
HTML_DOCS=( README.html LIESMICH.html )

src_prepare() {
	EPATCH_SOURCE="${WORKDIR}/debian/patches" EPATCH_SUFFIX="patch" \
		EPATCH_FORCE="yes" epatch

	eapply_user

	eautoreconf

	mv ../debian . || die

	# fix location of fax spool
	sed -e "s:/var/spool/hylafax:${FAX_SPOOL_DIR}:g" \
		-i config.faxCAPI \
		-i Readme_src \
		-i src/defaults.h.in \
		-i debian/*.1 || die

	# fix location of fax config
	sed -i -e "s:/etc/hylafax:${FAX_SPOOL_DIR}/etc:g" setupconffile || die

	# fix name and location of logfile
	sed -e "s:/var/spool/fax/log/capi4hylafax:/var/log/${PN}.log:" \
		-i config.faxCAPI || die

	sed -e "s:/tmp/capifax.log:/var/log/${PN}.log:" \
		-i src/defaults.h.in config.faxCAPI || die

	# patch man pages
	sed -e "s:/usr/share/doc/capi4hylafax/:/usr/share/doc/${PF}/html/:g" \
		-e "s:c2send:c2faxsend:g" \
		-e "s:c2recv:c2faxrecv:g" \
		-e "s:CAPI4HYLAFAXCONFIG \"1\":C2FAXADDMODEM \"8\":g" \
		-e "s:capi4hylafaxconfig:c2faxaddmodem:g" \
		-i debian/*.1 || die

	cp -f debian/capi4hylafaxconfig.1 debian/c2faxaddmodem.8 || die
}

src_configure() {
	econf --with-hylafax-spooldir="${FAX_SPOOL_DIR}"
}

src_install() {
	keepdir "${FAX_SPOOL_DIR}"/{etc,recvq,pollq,log,status}
	fowners uucp:uucp "${FAX_SPOOL_DIR}" "${FAX_SPOOL_DIR}"/{etc,recvq,pollq,log,status}
	fperms 0700 "${FAX_SPOOL_DIR}"

	default

	# install setup script
	newsbin setupconffile c2faxaddmodem

	# install sample config
	insinto "${FAX_SPOOL_DIR}/etc"
	newins config.faxCAPI config.faxCAPI.default

	# install docs
	newdoc debian/changelog ChangeLog.debian

	# install man pages
	doman debian/c2fax*.[18]

	# install examples
	insinto /usr/share/doc/${PF}/examples
	doins sample_faxrcvd config.faxCAPI fritz_pic.tif GenerateFileMail.pl
	newins sample_AVMC4_config.faxCAPI config.faxCAPI_AVMC4
	newins debian/faxsend sample_faxsend

	# finally install init-script + config
	newinitd "${FILESDIR}/${PN}.initd" ${PN}
	newconfd "${FILESDIR}/${PN}.confd" ${PN}
}

pkg_postinst() {
	einfo
	elog "To use capi4hylafax:"
	elog "Make sure that your isdn/capi devices are owned by"
	elog "the \"uucp\" user (see udev or devfsd config)."
	elog "Modify ${FAX_SPOOL_DIR}/etc/config.faxCAPI"
	elog "to suit your system."

	if [ -n "${REPLACING_VERSIONS}" ]; then
		elog
		elog "If you're upgrading from a previous version"
		elog "please check for new or changed options."
		elog "A sample default config is installed as:"
		elog "${FAX_SPOOL_DIR}/etc/config.faxCAPI.default"
	else
		elog
		elog "Please run package config to install a default configuration."
	fi

	elog
	elog "You should also check special options in:"
	elog "/etc/conf.d/${PN}"
	elog
	elog "The following optional dependency is also available:"
	optfeature "hylafax integration" net-misc/hylafax
	elog
	elog "Then append the following line to your hylafax"
	elog "config file (${FAX_SPOOL_DIR}/etc/config):"
	elog "SendFaxCmd:			 /usr/bin/c2faxsend"
	einfo
}

pkg_config() {
	local config_file="${FAX_SPOOL_DIR}/etc/config.faxCAPI"
	if [ -e "${config_file}" ]; then
		eerror "The configuration file already exists. Please either update"
		eerror "or remove this file and re-run package configuration."
		eerror "Configuration file location: ${config_file}"
	else
		elog "Installing template configuration file to ${config_file}"
		cp -f "${FAX_SPOOL_DIR}/etc/config.faxCAPI.default" \
			"${config_file}" || die
	fi
}