aboutsummaryrefslogtreecommitdiff
blob: 327d3d7d2b47a095619ab3020adf89c87bc4d323 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop java-utils-2 rpm xdg

DESCRIPTION="Spanish government's electronic signature application for online procedures"
HOMEPAGE="
	https://administracionelectronica.gob.es/ctt/clienteafirma
	https://github.com/ctt-gob-es/clienteafirma
"

# Upstream blocks wget with no User Agent. It can be addressed globally, see https://wiki.gentoo.org/wiki/FETCHCOMMAND.
# If Gentoo's default configuration is in place, pkg_pretend() and pkg_nofetch() provide fallback options.
SRC_URI="https://estaticos.redsara.es/comunes/autofirma/$(ver_rs 1- /)/AutoFirma_Linux_Fedora.zip -> ${PF}.zip"

S=${WORKDIR}

LICENSE="|| ( GPL-2 EUPL-1.1 )"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="virtual/jre:1.8"
BDEPEND="
	app-arch/unzip
	net-misc/wget
"

pkg_pretend() {
	# Upstream blocks vanilla wget, so we set up a browser User-Agent as a fallback.
	local URI="https://estaticos.redsara.es/comunes/autofirma/$(ver_rs 1- /)/AutoFirma_Linux_Fedora.zip"
	local USER_AGENT="Mozilla/5.0 (X11; Gentoo; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
	local DISTFILE="${PORTAGE_ACTUAL_DISTDIR}/${PF}.zip"
	[[ -f "${DISTFILE}" ]] || /usr/sbin/wget --user-agent="${USER_AGENT}" "${URI}" -O "${DISTFILE}"
}

pkg_nofetch() {
	einfo "Please download:"
	einfo " https://estaticos.redsara.es/comunes/autofirma/$(ver_rs 1- /)/AutoFirma_Linux_Fedora.zip"
	einfo "and move it to ${PORTAGE_ACTUAL_DISTDIR}/${PF}.zip."
}

src_unpack() {
	default
	rpm_unpack "./${P}-1.noarch_FEDORA.rpm"
}

src_install() {
	java-pkg_dojar "usr/lib64/${PN}/${PN}.jar"
	java-pkg_dolauncher
	java-pkg_dojar "usr/lib64/${PN}/${PN}Configurador.jar"
	doicon "usr/lib64/${PN}/${PN}.png"
	make_desktop_entry \
		"${PN} %u" AutoFirma "${PN}" "Utility" \
		"Comment[es]=Aplicación de firma electrónica de la FNMT\nMimeType=x-scheme-handler/afirma"
}