Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/pazpar2
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 25 Jan 2010 15:20:19 +0000 (16:20 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 25 Jan 2010 15:20:19 +0000 (16:20 +0100)
debian/pazpar2.postinst
src/http_command.c
src/pazpar2.h

index 46690ae..7bf566b 100644 (file)
@@ -4,6 +4,15 @@ set -e
 if [ "$1" != "configure" ]; then
     exit 0
 fi
+# add default.xml if there are no enabled services
+no_services=true
+for f in /etc/pazpar2/services-enabled/*.xml; do
+       test -e $f && no_services=false
+done
+if ${no_services}; then
+       ln -sf ../services-available/default.xml \
+               /etc/pazpar2/services-enabled/default.xml
+fi
 if [ -x "/etc/init.d/pazpar2" ]; then
        update-rc.d pazpar2 defaults >/dev/null
        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
@@ -12,8 +21,6 @@ if [ -x "/etc/init.d/pazpar2" ]; then
                /etc/init.d/pazpar2 start || exit $?
        fi
 fi
-ln -sf ../services-available/default.xml \
-       /etc/pazpar2/services-enabled/default.xml
 if [ -f "/etc/pazpar2/pazpar2.cfg" ]; then
        echo "pazpar2.cfg is obsolete. Pazpar2 uses /etc/pazpar2/server.xml"
 fi
index badb77b..e3981b2 100644 (file)
@@ -117,6 +117,7 @@ static const char *get_msg(enum pazpar2_error_code code)
         { PAZPAR2_CONFIG_TARGET, "Target cannot be configured"},
         { PAZPAR2_RECORD_FAIL, "Record command failed"},
         { PAZPAR2_NOT_IMPLEMENTED, "Not implemented"},
+        { PAZPAR2_NO_SERVICE, "No service"},
         { PAZPAR2_LAST_ERROR, "Last error"},
         { 0, 0 }
     };
@@ -279,7 +280,7 @@ static void cmd_init(struct http_channel *c)
         service = locate_service(c->server, service_name);
         if (!service)
         {
-            error(rs, PAZPAR2_MALFORMED_PARAMETER_VALUE, "service");
+            error(rs, PAZPAR2_NO_SERVICE, service_name ? service_name : "unnamed");
             return;
         }
         service_incref(service);
index d03cfa0..4a9c26a 100644 (file)
@@ -48,6 +48,7 @@ enum pazpar2_error_code {
     PAZPAR2_CONFIG_TARGET,
     PAZPAR2_RECORD_FAIL,
     PAZPAR2_NOT_IMPLEMENTED,
+    PAZPAR2_NO_SERVICE,
 
     PAZPAR2_LAST_ERROR
 };