diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-03-15 22:57:16 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-04-10 19:04:32 +0200 |
commit | 6dd77065c3beb4aa32218d76ba27efb83d507f42 (patch) | |
tree | 666970c77566128ec9330e324d9e695dae2c0aaf | |
parent | 647f21332d37c05e888eb9d01261310450704d53 (diff) | |
download | mobile-broadband-provider-info-lr/android-apn.tar.gz |
apn-conf: generate Android-compatible APN listlr/android-apn
Some distros (Ubuntu Touch) read out Android-style APN list. Generate
one from our database so they can use it.
https://gitlab.gnome.org/GNOME/mobile-broadband-provider-info/merge_requests/4
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | apns-conf.xsl | 114 | ||||
-rwxr-xr-x | configure.ac | 5 |
4 files changed, 125 insertions, 0 deletions
@@ -1,6 +1,7 @@ /Makefile /Makefile.in /aclocal.m4 +/apns-conf.xml /autom4te.cache/ /config.log /config.status diff --git a/Makefile.am b/Makefile.am index 646d47c..c023a6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,11 @@ EXTRA_DIST = mobile-broadband-provider-info.pc.in pkgconfigdir = $(datadir)/pkgconfig pkgconfig_DATA = mobile-broadband-provider-info.pc +apns-conf.xml: $(top_srcdir)/apns-conf.xsl $(top_srcdir)/$(SP_XML_DB) + $(AM_V_GEN) $(XSLTPROC) --output $@ $^ + +pkgdata_DATA = apns-conf.xml + check-local: xmllint --valid $(top_srcdir)/$(SP_XML_DB) 2>&1 > /dev/null || exit 1; diff --git a/apns-conf.xsl b/apns-conf.xsl new file mode 100644 index 0000000..f0b4f68 --- /dev/null +++ b/apns-conf.xsl @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- THIS WORK IS IN PUBLIC DOMAIN: +The person or persons who have associated work with this document +(the "Dedicator" or "Certifier") hereby either (a) certifies that, to the best +of his knowledge, the work of authorship identified is in the public domain of +the country from which the work is published, or (b) hereby dedicates whatever +copyright the dedicators holds in the work of authorship identified below +(the "Work") to the public domain. A certifier, moreover, dedicates any +copyright interest he may have in the associated work, and for these purposes, +is described as a "dedicator" below. + +A certifier has taken reasonable steps to verify the copyright status of this +work. Certifier recognizes that his good faith efforts may not shield him from +liability if in fact the work certified is not in the public domain. + +Dedicator makes this dedication for the benefit of the public at large and to +the detriment of the Dedicator's heirs and successors. Dedicator intends this +dedication to be an overt act of relinquishment in perpetuity of all present +and future rights under copyright law, whether vested or contingent, in the +Work. Dedicator understands that such relinquishment of all rights includes the +relinquishment of all rights to enforce (by lawsuit or otherwise) those +copyrights in the Work. + +Dedicator recognizes that, once placed in the public domain, the Work may be +freely reproduced, distributed, transmitted, used, modified, built upon, or +otherwise exploited by anyone for any purpose, commercial or non-commercial, +and in any way, including by methods that have not yet been invented or +conceived. +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="/"> + + <xsl:comment> Automatically generated from serviceproviders.xml </xsl:comment> + <xsl:for-each select="comment()"> + <xsl:copy/> + </xsl:for-each> + + <apns version="8"> + <xsl:text>
</xsl:text> + <xsl:for-each select="serviceproviders/country/provider/gsm/apn"> + <xsl:text>	</xsl:text> + <apn> + + <xsl:attribute name="carrier"> + <xsl:choose> + <xsl:when test="name"> + <xsl:value-of select="name" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="../../name" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <xsl:attribute name="mcc"> + <xsl:value-of select="../network-id/@mcc" /> + </xsl:attribute> + + <xsl:attribute name="mnc"> + <xsl:value-of select="../network-id/@mnc" /> + </xsl:attribute> + + <xsl:attribute name="apn"> + <xsl:value-of select="@value" /> + </xsl:attribute> + + <xsl:if test="username"> + <xsl:attribute name="user"> + <xsl:value-of select="username" /> + </xsl:attribute> + </xsl:if> + + <xsl:if test="password"> + <xsl:attribute name="password"> + <xsl:value-of select="password" /> + </xsl:attribute> + </xsl:if> + + <xsl:if test="usage/@type = 'mms'"> + <xsl:attribute name="mmsc"> + <xsl:value-of select="mmsc" /> + </xsl:attribute> + <xsl:choose> + <xsl:when test="contains(mmsproxy,':')"> + <xsl:attribute name="mmsproxy"> + <xsl:value-of select="substring-before(mmsproxy,':')" /> + </xsl:attribute> + <xsl:attribute name="mmsport"> + <xsl:value-of select="substring-after(mmsproxy,':')" /> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="mmsproxy"> + <xsl:value-of select="mmsproxy" /> + </xsl:attribute> + <xsl:attribute name="mmsport">8080</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + + <xsl:attribute name="type"> + <xsl:value-of select="'default'" /> + <xsl:if test="usage/@type = 'internet'">,supl</xsl:if> + <xsl:if test="usage/@type = 'mms'">,mms</xsl:if> + </xsl:attribute> + </apn> + <xsl:text>
</xsl:text> + </xsl:for-each> + </apns> + + </xsl:template> +</xsl:stylesheet> diff --git a/configure.ac b/configure.ac index dece33f..3ff5161 100755 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,11 @@ AC_INIT(mobile-broadband-provider-info, 20190116, dcbw@redhat.com, mobile-broadb AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dist-gzip dist-bzip2]) AM_MAINTAINER_MODE([enable]) +AC_PATH_PROG(XSLTPROC, xsltproc) +if test -z "$XSLTPROC"; then + AC_MSG_ERROR([xsltproc not found]) +fi + AC_CONFIG_FILES([ Makefile mobile-broadband-provider-info.pc |