Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 11 commits
  • 518 files changed
  • 0 commit comments
  • 1 contributor
Commits on Dec 05, 2012
@whitelynx whitelynx Rearranged project to just have the PBKDF2 implementation in src/. 84d283e
@whitelynx whitelynx Renamed couch_passwords module to pbkdf2. 935e748
@whitelynx whitelynx Corrected module name. 6b0ef80
@whitelynx whitelynx Added rebar build system and an application file. a2b59e2
@whitelynx whitelynx Added eunit tests. (based on the test vectors from couchdb's 230-pbkf…
…d2.t tests)
d009e87
@whitelynx whitelynx Updated .gitignore. 945d481
@whitelynx whitelynx Updated README.md with build instructions. 28f02a2
@whitelynx whitelynx Added basic usage instructions. d28a035
Commits on Mar 03, 2013
@whitelynx whitelynx Rewrote most of the file with more readable code style added more opt…
…ions, and cleaned up implementation.

- Now, you must specify a MAC function to use. (use the atom 'sha' to get the previous behavior)
- Everything comes back as raw binary, now; you should probably encode it with pbkdf2:to_hex/1 or base4:encode/1 if you're putting it a non-binary-safe place.
- Renamed pbkdf2:verify/2 to pbkdf2:compare_secure/2 to make it clearer what its purpose is.
9d9946e
@whitelynx whitelynx Fixed to_hex to return binary if it gets a binary, and removed the ab…
…ility to pass arbitrary digest functions, since crypto:hmac doesn't support it.
267eb2c
@whitelynx whitelynx Corrected the tests to work with the latest changes. ab904ed
Showing with 119 additions and 9,380 deletions.
  1. +2 −120 .gitignore
  2. +0 −268 INSTALL.Unix
  3. +0 −170 INSTALL.Windows
  4. +0 −168 Makefile.am
  5. +0 −83 README
  6. +97 −0 README.md
  7. +0 −30 acinclude.m4.in
  8. +0 −125 bin/Makefile.am
  9. +0 −130 bin/couch-config.tpl.in
  10. +0 −26 bin/couchdb.bat.tpl.in
  11. +0 −339 bin/couchdb.tpl.in
  12. +0 −95 bootstrap
  13. +0 −607 configure.ac
  14. +0 −117 etc/Makefile.am
  15. +0 −93 etc/couchdb/Makefile.am
  16. +0 −322 etc/couchdb/default.ini.tpl.in
  17. +0 −93 etc/couchdb/local.ini
  18. +0 −13 etc/default/Makefile.am
  19. +0 −7 etc/default/couchdb
  20. +0 −13 etc/init/Makefile.am
  21. +0 −159 etc/init/couchdb.tpl.in
  22. +0 −13 etc/launchd/Makefile.am
  23. +0 −30 etc/launchd/org.apache.couchdb.plist.tpl.in
  24. +0 −13 etc/logrotate.d/Makefile.am
  25. +0 −9 etc/logrotate.d/couchdb.tpl.in
  26. +0 −13 etc/windows/Makefile.am
  27. +0 −29 etc/windows/README.txt.tpl
  28. +0 −88 etc/windows/couchdb.iss.tpl
  29. +0 −123 license.skip
  30. BIN m4/ac_check_curl.m4.gz
  31. BIN m4/ac_check_icu.m4.gz
  32. BIN m4/pkg.m4.gz
  33. BIN rebar
  34. +20 −0 rebar.config
  35. +0 −217 share/Makefile.am
  36. +0 −8 share/server/coffee-script.js
  37. +0 −45 share/server/filter.js
  38. +0 −482 share/server/json2.js
  39. +0 −167 share/server/loop.js
  40. +0 −158 share/server/mimeparse.js
  41. +0 −367 share/server/render.js
  42. +0 −32 share/server/state.js
  43. +0 −157 share/server/util.js
  44. +0 −25 share/server/validate.js
  45. +0 −126 share/server/views.js
  46. +0 −65 share/www/_sidebar.html
  47. +0 −135 share/www/config.html
  48. +0 −98 share/www/couch_tests.html
  49. +0 −112 share/www/custom_test.html
  50. +0 −270 share/www/database.html
  51. +0 −33 share/www/dialog/_admin_party.html
  52. +0 −31 share/www/dialog/_change_password.html
  53. +0 −51 share/www/dialog/_compact_cleanup.html
  54. +0 −50 share/www/dialog/_create_admin.html
  55. +0 −42 share/www/dialog/_create_config.html
  56. +0 −33 share/www/dialog/_create_database.html
  57. +0 −50 share/www/dialog/_database_security.html
  58. +0 −29 share/www/dialog/_delete_database.html
  59. +0 −26 share/www/dialog/_delete_document.html
  60. +0 −34 share/www/dialog/_login.html
  61. +0 −35 share/www/dialog/_save_view_as.html
  62. +0 −42 share/www/dialog/_share_test_reports.html
  63. +0 −35 share/www/dialog/_signup.html
  64. +0 −36 share/www/dialog/_upload_attachment.html
  65. +0 −114 share/www/document.html
  66. BIN share/www/favicon.ico
  67. BIN share/www/image/add.png
  68. BIN share/www/image/apply.gif
  69. BIN share/www/image/bg.png
  70. BIN share/www/image/cancel.gif
  71. BIN share/www/image/compact.png
  72. BIN share/www/image/delete-mini.png
  73. BIN share/www/image/delete.png
  74. BIN share/www/image/grippie.gif
  75. BIN share/www/image/hgrad.gif
  76. BIN share/www/image/key.png
  77. BIN share/www/image/load.png
  78. BIN share/www/image/logo.png
  79. BIN share/www/image/order-asc.gif
  80. BIN share/www/image/order-desc.gif
  81. BIN share/www/image/path.gif
  82. BIN share/www/image/progress.gif
  83. BIN share/www/image/rarrow.png
  84. BIN share/www/image/run-mini.png
  85. BIN share/www/image/run.png
  86. BIN share/www/image/running.png
  87. BIN share/www/image/save.png
  88. BIN share/www/image/sidebar-toggle.png
  89. BIN share/www/image/spinner.gif
  90. BIN share/www/image/spinner_33.gif
  91. BIN share/www/image/spinner_6b.gif
  92. BIN share/www/image/test_failure.gif
  93. BIN share/www/image/test_success.gif
  94. BIN share/www/image/thead-key.gif
  95. BIN share/www/image/thead.gif
  96. BIN share/www/image/toggle-collapse.gif
  97. BIN share/www/image/toggle-expand.gif
  98. BIN share/www/image/twisty.gif
  99. +0 −94 share/www/index.html
  100. +0 −184 share/www/replicator.html
  101. +0 −124 share/www/script/base64.js
  102. +0 −514 share/www/script/couch.js
  103. +0 −475 share/www/script/couch_test_runner.js
  104. +0 −98 share/www/script/couch_tests.js
  105. +0 −1,344 share/www/script/futon.browse.js
  106. +0 −146 share/www/script/futon.format.js
Sorry, we could not display the entire diff because too many files (518) changed.
View
122 .gitignore
@@ -1,120 +1,2 @@
-*.beam
-*.gz
-*.tpl
-*.o
-*.lo
-*.la
-*.m4
-*.in
-*~
-*.orig
-*.rej
-*.sw*
-erl_crash.dump
-configure
-autom4te.cache
-build-aux
-*.diff
-!.gitignore
-.*
-!.mailmap
-
-# ./configure
-
-Makefile
-bin/Makefile
-config.h
-config.log
-config.status
-etc/Makefile
-etc/couchdb/Makefile
-etc/default/Makefile
-etc/init/Makefile
-etc/init/couchdb
-etc/launchd/Makefile
-etc/logrotate.d/Makefile
-libtool
-share/Makefile
-src/couchdb/.deps/*
-src/couchdb/Makefile
-src/couchdb/priv/Makefile
-src/mochiweb/Makefile
-stamp-h1
-test/.deps/
-test/Makefile
-test/javascript/run_js_tests.sh
-var/Makefile
-
-# for make
-
-bin/couchdb
-bin/couchdb.1
-bin/couch-config
-bin/couch-config_dev
-etc/couchdb/default.ini
-etc/launchd/org.apache.couchdb.plist
-etc/logrotate.d/couchdb
-src/couch_mrview/ebin/
-src/couch_replicator/ebin/
-src/couchdb/.libs/*
-src/couchdb/couch.app
-src/couchdb/couchjs
-src/couchdb/edoc-info
-src/couchdb/erlang.png
-src/couchdb/stylesheet.css
-src/couchdb/priv/.deps/
-src/couchdb/priv/.libs/
-src/couchdb/priv/couch_icu_driver.la
-src/couchdb/priv/couchjs
-src/couchdb/priv/couchjs.1
-src/couchdb/priv/couchspawnkillable
-src/couchdb/priv/stat_descriptions.cfg
-src/erlang-oauth/oauth.app
-src/ibrowse/ibrowse.app
-src/ejson/ejson.app
-src/ejson/.deps/
-src/ejson/.libs/
-src/ejson/priv
-src/mochiweb/mochiweb.app
-src/snappy/.deps/
-src/snappy/.libs/
-src/snappy/priv
-src/snappy/snappy.app
-src/snappy/google-snappy/snappy-stubs-public.h
-src/snappy/google-snappy/stamp-h2
-src/snappy/google-snappy/.deps/
-test/local.ini
-test/etap/.deps/
-test/etap/run
-test/etap/test_cfg_register
-test/etap/test_util.erl
-test/javascript/run
-share/server/main.js
-share/server/main-coffee.js
-
-# for make dev
-
-bin/.deps/
-bin/couchjs_dev
-bin/couchpw
-etc/couchdb/default_dev.ini
-etc/couchdb/local_dev.ini
-utils/run
-tmp
-src/couchdb/priv/stat_descriptions.cfg
-src/erlang-oauth/oauth.app
-src/ibrowse/ibrowse.app
-src/mochiweb/mochiweb.app
-test/etap/run
-
-# for make check
-
-test/etap/temp.*
-test/bench/run
-couchdb.stderr
-couchdb.stdout
-
-# for make cover
-
-cover/*
-INSTALL
+ebin/
+.eunit/
View
268 INSTALL.Unix
@@ -1,268 +0,0 @@
-Apache CouchDB README.Unix
-==========================
-
-A high-level guide to Unix-like systems, inc. Mac OS X and Ubuntu.
-
-Troubleshooting
----------------
-
-There is a troubleshooting guide:
-
- http://wiki.apache.org/couchdb/Troubleshooting
-
-There is a wiki for general documentation:
-
- http://wiki.apache.org/couchdb/
-
-There are collection of friendly mailing lists:
-
- http://couchdb.apache.org/community/lists.html
-
-Please work through these in order if you experience any problems.
-
-Dependencies
-------------
-
-You should have the following installed:
-
- * Erlang OTP (>=R12B5) (http://erlang.org/)
- * ICU (http://icu.sourceforge.net/)
- * OpenSSL (http://www.openssl.org/)
- * Mozilla SpiderMonkey (1.7) (http://www.mozilla.org/js/spidermonkey/)
- * GNU Make (http://www.gnu.org/software/make/)
- * GNU Compiler Collection (http://gcc.gnu.org/)
- * libcurl (http://curl.haxx.se/libcurl/)
- * help2man (http://www.gnu.org/s/help2man/)
-
-It is recommended that you install Erlang OTP R12B-5 or above where possible.
-You will only need libcurl if you plan to run the JavaScript test suite. And
-help2man is only need if you plan on installing the CouchDB man pages.
-
-Ubuntu
-~~~~~~
-
-For up to date instructions, please see:
-
- http://wiki.apache.org/couchdb/Installing_on_Ubuntu
-
-Unfortunately, it seems that installing dependancies on Ubuntu is troublesome.
-
-Debian-based Systems
-~~~~~~~~~~~~~~~~~~~~
-
-You can install the build tools by running:
-
- sudo apt-get install build-essential
-
-You can install the other dependencies by running:
-
- sudo apt-get install erlang libicu-dev libmozjs-dev libcurl4-openssl-dev
-
-Be sure to update the version numbers to match your system's available packages.
-
-Mac OS X
-~~~~~~~~
-
-You can install the build tools by running:
-
- open /Applications/Installers/Xcode\ Tools/XcodeTools.mpkg
-
-You can install the other dependencies by running:
-
- brew install erlang icu4c spidermonkey curl
-
-You may want to link ICU so that CouchDB can find the header files automatically:
-
- brew link icu4c
-
-The same is true for recent versions of Erlang:
-
- brew link erlang
-
-You will need Homebrew installed to use the `brew` command.
-
-Learn more about Homebrew at:
-
- http://mxcl.github.com/homebrew/
-
-Some versions of Mac OS X ship a problematic OpenSSL library. If you're
-experiencing troubles with CouchDB crashing intermittently with a segmentation
-fault or a bus error, you will need to install your own version of OpenSSL. See
-the troubleshooting guide, mentioned above, for more information.
-
-Installing
-----------
-
-Once you have satisfied the dependencies you should run:
-
- ./configure
-
-This script will configure CouchDB to be installed into `/usr/local` by default.
-
-If you wish to customise the installation, pass `--help` to this script.
-
-If everything was successful you should see the following message:
-
- You have configured Apache CouchDB, time to relax.
-
-Relax.
-
-To install CouchDB you should run:
-
- make && sudo make install
-
-You only need to use `sudo` if you're installing into a system directory.
-
-Try `gmake` if `make` is giving you any problems.
-
-If everything was successful you should see the following message:
-
- You have installed Apache CouchDB, time to relax.
-
-Relax.
-
-First Run
----------
-
-You can start the CouchDB server by running:
-
- sudo -i -u couchdb couchdb
-
-This uses the `sudo` command to run the `couchdb` command as the `couchdb` user.
-
-When CouchDB starts it should eventually display the following message:
-
- Apache CouchDB has started, time to relax.
-
-Relax.
-
-To check that everything has worked, point your web browser to:
-
- http://127.0.0.1:5984/_utils/index.html
-
-From here you should run the test suite in Firefox.
-
-Security Considerations
------------------------
-
-You should create a special `couchdb` user for CouchDB.
-
-On many Unix-like systems you can run:
-
- adduser --system \
- --home /usr/local/var/lib/couchdb \
- --no-create-home \
- --shell /bin/bash \
- --group --gecos \
- "CouchDB Administrator" couchdb
-
-On Mac OS X you can use the Workgroup Manager to create users:
-
- http://www.apple.com/support/downloads/serveradmintools1047.html
-
-You must make sure that:
-
- * The user has a working POSIX shell
-
- * The user's home directory is `/usr/local/var/lib/couchdb`
-
-You can test this by:
-
- * Trying to log in as the `couchdb` user
-
- * Running `pwd` and checking the present working directory
-
-Change the ownership of the CouchDB directories by running:
-
- chown -R couchdb:couchdb /usr/local/etc/couchdb
- chown -R couchdb:couchdb /usr/local/var/lib/couchdb
- chown -R couchdb:couchdb /usr/local/var/log/couchdb
- chown -R couchdb:couchdb /usr/local/var/run/couchdb
-
-Change the permission of the CouchDB directories by running:
-
- chmod 0770 /usr/local/etc/couchdb
- chmod 0770 /usr/local/var/lib/couchdb
- chmod 0770 /usr/local/var/log/couchdb
- chmod 0770 /usr/local/var/run/couchdb
-
-Running as a Daemon
--------------------
-
-SysV/BSD-style Systems
-~~~~~~~~~~~~~~~~~~~~~~
-
-You can use the `couchdb` init script to control the CouchDB daemon.
-
-On SysV-style systems, the init script will be installed into:
-
- /usr/local/etc/init.d
-
-On BSD-style systems, the init script will be installed into:
-
- /usr/local/etc/rc.d
-
-We use the `[init.d|rc.d]` notation to refer to both of these directories.
-
-You can control the CouchDB daemon by running:
-
- /usr/local/etc/[init.d|rc.d]/couchdb [start|stop|restart|status]
-
-If you wish to configure how the init script works, you can edit:
-
- /usr/local/etc/default/couchdb
-
-Comment out the `COUCHDB_USER` setting if you're running as a non-superuser.
-
-To start the daemon on boot, copy the init script to:
-
- /etc/[init.d|rc.d]
-
-You should then configure your system to run the init script automatically.
-
-You may be able to run:
-
- sudo update-rc.d couchdb defaults
-
-If this fails, consult your system documentation for more information.
-
-A `logrotate` configuration is installed into:
-
- /usr/local/etc/logrotate.d/couchdb
-
-Consult your `logrotate` documentation for more information.
-
-It is critical that the CouchDB logs are rotated so as not to fill your disk.
-
-Mac OS X
-~~~~~~~~
-
-You can use the `launchctl` command to control the CouchDB daemon.
-
-You can load the configuration by running:
-
- sudo launchctl load \
- /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist
-
-You can stop the CouchDB daemon by running:
-
- sudo launchctl unload \
- /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist
-
-You can start CouchDB by running:
-
- sudo launchctl start org.apache.couchdb
-
-You can restart CouchDB by running:
-
- sudo launchctl stop org.apache.couchdb
-
-You can edit the launchd configuration by running:
-
- open /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist
-
-To start the daemon on boot, copy the configuration file to:
-
- /Library/LaunchDaemons
-
-Consult your system documentation for more information.
View
170 INSTALL.Windows
@@ -1,170 +0,0 @@
-Apache CouchDB README.Windows
-==============================
-
-For a high-level guide to Microsoft Windows.
-
-Troubleshooting
----------------
-
-There is a troubleshooting guide:
-
- http://wiki.apache.org/couchdb/Troubleshooting
-
-There is a wiki for general documentation:
-
- http://wiki.apache.org/couchdb/
-
-There are collection of friendly mailing lists:
-
- http://couchdb.apache.org/community/lists.html
-
-Please work through these in order if you experience any problems.
-
-Dependencies
-------------
-
-You will need the following installed:
-
- * Erlang OTP (=14B01) (http://erlang.org/)
- * ICU (=4.4.*) (http://icu.sourceforge.net/)
- * OpenSSL (http://www.openssl.org/)
- * Mozilla SpiderMonkey (1.7) (http://www.mozilla.org/js/spidermonkey/)
- * libcurl (http://curl.haxx.se/libcurl/)
- * Cygwin (http://www.cygwin.com/)
- * Visual Studio 2008 (http://msdn.microsoft.com/en-gb/vstudio/default.aspx)
-
-General Notes
--------------
-
- * When installing Erlang, you must build it from source.
-
- The CouchDB build requires a number of the Erlang build scripts.
-
- * When installing ICU, select the binaries built with Visual Studio 2008.
-
- * When installing Cygwin, be sure to select all the `development` tools.
-
- * When installing libcurl, be sure to install by hand.
-
- The Cygwin binaries are incompatible and will not work with Erlang.
-
-Setting Up Cygwin
------------------
-
-Before starting any Cygwin terminals, run:
-
- set CYGWIN=nontsec
-
-To set up your environment, run:
-
- [VS_BIN]/vcvars32.bat
-
-Replace [VS_BIN] with the path to your Visual Studio `bin` directory.
-
-You must check that:
-
- * The `which link` command points to the Microsoft linker.
-
- * The `which cl` command points to the Microsoft compiler.
-
- * The `which mc` command points to the Microsoft message compiler.
-
- * The `which mt` command points to the Microsoft manifest tool.
-
-If you do not do this, the build may fail due to Cygwin ones found in `/usr/bin`
-being used instead.
-
-Building Erlang
----------------
-
-You must include Win32 OpenSSL.
-
-However, you can skip the GUI tools by running:
-
- echo "skipping gs" > lib/gs/SKIP
-
- echo "skipping ic" > lib/ic/SKIP
-
-Follow the rest of the Erlang instructions as described.
-
-After running:
-
- ./otp_build release -a
-
-You should run:
-
- ./release/win32/Install.exe
-
-This will set up the release/win32/bin directory correctly.
-
-To set up your environment for building CouchDB, run:
-
- eval `./otp_build env_win32`
-
-To set up the `ERL_TOP` environment variable, run:
-
- export ERL_TOP=[ERL_TOP]
-
-Replace `[ERL_TOP]` with the Erlang source directory name.
-
-Remember to use `/cygdrive/c/` instead of `c:/` as the directory prefix.
-
-To set up your path, run:
-
- export PATH=$ERL_TOP/release/win32/erts-5.8.2/bin:$PATH
-
-If everything was successful, you should be ready to build CouchDB.
-
-Relax.
-
-Building CouchDB
-----------------
-
-Once you have satisfied the dependencies you should run:
-
- ./configure \
- --with-js-include=/cygdrive/c/path_to_spidermonkey_include \
- --with-js-lib=/cygdrive/c/path_to_spidermonkey_lib \
- --with-win32-icu-binaries=/cygdrive/c/path_to_icu_binaries_root \
- --with-erlang=$ERL_TOP/release/win32/usr/include \
- --with-win32-curl=/cygdrive/c/path/to/curl/root/directory \
- --with-openssl-bin-dir=/cygdrive/c/openssl/bin \
- --with-msvc-redist-dir=/cygdrive/c/dir/with/vcredist_platform_executable \
- --prefix=$ERL_TOP/release/win32
-
-This command could take a while to complete.
-
-If everything was successful you should see the following message:
-
- You have configured Apache CouchDB, time to relax.
-
-Relax.
-
-To install CouchDB you should run:
-
- make install
-
-If everything was successful you should see the following message:
-
- You have installed Apache CouchDB, time to relax.
-
-Relax.
-
-First Run
----------
-
-You can start the CouchDB server by running:
-
- $ERL_TOP/release/win32/bin/couchdb.bat
-
-When CouchDB starts it should eventually display the following message:
-
- Apache CouchDB has started, time to relax.
-
-Relax.
-
-To check that everything has worked, point your web browser to:
-
- http://127.0.0.1:5984/_utils/index.html
-
-From here you should run the test suite in Firefox.
View
168 Makefile.am
@@ -1,168 +0,0 @@
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy of
-## the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations under
-## the License.
-
-SUBDIRS = bin etc src share test var utils
-
-ACLOCAL_AMFLAGS = -I m4
-
-localdoc_DATA = \
- AUTHORS.gz \
- BUGS.gz \
- CHANGES.gz \
- DEVELOPERS.gz \
- INSTALL.gz \
- INSTALL.Unix.gz \
- INSTALL.Windows.gz \
- LICENSE.gz \
- NEWS.gz \
- NOTICE.gz \
- README.gz \
- THANKS.gz
-
-DISTCLEANFILES = $(localdoc_DATA)
-
-EXTRA_DIST = \
- AUTHORS \
- BUGS \
- CHANGES \
- DEVELOPERS \
- INSTALL \
- INSTALL.Unix \
- INSTALL.Windows \
- LICENSE \
- NEWS \
- NOTICE \
- README \
- THANKS \
- license.skip
-
-AUTHORS.gz: $(top_srcdir)/AUTHORS
- -gzip -9 < $< > $@
-
-BUGS.gz: $(top_srcdir)/BUGS
- -gzip -9 < $< > $@
-
-CHANGES.gz: $(top_srcdir)/CHANGES
- -gzip -9 < $< > $@
-
-DEVELOPERS.gz: $(top_srcdir)/DEVELOPERS
- -gzip -9 < $< > $@
-
-INSTALL.gz: $(top_srcdir)/INSTALL
- -gzip -9 < $< > $@
-
-INSTALL.Unix.gz: $(top_srcdir)/INSTALL.Unix
- -gzip -9 < $< > $@
-
-INSTALL.Windows.gz: $(top_srcdir)/INSTALL.Windows
- -gzip -9 < $< > $@
-
-LICENSE.gz: $(top_srcdir)/LICENSE
- -gzip -9 < $< > $@
-
-NEWS.gz: $(top_srcdir)/NEWS
- -gzip -9 < $< > $@
-
-NOTICE.gz: $(top_srcdir)/NOTICE
- -gzip -9 < $< > $@
-
-README.gz: $(top_srcdir)/README
- -gzip -9 < $< > $@
-
-.PHONY: THANKS.gz
-THANKS.gz: $(top_srcdir)/THANKS
- @sed -e '/^#.*/d' $< > $(top_builddir)/THANKS.tmp
- @git shortlog -se 6c976bd..HEAD \
- | grep -v @apache.org \
- | sed -E 's/^[[:blank:]]{5}[[:digit:]]+[[:blank:]]/ * /' \
- >> $(top_builddir)/THANKS.tmp
- @echo '\nFor a list of authors see the `AUTHORS` file.\n' \
- >> $(top_builddir)/THANKS.tmp
- -gzip -9 < $(top_builddir)/THANKS.tmp > $@
- @rm $(top_builddir)/THANKS.tmp
-
-check: dev check-js
- $(top_builddir)/test/etap/run $(top_srcdir)/test/etap
-
-check-js: dev
-if USE_CURL
- $(top_builddir)/test/javascript/run
-endif
-
-check-etap: dev
- $(top_builddir)/test/etap/run $(top_srcdir)/test/etap
-
-cover: dev
- rm -f cover/*.coverdata
- COVER=1 COVER_BIN=./src/couchdb/ $(top_builddir)/test/etap/run
- SRC=./src/couchdb/ \
- $(ERL) -noshell \
- -pa src/etap \
- -eval 'etap_report:create()' \
- -s init stop > /dev/null 2>&1
-
-dev: all
- @echo "This command is intended for developers to use;"
- @echo "it creates development ini files as well as a"
- @echo "$(top_builddir)/tmp structure for development runtime files."
- @echo "Use ./utils/run to launch CouchDB from the source tree."
- mkdir -p $(top_builddir)/etc/couchdb/default.d
- mkdir -p $(top_builddir)/etc/couchdb/local.d
- mkdir -p $(top_builddir)/tmp/lib
- mkdir -p $(top_builddir)/tmp/log
- mkdir -p $(top_builddir)/tmp/run/couchdb
-
-install-data-hook:
- @echo
- @echo "You have installed Apache CouchDB, time to relax."
-
-distclean-local:
- rm -fr $(top_builddir)/etc/couchdb/default.d
- rm -fr $(top_builddir)/etc/couchdb/local.d
- rm -fr $(top_builddir)/tmp
- rm -f $(top_builddir)/couchdb.stdout
- rm -f $(top_builddir)/couchdb.stderr
-
-.PHONY: local-clean
-local-clean: maintainer-clean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may need special tools to rebuild."
- rm -f $(top_srcdir)/INSTALL
- rm -f $(top_srcdir)/acinclude.m4
- rm -f $(top_srcdir)/aclocal.m4
- rm -f $(top_srcdir)/config.h.in
- rm -f $(top_srcdir)/configure
- rm -f $(top_srcdir)/test/etap/temp.*
- rm -f $(top_srcdir)/*.tar.gz
- rm -f $(top_srcdir)/*.tar.gz.*
- find $(top_srcdir) -name Makefile.in -exec rm -f {} \;
-
-dist-hook:
- find $(top_srcdir) -type f -name "._*" -exec rm -f {} \;
- find $(top_builddir) -type f -name "._*" -exec rm -f {} \;
-
-distcheck-hook:
- grep -rL 'http://www.apache.org/licenses/LICENSE-2.0' * \
- | grep -vEf license.skip; \
- test "$$?" -eq 1
-
-.PHONY: distsign
-distsign: distcheck check
- @# @@ unpack archive and run diff -r to double check missing files
- @# @@ does automake have anything that does this?
- gpg --armor --detach-sig $(GPG_ARGS) \
- < $(top_srcdir)/$(distdir).tar.gz \
- > $(top_srcdir)/$(distdir).tar.gz.asc
- md5sum $(top_srcdir)/$(distdir).tar.gz \
- > $(top_srcdir)/$(distdir).tar.gz.md5
- sha1sum $(top_srcdir)/$(distdir).tar.gz \
- > $(top_srcdir)/$(distdir).tar.gz.sha
View
83 README
@@ -1,83 +0,0 @@
-Apache CouchDB README
-=====================
-
-Installation
-------------
-
-For a low-level guide, see:
-
- INSTALL
-
-For a high-level guide to Unix-like systems, inc. Mac OS X and Ubuntu, see:
-
- INSTALL.Unix
-
-For a high-level guide to Microsoft Windows, see:
-
- INSTALL.Windows
-
-Follow the proper instructions to get CouchDB installed on your system.
-
-If you're having problems, skip to the next section.
-
-Troubleshooting
-----------------
-
-For troubleshooting, see:
-
- http://wiki.apache.org/couchdb/Troubleshooting
-
-If you're getting a cryptic error message, see:
-
- http://wiki.apache.org/couchdb/Error_messages
-
-For general help, see:
-
- http://couchdb.apache.org/#mailing-list
-
-The mailing lists provide a wealth of support and knowledge for you to tap into.
-Feel free to drop by with your questions or discussion. See the official CouchDB
-website for more information about our community resources.
-
-Running the Testsuite
----------------------
-
-Run the testsuite for couch.js and jquery.couch.js by browsing here:
-
- http://127.0.0.1:5984/_utils/spec/run.html
-
-It should work in at least Firefox >= 3.6 with Private Browsing mode enabled.
-
-Read more about JSpec here:
-
- https://github.com/liblime/jspec
-
-When you change the specs, but your changes have no effect, manually reload
-the changed spec file in the browser. When the spec that tests Erlang views
-fails, make sure you have enabled Erlang views as described here:
-
- http://wiki.apache.org/couchdb/EnableErlangViews
-
-Cryptographic Software Notice
------------------------------
-
-This distribution includes cryptographic software. The country in which you
-currently reside may have restrictions on the import, possession, use, and/or
-re-export to another country, of encryption software. BEFORE using any
-encryption software, please check your country's laws, regulations and policies
-concerning the import, possession, or use, and re-export of encryption software,
-to see if this is permitted. See <http://www.wassenaar.org/> for more
-information.
-
-The U.S. Government Department of Commerce, Bureau of Industry and Security
-(BIS), has classified this software as Export Commodity Control Number (ECCN)
-5D002.C.1, which includes information security software using or performing
-cryptographic functions with asymmetric algorithms. The form and manner of this
-Apache Software Foundation distribution makes it eligible for export under the
-License Exception ENC Technology Software Unrestricted (TSU) exception (see the
-BIS Export Administration Regulations, Section 740.13) for both object code and
-source code.
-
-The following provides more details on the included cryptographic software:
-
-CouchDB includes a HTTP client (ibrowse) with SSL functionality.
View
97 README.md
@@ -0,0 +1,97 @@
+erlang-pbkdf2
+=============
+
+A [PBKDF2][] implementation for [Erlang][] extracted from [Apache CouchDB][].
+
+[PBKDF2]: http://en.wikipedia.org/wiki/PBKDF2
+[Erlang]: http://www.erlang.org
+[Apache CouchDB]: http://couchdb.apache.org
+
+
+Building
+--------
+
+`erlang-pbkdf2` uses [rebar][] to manage the build process. To build the project, run:
+
+ ./rebar compile
+
+You can then run the `xref` and `eunit` tests:
+
+ ./rebar xref eunit
+
+If you want to remove all generated files, run:
+
+ ./rebar clean
+
+[rebar]: https://github.com/rebar/rebar/wiki
+
+
+Usage
+-----
+
+```erlang
+OriginalPassword = <<"password">>.
+
+% Settings
+{Salt, Iterations, DerivedLength} = {<<"salt">>, 4096, 20}.
+
+% Hash the original password.
+{ok, Key} = pbkdf2:pbkdf2(OriginalPassword, Salt, Iterations, DerivedLength).
+
+% At this point, Key = <<"4b007901b765489abead49d926f721d065a429c1">>.
+
+% Get the password from the user.
+EnteredPassword = getpass().
+
+% Ensure that the entered password is the same as the original.
+{ok, Key} = pbkdf2:pbkdf2(EnteredPassword, Salt, Iterations, DerivedLength).
+```
+
+If you're curious what `getpass/0` would look like, here's a sample implementation:
+
+```erlang
+% Get the password from the user.
+getpass() ->
+ % Store current options for stdio.
+ InitialIOOpts = io:getopts(),
+ % Disable input character echo.
+ ok = io:setopts([{echo, false}]),
+ % Prompt the user for a password.
+ EnteredPassword = io:get_line("Password: "),
+ % Restore original options for stdio.
+ ok = io:setopts(InitialIOOpts),
+ % Print a newline, since we had local echo disabled above.
+ io:format("\n"),
+ % Remove trailing newline character, if present.
+ case lists:reverse(EnteredPassword) of
+ [$\n | Rest] ->
+ lists:reverse(Rest);
+ _ ->
+ EnteredPassword
+ end.
+```
+
+
+Cryptographic Software Notice
+-----------------------------
+
+This distribution includes cryptographic software. The country in which you
+currently reside may have restrictions on the import, possession, use, and/or
+re-export to another country, of encryption software. BEFORE using any
+encryption software, please check your country's laws, regulations and policies
+concerning the import, possession, or use, and re-export of encryption software,
+to see if this is permitted. See <http://www.wassenaar.org/> for more
+information.
+
+The U.S. Government Department of Commerce, Bureau of Industry and Security
+(BIS), has classified this software as Export Commodity Control Number (ECCN)
+5D002.C.1, which includes information security software using or performing
+cryptographic functions with asymmetric algorithms. The form and manner of this
+Apache Software Foundation distribution makes it eligible for export under the
+License Exception ENC Technology Software Unrestricted (TSU) exception (see the
+BIS Export Administration Regulations, Section 740.13) for both object code and
+source code.
+
+The following provides more details on the included cryptographic software:
+
+`erlang-pbkdf2` implements the PBKDF2 key derivation function.
View
30 acinclude.m4.in
@@ -1,30 +0,0 @@
-dnl Licensed under the Apache License, Version 2.0 (the "License"); you may not
-dnl use this file except in compliance with the License. dnl You may obtain a
-dnl copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-dnl WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-dnl License for the specific language governing permissions and limitations
-dnl under the License.
-
-m4_define([LOCAL_PACKAGE_AUTHOR_NAME], [The Apache Software Foundation])
-m4_define([LOCAL_PACKAGE_AUTHOR_ADDRESS], [dev@couchdb.apache.org])
-m4_define([LOCAL_PACKAGE_IDENTIFIER], [couchdb])
-m4_define([LOCAL_PACKAGE_TARNAME], [apache-couchdb])
-m4_define([LOCAL_PACKAGE_NAME], [Apache CouchDB])
-m4_define([LOCAL_BUG_URI], [https://issues.apache.org/jira/browse/COUCHDB])
-m4_define([LOCAL_VERSION_MAJOR], [1])
-m4_define([LOCAL_VERSION_MINOR], [3])
-m4_define([LOCAL_VERSION_REVISION], [0])
-m4_define([LOCAL_VERSION_STAGE], [a])
-m4_define([LOCAL_VERSION_RELEASE], [-%release%])
-m4_define([LOCAL_VERSION_PRIMARY],
- [LOCAL_VERSION_MAJOR.LOCAL_VERSION_MINOR.LOCAL_VERSION_REVISION])
-m4_define([LOCAL_VERSION_SECONDARY],
- [LOCAL_VERSION_STAGE[]LOCAL_VERSION_RELEASE])
-m4_define([LOCAL_VERSION],
- [LOCAL_VERSION_PRIMARY[]LOCAL_VERSION_SECONDARY])
-
View
125 bin/Makefile.am
@@ -1,125 +0,0 @@
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy of
-## the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations under
-## the License.
-
-if WINDOWS
-bin_SCRIPTS = couchdb.bat
-else
-bin_SCRIPTS = couchdb couch-config
-endif
-
-noinst_SCRIPTS = couchjs_dev couch-config_dev
-
-if HELP2MAN
-dist_man1_MANS = couchdb.1
-endif
-
-CLEANFILES = $(bin_SCRIPTS) $(dist_man1_MANS) $(noinst_SCRIPTS)
-
-transform = @program_transform_name@
-couchdb_command_name = `echo couchdb | sed '$(transform)'`
-couchjs_command_name = `echo couchjs | sed '$(transform)'`
-
-couchdb: couchdb.tpl
- sed -e "s|%ERL%|$(ERL)|g" \
- -e "s|%ICU_CONFIG%|$(ICU_CONFIG)|g" \
- -e "s|%bindir%|@bindir@|g" \
- -e "s|%localerlanglibdir%|@localerlanglibdir@|g" \
- -e "s|%defaultini%|default.ini|g" \
- -e "s|%localini%|local.ini|g" \
- -e "s|%localconfdir%|@localconfdir@|g" \
- -e "s|%localstatelogdir%|@localstatelogdir@|g" \
- -e "s|%localstatelibdir%|@localstatelibdir@|g" \
- -e "s|%localstatedir%|@localstatedir@|g" \
- -e "s|%bug_uri%|@bug_uri@|g" \
- -e "s|%package_author_address%|@package_author_address@|g" \
- -e "s|%package_author_name%|@package_author_name@|g" \
- -e "s|%package_name%|@package_name@|g" \
- -e "s|%version%|@version@|g" \
- -e "s|%couchdb_command_name%|$(couchdb_command_name)|g" > \
- $@ < $<
- chmod +x $@
-
-if !WINDOWS
-install-exec-hook:
- $(LN_S) -f "$(locallibbindir)/$(couchjs_command_name)" \
- "$(DESTDIR)$(bindir)/$(couchjs_command_name)"
-endif
-
-couchjs_dev:
- $(LN_S) -f "$(abs_top_builddir)/src/couchdb/priv/couchjs" "$@"
-
-couchdb.bat: couchdb.bat.tpl
- sed -e "s|%ICU_CONFIG%|$(ICU_CONFIG)|g" \
- -e "s|%version%|@version@|g" \
- $< > $@
-
-couch-config: couch-config.tpl
- sed -e "s|%ERL%|$(ERL)|g" \
- -e "s|%bindir%|@bindir@|g" \
- -e "s|%localerlanglibdir%|@localerlanglibdir@|g" \
- -e "s|%localconfdir%|@localconfdir@|g" \
- -e "s|%localdatadir%|$(localdatadir)|g" \
- -e "s|%localbuilddatadir%|$(localdatadir)|g" \
- -e "s|%localstatelogdir%|@localstatelogdir@|g" \
- -e "s|%localstatelibdir%|@localstatelibdir@|g" \
- -e "s|%localstatedir%|@localstatedir@|g" \
- -e "s|%localstaterundir%|@localstaterundir@|g" \
- -e "s|%couchlibdir%|@localerlanglibdir@/couch-%version%|g"\
- -e "s|%couchincludedir%|@localerlanglibdir@/include|g"\
- -e "s|%couchebindir%|@localerlanglibdir@/ebin|g"\
- -e "s|%couchprivlibdir%|@localerlanglibdir@/couch-%version%/priv/lib|g"\
- -e "s|%bug_uri%|@bug_uri@|g" \
- -e "s|%package_author_address%|@package_author_address@|g" \
- -e "s|%package_author_name%|@package_author_name@|g" \
- -e "s|%package_name%|@package_name@|g" \
- -e "s|%version%|@version@|g" \
- -e "s|%couchdb_command_name%|$(couchdb_command_name)|g" > \
- $@ < $<
- chmod +x $@
-
-couch-config_dev: couch-config.tpl
- sed -e "s|%ERL%|$(ERL)|g" \
- -e "s|%bindir%|$(abs_top_builddir)/bin|g" \
- -e "s|%localerlanglibdir%|$(abs_top_builddir)\/src\/couchdb|g" \
- -e "s|%couchlibdir%|$(abs_top_builddir)\/src\/couchdb|g"\
- -e "s|%couchincludedir%|$(abs_top_builddir)\/src\/couchdb|g"\
- -e "s|%couchebindir%|$(abs_top_builddir)\/src\/couchdb|g"\
- -e "s|%couchprivlibdir%|$(abs_top_builddir)/src/couchdb/priv/.libs|g"\
- -e "s|%localdatadir%|$(abs_top_srcdir)/share|g" \
- -e "s|%localbuilddatadir%|$(abs_top_builddir)/share|g" \
- -e "s|%localstatelibdir%|$(abs_top_builddir)/tmp/lib|g" \
- -e "s|%localstatelogdir%|$(abs_top_builddir)/tmp/log|g" \
- -e "s|%localstatedir%|$(abs_top_builddir)/tmp|g" \
- -e "s|%localstaterundir%|$(abs_top_builddir)/tmp/run|g" \
- -e "s|%bug_uri%|@bug_uri@|g" \
- -e "s|%package_author_address%|@package_author_address@|g" \
- -e "s|%package_author_name%|@package_author_name@|g" \
- -e "s|%package_name%|@package_name@|g" \
- -e "s|%version%|@version@|g" \
- -e "s|%couchdb_command_name%|$(abs_top_builddir)/utils/run|g" > \
- $@ < $<
- chmod +x $@
-
-
-HELP2MAN_OPTION=--no-info --help-option="-h" --version-option="-V"
-
-# XXX: Because the scripts are made at build time for the user we need to
-# XXX: depend on the original templates so as not to cause the rebuilding of
-# XXX: the man pages.
-
-couchdb.1: couchdb.tpl.in
- touch $@
- if test -x "$(HELP2MAN_EXECUTABLE)"; then \
- $(MAKE) -f Makefile couchdb; \
- $(HELP2MAN_EXECUTABLE) $(HELP2MAN_OPTION) \
- --name="Apache CouchDB database server" ./couchdb --output $@; \
- fi
View
130 bin/couch-config.tpl.in
@@ -1,130 +0,0 @@
-#! /bin/sh -e
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you
-# may not use this file except in compliance with the License. You may
-# obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-basename=`basename "$0"`
-
-staticdir="%localbuilddatadir%"
-erlanglibdir="%localerlanglibdir%"
-couchversion="%version%"
-dbdir="%localstatelibdir%"
-viewdir="%localstatelibdir%"
-confdir="%localconfdir%"
-urifile="%localstaterundir%/couch.uri"
-logdir="%localstatelogdir%"
-
-version () {
- cat << EOF
-$basename - %package_name% configuration helper %version%
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software distributed
-under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-CONDITIONS OF ANY KIND, either express or implied. See the License for the
-specific language governing permissions and limitations under the License.
-
-EOF
-}
-
-usage()
-{
- cat << EOF
-Usage: $basename [OPTION]
-
-The $basename command runs the %package_name% configuration helper
-script.
-
-Options:
-
- --erl-libs-dir Erlang library directory
- --config-dir configuration directory
- --db-dir database dirrectory
- --view-dir view index directory
- --static-dir static asset directory
- --doc-dir documentation directory
- --log-dir log directory
- --uri-file daemon sockets file
- --couch-version version of Apache CouchDB
- --version version of $basename
- --help Print usage
-
-If you want to add an option in couch-config or report bugs please do it
-at <%bug_uri%>.
-EOF
-}
-
-
-if [ $# -lt 1 ]; then
- usage
- exit 1
-fi
-
-
-while [ $# -gt 0 ];
-do
- arg="$1"
- var=`echo $arg | sed -e 's/^[^=]*=//'`
-
- case "$arg" in
- --erl-libs-dir)
- echo $erlanglibdir
- ;;
- --config-dir)
- echo $confdir
- ;;
- --db-dir)
- echo $dbdir
- ;;
- --view-dir)
- echo $viewdir
- ;;
- --static-dir)
- echo $staticdir
- ;;
- --doc-dir)
- echo $staticdir
- ;;
- --log-dir)
- echo $logdir
- ;;
- --uri-file)
- echo $urifile
- ;;
- --couch-version)
- echo $couchversion
- ;;
- --version)
- version
- exit 0
- ;;
- --help)
- usage
- exit 0
- ;;
- *|-*)
- echo $basename: ERROR Unknown Option $arg 1>&2
- echo 1>&2
- usage 1>&2
- echo "### $basename: Exitting." 1>&2
- exit 1;
- ;;
- esac
- shift
-done
-
-exit 0
View
26 bin/couchdb.bat.tpl.in
@@ -1,26 +0,0 @@
-@echo off
-rem Licensed under the Apache License, Version 2.0 (the "License"); you may not
-rem use this file except in compliance with the License. You may obtain a copy
-rem of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-rem WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-rem License for the specific language governing permissions and limitations
-rem under the License.
-
-setlocal
-rem First change to the drive with the erlang bin directory
-%~d0
-rem then change to the erlang bin directory
-cd %~dp0
-
-rem Allow a different erlang executable (eg, erl) to be used.
-rem When using erl instead of werl, server restarts during test runs can fail
-rem intermittently. But using erl should be fine for production use.
-if "%ERL%x" == "x" set ERL=werl.exe
-
-echo CouchDB %version% - prepare to relax...
-%ERL% -sasl errlog_type error -s couch +A 4 +W w
View
339 bin/couchdb.tpl.in
@@ -1,339 +0,0 @@
-#! /bin/sh -e
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-BACKGROUND=false
-DEFAULT_CONFIG_DIR=%localconfdir%/default.d
-DEFAULT_CONFIG_FILE=%localconfdir%/%defaultini%
-ERL_OS_MON_OPTIONS="-os_mon \
- start_memsup false \
- start_cpu_sup false \
- disk_space_check_interval 1 \
- disk_almost_full_threshold 1"
-ERL_START_OPTIONS="$ERL_OS_MON_OPTIONS -sasl errlog_type error +K true +A 4"
-HEART_BEAT_TIMEOUT=11
-HEART_COMMAND="%bindir%/%couchdb_command_name% -k"
-INTERACTIVE=false
-KILL=false
-LOCAL_CONFIG_DIR=%localconfdir%/local.d
-LOCAL_CONFIG_FILE=%localconfdir%/%localini%
-PID_FILE=%localstatedir%/run/couchdb/couchdb.pid
-RECURSED=false
-RESET_CONFIG=true
-RESPAWN_TIMEOUT=0
-SCRIPT_ERROR=1
-SCRIPT_OK=0
-SHUTDOWN=false
-STDERR_FILE=couchdb.stderr
-STDOUT_FILE=couchdb.stdout
-
-print_arguments=""
-start_arguments=""
-background_start_arguments=""
-
-basename=`basename $0`
-
-display_version () {
- cat << EOF
-$basename - %package_name% %version%
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software distributed
-under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-CONDITIONS OF ANY KIND, either express or implied. See the License for the
-specific language governing permissions and limitations under the License.
-
-EOF
-}
-
-display_help () {
- cat << EOF
-Usage: $basename [OPTION]
-
-The $basename command runs the %package_name% server.
-
-Erlang is called with:
-
- $ERL_START_OPTIONS
-
-Erlang inherits the environment of this command.
-
-You can override these options using the environment:
-
- ERL_AFLAGS, ERL_FLAGS, ERL_ZFLAGS
-
-See erl(1) for more information about the environment variables.
-
-The exit status is 0 for success or 1 for failure.
-
-Options:
-
- -h display a short help message and exit
- -V display version information and exit
- -a FILE add configuration FILE to chain
- -A DIR add configuration DIR to chain
- -n reset configuration file chain (including system default)
- -c print configuration file chain and exit
- -i use the interactive Erlang shell
- -b spawn as a background process
- -p FILE set the background PID FILE (overrides system default)
- -r SECONDS respawn background process after SECONDS (defaults to no respawn)
- -o FILE redirect background stdout to FILE (defaults to $STDOUT_FILE)
- -e FILE redirect background stderr to FILE (defaults to $STDERR_FILE)
- -s display the status of the background process
- -k kill the background process, will respawn if needed
- -d shutdown the background process
-
-Report bugs at <%bug_uri%>.
-EOF
-}
-
-display_error () {
- if test -n "$1"; then
- echo $1 >&2
- fi
- echo >&2
- echo "Try \`"$basename" -h' for more information." >&2
- false
-}
-
-_get_pid () {
- if test -f $PID_FILE; then
- PID=`cat $PID_FILE`
- fi
- echo $PID
-}
-
-_add_config_file () {
- if test -z "$print_arguments"; then
- print_arguments="$1"
- else
- print_arguments="`cat <<EOF
-$print_arguments
-$1
-EOF
-`"
- fi
- start_arguments="$start_arguments $1"
- background_start_arguments="$background_start_arguments -a $1"
-}
-
-_add_config_dir () {
- for file in "$1"/*.ini; do
- if [ -r "$file" ]; then
- _add_config_file "$file"
- fi
- done
-}
-
-_load_config () {
- _add_config_file "$DEFAULT_CONFIG_FILE"
- _add_config_dir "$DEFAULT_CONFIG_DIR"
- _add_config_file "$LOCAL_CONFIG_FILE"
- _add_config_dir "$LOCAL_CONFIG_DIR"
- if [ "$COUCHDB_ADDITIONAL_CONFIG_FILE" != '' ]
- then
- _add_config_file "$COUCHDB_ADDITIONAL_CONFIG_FILE"
- fi
-}
-
-_reset_config () {
- print_arguments=""
- start_arguments=""
- background_start_arguments="-n"
-}
-
-_print_config () {
- cat <<EOF
-$print_arguments
-EOF
-}
-
-check_status () {
- PID=`_get_pid`
- if test -n "$PID"; then
- if kill -0 $PID 2> /dev/null; then
- echo "Apache CouchDB is running as process $PID, time to relax."
- return $SCRIPT_OK
- else
- echo >&2 << EOF
-Apache CouchDB is not running but a stale PID file exists: $PID_FILE
-EOF
- fi
- else
- echo "Apache CouchDB is not running." >&2
- fi
- return $SCRIPT_ERROR
-}
-
-check_environment () {
- if test "$BACKGROUND" != "true"; then
- return
- fi
- touch $PID_FILE 2> /dev/null || true
- touch $STDOUT_FILE 2> /dev/null || true
- touch $STDERR_FILE 2> /dev/null || true
- message_prefix="Apache CouchDB needs write permission on the"
- if test ! -w $PID_FILE; then
- echo "$message_prefix PID file: $PID_FILE" >&2
- false
- fi
- if test ! -w $STDOUT_FILE; then
- echo "$message_prefix STDOUT file: $STDOUT_FILE" >&2
- false
- fi
- if test ! -w $STDERR_FILE; then
- echo "$message_prefix STDERR file: $STDERR_FILE" >&2
- false
- fi
- message_prefix="Apache CouchDB needs a regular"
- if test `echo 2> /dev/null >> $PID_FILE; echo $?` -gt 0; then
- echo "$message_prefix PID file: $PID_FILE" >&2
- false
- fi
- if test `echo 2> /dev/null >> $STDOUT_FILE; echo $?` -gt 0; then
- echo "$message_prefix STDOUT file: $STDOUT_FILE" >&2
- false
- fi
- if test `echo 2> /dev/null >> $STDERR_FILE; echo $?` -gt 0; then
- echo "$message_prefix STDERR file: $STDERR_FILE" >&2
- false
- fi
-}
-
-start_couchdb () {
- if test ! "$RECURSED" = "true"; then
- if check_status 2> /dev/null; then
- exit
- fi
- check_environment
- fi
- interactive_option="+Bd -noinput"
- if test "$INTERACTIVE" = "true"; then
- interactive_option=""
- fi
- if test "$BACKGROUND" = "true"; then
- touch $PID_FILE
- interactive_option="+Bd -noinput"
- fi
- command="%ERL% $interactive_option $ERL_START_OPTIONS \
- -env ERL_LIBS $ERL_LIBS:%localerlanglibdir% -couch_ini $start_arguments -s couch"
- if test "$BACKGROUND" = "true" -a "$RECURSED" = "false"; then
- $0 $background_start_arguments -b -r $RESPAWN_TIMEOUT -p $PID_FILE \
- -o $STDOUT_FILE -e $STDERR_FILE -R &
- echo "Apache CouchDB has started, time to relax."
- else
- if test "$RECURSED" = "true"; then