Hello community,

here is the log from the commit of package geoipupdate for openSUSE:Factory 
checked in at 2020-03-17 13:09:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/geoipupdate (Old)
 and      /work/SRC/openSUSE:Factory/.geoipupdate.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "geoipupdate"

Tue Mar 17 13:09:47 2020 rev:10 rq:785641 version:4.2.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/geoipupdate/geoipupdate.changes  2020-03-05 
23:19:03.521203623 +0100
+++ /work/SRC/openSUSE:Factory/.geoipupdate.new.3160/geoipupdate.changes        
2020-03-17 13:09:58.313790976 +0100
@@ -1,0 +2,7 @@
+Fri Mar 13 10:40:08 UTC 2020 - [email protected]
+
+- introduce geoipupdate-legacy script [bsc#1156194]
+- added sources
+  + geoipupdate-legacy
+
+-------------------------------------------------------------------

New:
----
  geoipupdate-legacy

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ geoipupdate.spec ++++++
--- /var/tmp/diff_new_pack.X0V9Mo/_old  2020-03-17 13:09:58.809791357 +0100
+++ /var/tmp/diff_new_pack.X0V9Mo/_new  2020-03-17 13:09:58.813791360 +0100
@@ -28,23 +28,36 @@
 Source1:        vendor.tar.gz
 Source2:        geoipupdate.timer
 Source3:        geoipupdate.service
+Source4:        geoipupdate-legacy
 Patch0:         disable-pandoc.patch
+%if 0%{?suse_version} >= 1500
 # Build-time parameters
 BuildRequires:  go >= 1.10
 # Manpage
 BuildRequires:  perl%{?suse_version:-base}
+%endif
 
 %description
 The GeoIP Update program performs automatic updates of GeoIP2 and GeoIP Legacy
 binary databases. Currently the program only supports Linux and other
 Unix-like systems.
 
+%package legacy
+Summary:        GeoIP Lagacy Format Updater
+Group:          Productivity/Networking/Other
+Requires:       geoipupdate
+Requires:       geolite2legacy
+
+%description legacy
+Script for updating data in GeoIP Legacy format.
+
 # Preparation step (unpackung and patching if necessary)
 %prep
 %setup -q -a1
 %patch0 -p1
 
 %build
+%if 0%{?suse_version} >= 1500
 export GOCACHE=$(pwd -P)/.gocache
 export GOTRACEBACK=crash
 export GOFLAGS='-a -mod=vendor -buildmode=pie -gcflags=all=-dwarf=false 
-ldflags=all=-s -ldflags=all=-w'
@@ -52,20 +65,24 @@
   CONFFILE=%{_sysconfdir}/GeoIP.conf \
   DATADIR=%{_localstatedir}/lib/GeoIP \
   VERSION=%{version}
+%endif
 
 %install
+%if 0%{?suse_version} >= 1500
 install -D -m0644 %{SOURCE2}              
%{buildroot}%{_unitdir}/geoipupdate.timer
 install -D -m0644 %{SOURCE3}              
%{buildroot}%{_unitdir}/geoipupdate.service
 install -D -m0755 build/geoipupdate       %{buildroot}%{_bindir}/geoipupdate
+%endif
+install -D -m0755 %{SOURCE4}              
%{buildroot}%{_bindir}/geoipupdate-legacy
 install -D -m0644 conf/GeoIP.conf.default %{buildroot}%{_sysconfdir}/GeoIP.conf
 install -d -m0755 %{buildroot}%{_localstatedir}/lib/GeoIP
 sed -ri \
- -e '/^UserId\s*/     s|YOUR_USER_ID_HERE|999999|' \
- -e '/^LicenseKey\s*/ s|YOUR_LICENSE_KEY_HERE|000000000000|' \
- -e '/^ProductIds\s*/ s|^(\w+s*).+$|\1 GeoLite2-City GeoLite2-Country 
GeoLite-Legacy-IPv6-City GeoLite-Legacy-IPv6-Country 506 517 533|' \
+ -e 's|YOUR_ACCOUNT_ID_HERE|999999|' \
+ -e 's|YOUR_LICENSE_KEY_HERE|000000000000|' \
  -e '/^(#\s*)?DatabaseDirectory/ 
s|^(#\s*)?(\w+\s*).+$|\2%{_localstatedir}/lib/GeoIP|' \
  %{buildroot}%{_sysconfdir}/GeoIP.conf
 
+%if 0%{?suse_version} >= 1500
 %pre
 %service_add_pre %{name}.service
 
@@ -77,14 +94,20 @@
 
 %postun
 %service_del_postun %{name}.service
+%endif
 
 %files
-%doc README.md build/geoipupdate.md build/GeoIP.conf.md
 %license LICENSE-*
 %config(noreplace) %{_sysconfdir}/GeoIP.conf
-%{_bindir}/geoipupdate
 %dir %{_localstatedir}/lib/GeoIP
+%if 0%{?suse_version} >= 1500
+%doc README.md build/geoipupdate.md build/GeoIP.conf.md
+%{_bindir}/geoipupdate
 %{_unitdir}/%{name}.service
 %{_unitdir}/%{name}.timer
+%endif
+
+%files legacy
+%{_bindir}/geoipupdate-legacy
 
 %changelog

++++++ geoipupdate-legacy ++++++
#!/bin/bash
geoip_conf='/etc/GeoIP.conf'

function conf_value()
{
  key=$1
  value=$(grep $key $geoip_conf | sed -e 's:#.*::' -e "s:$key::")
  if [ -z $value ]; then
    echo $key not configured in $geoip_conf
    exit 1
  fi
  echo $value
}

function download_geodata_csv()
{
  csv_product=$1
  echo ">>> Downloading $csv_product.zip"
  curl 
"https://download.maxmind.com/app/geoip_download?edition_id=$csv_product&license_key=$license_key&suffix=zip";
 \
       -o $database_directory/$csv_product.zip
}

function geolite_to_legacy()
{
  csv_product=$1
  echo ">>> Converting $csv_product.zip to legacy format"
  if ! which geolite2legacy >/dev/null 2>&1; then
    echo 'geolite2legacy program required'
    return
  fi

  pushd $database_directory
  if [ ! -f $csv_product.zip ]; then
    echo $database_directory/$csv_product.zip not found
    return
  fi

  geolite2legacy -i $csv_product.zip
  geolite2legacy -i $csv_product.zip -6
  popd
}

license_key=$(conf_value 'LicenseKey')
database_directory=$(conf_value 'DatabaseDirectory')

download_geodata_csv GeoLite2-ASN-CSV
geolite_to_legacy    GeoLite2-ASN-CSV
download_geodata_csv GeoLite2-City-CSV
geolite_to_legacy    GeoLite2-City-CSV
download_geodata_csv GeoLite2-Country-CSV
geolite_to_legacy    GeoLite2-Country-CSV


Reply via email to