diff options
author | Jan Lehnardt <jan@apache.org> | 2015-04-06 22:20:32 +0200 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2015-06-24 23:06:48 +0200 |
commit | 53bfa44f2c0749389e299edddb6a2ab4033fdca8 (patch) | |
tree | 910f4ab52269f1b745ded0509ea2b45d0a305102 | |
parent | f80317483b27fcdacc6a022d228b309ee1781b5e (diff) | |
download | couchdb-53bfa44f2c0749389e299edddb6a2ab4033fdca8.tar.gz |
add log file option to ./configure, unify naming of configure vars
-rw-r--r-- | Makefile | 17 | ||||
-rwxr-xr-x | configure | 44 |
2 files changed, 38 insertions, 23 deletions
@@ -40,7 +40,7 @@ clean: check: javascript eunit -# creates a a full erlang release +# creates a full erlang release dist: all @rm -rf rel/couchdb @rebar generate @@ -80,18 +80,21 @@ devclean: @rm -rf dev/lib/*/data -include install.mk -install: dist - @mkdir -p $(prefix) - @cp -R rel/couchdb/* $(prefix) +install: + @rm -rf rel/couchdb + @rebar generate # make full erlang release + @mkdir -p $(install_dir) + @cp -R rel/couchdb/* $(install_dir) @mkdir -p $(data_dir) @chown $(user) $(data_dir) @mkdir -p $(view_index_dir) @chown $(user) $(view_index_dir) - @touch $(prefix)/var/log/couchdb.log - @chown $(user) $(prefix)/var/log/couchdb.log + @mkdir `dirname $(log_file)` + @touch $(log_file) + @chown $(user) $(log_file) uninstall: - @rm -rf $(prefix) + @rm -rf $(installdir) install.mk: # ignore install.mk missing if we are running @@ -11,11 +11,12 @@ # License for the specific language governing permissions and limitations under # the License. -PREFIX="/opt/couchdb" +PREFIX="/usr/local" PACKAGE_AUTHOR_NAME="The Apache Software Foundation" COUCHDB_USER=`whoami` WITH_CURL="false" +# cd into this script’s directory rootdir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")" basename=`basename $0` @@ -32,8 +33,9 @@ Options: -h display a short help message and exit -u USER set the username to run as (defaults to $COUCHDB_USER) -p DIRECTORY set the prefix for installation (defaults to $PREFIX) - -d DIRECTORY specify the data directory (defaults to $PREFIX/var/lib) - -v DIRECTORY specify the view directory (defaults to $PREFIX/var/lib) + -d DIRECTORY specify the data directory (defaults to /var/lib/couchdb) + -v DIRECTORY specify the view directory (defaults to /var/lib/couchdb) + -l FILE specify the log file (defaults to /var/log/couchdb.log) -c request that couchjs is linked to cURL (default false) EOF @@ -52,7 +54,7 @@ display_error () { parse_opts () { set +e - options=`getopt hu:p:d:v:c $@` + options=`getopt hu:p:d:v:l:c $@` if test ! $? -eq 0; then display_error fi @@ -63,24 +65,32 @@ parse_opts () { -h) shift; display_help; exit;; -u) shift; COUCHDB_USER=$1; shift;; -p) shift; PREFIX=$1; shift;; - -d) shift; DATA=$1; shift;; - -v) shift; VIEW=$1; shift;; + -d) shift; DATA_DIR=$1; shift;; + -v) shift; VIEW_DIR=$1; shift;; + -l) shift; LOG_FILE=$1; shift;; -c) shift; WITH_CURL="true";; --) shift; break;; *) display_error "Unknown option: $1" >&2;; esac done - if test ! -n "$DATA"; then - DATA="$PREFIX/var/lib"; + + # defaults + if test -z "$DATA_DIR"; then + DATA_DIR="/var/lib/couchdb"; + fi + if test -z "$VIEW_DIR"; then + VIEW_DIR="/var/lib/couchdb"; fi - if test ! -n "$VIEW"; then - VIEW="$PREFIX/var/lib"; + if test -z "$LOG_FILE"; then + LOG_FILE="/var/log/couchdb.log"; fi } parse_opts $@ +INSTALL_DIR="$PREFIX/couchdb" + echo "==> configuring couchdb in rel/couchdb.config" cat > rel/couchdb.config << EOF @@ -99,9 +109,10 @@ cat > rel/couchdb.config << EOF % The contents of this file are auto-generated by configure % {package_author_name, "$PACKAGE_AUTHOR_NAME"}. -{prefix, "$PREFIX"}. -{data_dir, "$DATA"}. -{view_index_dir, "$VIEW"}. +{prefix, "INSTALLDIR"}. +{data_dir, "$DATA_DIR"}. +{view_index_dir, "$VIEW_DIR"}. +{log_file, "$LOG_FILE"}. {user, "$COUCHDB_USER"}. {node_name, "-name couchdb"}. {cluster_port, 5984}. @@ -124,9 +135,10 @@ cat > install.mk << EOF # The contents of this file are auto-generated by configure # package_author_name = $PACKAGE_AUTHOR_NAME -prefix = $PREFIX -data_dir = $DATA -view_index_dir = $VIEW +install_dir = $INSTALL_DIR +data_dir = $DATA_DIR +view_index_dir = $VIEW_DIR +log_file = $LOG_FILE user = $COUCHDB_USER EOF |