[geocode-glib] geoip-update: Honor DB path variables



commit f67134e6c9e0e4c1df74cfbaeb52f71cd9b12f4e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 20 20:18:38 2013 +0200

    geoip-update: Honor DB path variables
    
    While rest of the code looks for db files in the location specified by
    env or Makefile variables, geoip-update was always copying the database
    files to /usr/share/GeoIP/.

 geocode-glib/geocode-ip-server/geoip-update.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/geocode-glib/geocode-ip-server/geoip-update.c b/geocode-glib/geocode-ip-server/geoip-update.c
index ec80064..f1b91c6 100644
--- a/geocode-glib/geocode-ip-server/geoip-update.c
+++ b/geocode-glib/geocode-ip-server/geoip-update.c
@@ -150,11 +150,11 @@ main (int argc, char **argv)
 {
 
         GError *error = NULL;
-        char *path = "/usr/share/GeoIP/";
+        const char *path, *dbpath;
         guint i;
         GOptionContext *context;
         const GOptionEntry entries[] = {
-                { "dbpath", 0, 0, G_OPTION_ARG_STRING, &path, "The directory containing the databases", NULL 
},
+                { "dbpath", 0, 0, G_OPTION_ARG_STRING, &dbpath, "The directory containing the databases", 
NULL },
                 { NULL }
         };
 
@@ -167,6 +167,14 @@ main (int argc, char **argv)
                 return 1;
         }
 
+        path = g_getenv ("GEOIP_DATABASE_PATH");
+        if (!path) {
+                if (dbpath)
+                        path = dbpath;
+                else
+                        path = GEOIP_DATABASE_PATH;
+        }
+
         for (i = 0; i < G_N_ELEMENTS (db_info_map); i++) {
                 GFile *db_remote;
                 GFile *db_local;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]