]> git.ipfire.org Git - location/libloc.git/commitdiff
man: Add location-query.8
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Oct 2019 20:03:07 +0000 (20:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Oct 2019 20:03:07 +0000 (20:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac
man/.gitignore [new file with mode: 0644]
man/asciidoc.conf [new file with mode: 0644]
man/location-query.txt [new file with mode: 0644]

index f31a9187847bca1156672e6b49ba098ba2e43ed8..4bd6b4d7fa3299634fae712d38714840041082bf 100644 (file)
@@ -45,6 +45,18 @@ pkgconfigdir = $(libdir)/pkgconfig
 
 @INTLTOOL_POLICY_RULE@
 
+# ------------------------------------------------------------------------------
+
+AM_V_ASCIIDOC   = $(AM_V_ASCIIDOC_$(V))
+AM_V_ASCIIDOC_  = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
+AM_V_ASCIIDOC_0 = @echo "  ASCIIDOC" $@;
+
+AM_V_XSLT   = $(AM_V_XSLT_$(V))
+AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 = @echo "  XSLT    " $@;
+
+# ------------------------------------------------------------------------------
+
 .PHONY: update-po
 update-po:
        $(MAKE) -C po update-po
@@ -187,6 +199,8 @@ EXTRA_DIST += \
 CLEANFILES += \
        src/python/location-query
 
+# ------------------------------------------------------------------------------
+
 TESTS_CFLAGS = \
        $(AM_CFLAGS) \
        -DLIBLOC_PRIVATE
@@ -256,3 +270,61 @@ src_test_database_CFLAGS = \
 
 src_test_database_LDADD = \
        src/libloc.la
+
+# ------------------------------------------------------------------------------
+
+MANPAGES = \
+       man/location-query.8
+
+MANPAGES_TXT  = $(patsubst %.8,%.txt,$(MANPAGES))
+MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
+MANPAGES_XML  = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
+
+.PHONY: man
+man: $(MANPAGES) $(MANPAGES_HTML)
+
+if ENABLE_MANPAGES
+man_MANS = \
+       $(MANPAGES)
+endif
+
+CLEANFILES += \
+       $(MANPAGES) \
+       $(MANPAGES_HTML) \
+       $(MANPAGES_XML)
+
+EXTRA_DIST += \
+       man/asciidoc.conf \
+       $(MANPAGES_TXT)
+
+XSLTPROC_FLAGS = \
+       --nonet \
+       --stringparam man.output.quietly 1 \
+       --stringparam funcsynopsis.style ansi \
+       --stringparam man.th.extra1.suppress 1 \
+       --stringparam man.authors.section.enabled 1 \
+       --stringparam man.copyright.section.enabled 1
+
+XSLTPROC_COMMAND_MAN = \
+       $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
+       $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
+               http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+man/%.xml: man/%.txt man/asciidoc.conf
+       $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
+       $(ASCIIDOC) \
+               -f $(abs_srcdir)/man/asciidoc.conf \
+               -d manpage -b docbook -o $@ $<
+
+man/%.8: man/%.xml
+       $(XSLTPROC_COMMAND_MAN)
+
+man/%.html: man/%.txt man/asciidoc.conf
+       $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
+       $(ASCIIDOC) \
+               -f $(abs_srcdir)/man/asciidoc.conf \
+               -b html5 -a icons -a theme=flask -o $@ $<
+
+.PHONY: upload-man
+upload-man: $(MANPAGES_HTML)
+       rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
index b573ddcac27385d746d3453ac746325fcddd13c3..2c1e8f377024ec04b6fb0efcb38d83cd1526d708 100644 (file)
@@ -36,6 +36,22 @@ AC_SUBST(GETTEXT_PACKAGE)
 AC_PROG_SED
 AC_PROG_MKDIR_P
 
+# - man ------------------------------------------------------------------------
+
+have_manpages=no
+AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-man-pages],
+       [do not install man pages]))
+AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
+AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
+
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
+if test "${have_manpages}" = "yes" && test -z "${ASCIIDOC}"; then
+       AC_MSG_ERROR([Required program 'asciidoc' not found])
+fi
+# - debug ----------------------------------------------------------------------
+
 AC_ARG_ENABLE([debug],
         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
         [], [enable_debug=no])
diff --git a/man/.gitignore b/man/.gitignore
new file mode 100644 (file)
index 0000000..f891826
--- /dev/null
@@ -0,0 +1,3 @@
+/*.[13578]
+/*.html
+/*.xml
diff --git a/man/asciidoc.conf b/man/asciidoc.conf
new file mode 100644 (file)
index 0000000..243f81f
--- /dev/null
@@ -0,0 +1,12 @@
+ifdef::backend-docbook[]
+[link-inlinemacro]
+{0%{target}}
+{0#<citerefentry>}
+{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
+{0#</citerefentry>}
+endif::backend-docbook[]
+
+ifdef::backend-html5[]
+[link-inlinemacro]
+<a href="{target}.html">{target}{0?({0})}</a>
+endif::backend-html5[]
diff --git a/man/location-query.txt b/man/location-query.txt
new file mode 100644 (file)
index 0000000..216d1db
--- /dev/null
@@ -0,0 +1,69 @@
+= location-query(8)
+
+== NAME
+location-query - Query the location database
+
+== SYNOPSIS
+[verse]
+`location-query lookup ADDRESS [ADDRESS...]`
+`location-query get-as ASN [ASN...]`
+`location-query search-as STRING`
+`location-query list-networks-by-as ASN`
+`location-query list-networks-by-cc COUNTRY_CODE`
+
+== DESCRIPTION
+The `location-query` retrieves information from the location database.
+This data can be used to determine someone's location on the Internet
+and for building firewall rulesets to block access from certain ASes
+or countries.
+
+== OPTIONS
+
+--database FILE::
+-d FILE::
+       The path of the database which is being opened.
+       +
+       If this option is omitted, the system's database will be opened.
+
+--debug::
+       Enable debugging mode
+
+== COMMANDS
+
+'lookup ADDRESS [ADDRESS...]'::
+               This command returns the network the given IP address has been found in
+               as well as its Autonomous System if that information is available.
+
+'get-as ASN [ASN...]'::
+       This command returns the name of the owning organisation of the Autonomous
+       System.
+
+'search-as STRING'::
+       Lists all Autonomous Systems which match the given string.
+       +
+       The search will be performed case-insensitively.
+
+'list-networks-by-as ASN'::
+       Lists all networks which belong to this Autonomous System.
+
+'list-networks-by-cc COUNTRY_CODE'::
+       Lists all networks that belong to a country.
+       +
+       The country has to be encoded in ISO3166 Alpha-2 notation.
+
+'--help'::
+       Shows a short help text on using this program.
+
+'--version'::
+       Shows the program's version and exists.
+
+== EXIT CODES
+The 'location-query' command will normally exit with code zero.
+If there has been a problem and the requested action could not be performed,
+the exit code is unequal to zero.
+
+== BUGS
+Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/.
+
+== AUTHORS
+Michael Tremer