From af2086961e21419f6cfc3e1bf45440fe64c8e640 Mon Sep 17 00:00:00 2001
From: dbs <dbs@9efc2488-bf62-4759-914b-345cdb29e865>
Date: Tue, 9 Nov 2010 16:21:15 +0000
Subject: [PATCH] Give opensrf.py reasonable defaults for options

Rather than:
opensrf.py -l -d -f /openils/conf/opensrf_core.xml -p /openils/var/run/ -a start_all

you can now use:
opensrf.py -l -d -a start_all

Isn't that better? Note that we put the PIDs into PID_DIR/run/opensrf/
so that if/when OpenSRF is installed outside of the /openils/ prefix,
the names of the processes won't conflict with any other application PIDs.
Unlikely, but you never know.


git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2067 9efc2488-bf62-4759-914b-345cdb29e865
---
 configure.ac                             | 1 +
 src/python/{opensrf.py => opensrf.py.in} | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)
 rename src/python/{opensrf.py => opensrf.py.in} (97%)

diff --git a/configure.ac b/configure.ac
index 7418c82..6cc828c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,6 +340,7 @@ if test "x$OSRF_INSTALL_CORE" = "xtrue"; then
 			 src/libopensrf/Makefile
 			 src/perl/Makefile
 			 src/ports/strn_compat/Makefile
+			 src/python/opensrf.py
 			 src/router/Makefile
 			 src/srfsh/Makefile
 			 bin/opensrf-perl.pl
diff --git a/src/python/opensrf.py b/src/python/opensrf.py.in
similarity index 97%
rename from src/python/opensrf.py
rename to src/python/opensrf.py.in
index 27c5773..cc5d8f4 100755
--- a/src/python/opensrf.py
+++ b/src/python/opensrf.py.in
@@ -195,12 +195,13 @@ except getopt.GetoptError, e:
 
 options = dict(ops)
 
-if '-a' not in options or '-f' not in options:
+if '-a' not in options:
     do_help()
 
 action = options['-a']
-config_file = options['-f']
-pid_dir = options['-p']
+
+config_file = options.get('-f', '@CONF_DIR@/opensrf_core.xml')
+pid_dir = options.get('-p', '@PID_DIR@/run/opensrf')
 
 service_name = options.get('-s')
 config_ctx = options.get('-c', 'config.opensrf')
-- 
2.11.0