summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile.am128
-rw-r--r--etc/conf/mime.types462
-rw-r--r--etc/couch.ini.tpl.in19
-rw-r--r--etc/couch_httpd.conf.tpl.in11
-rw-r--r--etc/default/Makefile.am13
-rw-r--r--etc/default/couchdb.tpl.in10
-rw-r--r--etc/init/Makefile.am13
-rwxr-xr-xetc/init/couchdb.tpl.in174
-rw-r--r--etc/launchd/Makefile.am13
-rw-r--r--etc/launchd/org.apache.couchdb.plist.tpl.in29
-rw-r--r--etc/logrotate.d/Makefile.am13
-rw-r--r--etc/logrotate.d/couchdb.tpl.in9
12 files changed, 894 insertions, 0 deletions
diff --git a/etc/Makefile.am b/etc/Makefile.am
new file mode 100644
index 00000000..5ee51393
--- /dev/null
+++ b/etc/Makefile.am
@@ -0,0 +1,128 @@
+## 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.
+
+datarootdir = @prefix@/share
+
+couchprivlibdir = $(erlanglibdir)/couch-$(version)/priv/lib
+
+SUBDIRS = default init launchd logrotate.d
+
+default_sysconf_data = logrotate.d/couchdb.dist
+
+pkgconf_DATA = couch.ini.dist couch_httpd.conf.dist
+
+nobase_dist_pkgconf_DATA = conf/mime.types
+
+if INIT
+init_sysconf_data = default/couchdb.dist
+init_DATA = init/couchdb.dist
+endif
+
+if LAUNCHD
+launchd_DATA = launchd/org.apache.couchdb.plist.dist
+endif
+
+nobase_sysconf_DATA = $(default_sysconf_data) $(init_sysconf_data)
+
+CLEANFILES = $(init_DATA) $(nobase_sysconf_DATA) $(launchd_DATA) $(pkgconf_DATA)
+
+transform = @program_transform_name@
+couchdb_command_name = `echo couchdb | sed '$(transform)'`
+couchjs_command_name = `echo couchjs | sed '$(transform)'`
+
+couch.ini.dist: couch.ini.tpl
+ sed -e "s|%bindir%|@bindir@|g" \
+ -e "s|%pkgconfdir%|@pkgconfdir@|g" \
+ -e "s|%pkgdatadir%|@pkgdatadir@|g" \
+ -e "s|%pkgstatelibdir%|@pkgstatelibdir@|g" \
+ -e "s|%pkgstatelogdir%|@pkgstatelogdir@|g" \
+ -e "s|%couchprivlibdir%|$(couchprivlibdir)|g" \
+ -e "s|%couchjs_command_name%|$(couchjs_command_name)|g" \
+ < $< > $@
+
+couch_httpd.conf.dist: couch_httpd.conf.tpl
+ sed -e "s|%pkgconfdir%|@pkgconfdir@|g" \
+ -e "s|%pkgdatadir%|@pkgdatadir@|g" \
+ -e "s|%pkgstatelogdir%|@pkgstatelogdir@|g" \
+ < $< > $@
+
+default/couchdb.dist: default/couchdb.tpl
+ if test "$(mkdir_p)"; then \
+ $(mkdir_p) default; \
+ else \
+ if test ! -d default; then \
+ mkdir default; \
+ fi \
+ fi
+ sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \
+ -e "s|%pkgconfdir%|@pkgconfdir@|g" \
+ -e "s|%sysconfdir%|@sysconfdir@|" \
+ -e "s|%localstatedir%|@localstatedir@|" \
+ < $< > $@
+
+init/couchdb.dist: init/couchdb.tpl
+ if test "$(mkdir_p)"; then \
+ $(mkdir_p) init; \
+ else \
+ if test ! -d init; then \
+ mkdir init; \
+ fi \
+ fi
+ sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \
+ -e "s|%bindir%|@bindir@|" \
+ -e "s|%sysconfdir%|@sysconfdir@|" \
+ -e "s|%erlangbindir%|@erlangbindir@|" \
+ -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \
+ < $< > $@
+
+logrotate.d/couchdb.dist: logrotate.d/couchdb.tpl
+ sed -e "s|%pkgstatelogdir%|@pkgstatelogdir@|g" < $< > $@
+
+launchd/org.apache.couchdb.plist.dist: launchd/org.apache.couchdb.plist.tpl
+ if test "$(mkdir_p)"; then \
+ $(mkdir_p) launchd; \
+ else \
+ if test ! -d launchd; then \
+ mkdir launchd; \
+ fi \
+ fi
+ sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \
+ -e "s|%bindir%|@bindir@|" \
+ -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \
+ < $< > $@
+
+install-data-hook:
+ if test $(init_DATA); then \
+ chmod 755 "$(DESTDIR)$(initdir)/couchdb"; \
+ mv -i "$(DESTDIR)$(sysconfdir)/default/couchdb.dist" \
+ "$(DESTDIR)$(sysconfdir)/default/couchdb"; \
+ mv -i "$(DESTDIR)$(initdir)/couchdb.dist" \
+ "$(DESTDIR)$(initdir)/couchdb"; \
+ fi
+ if test $(launchd_DATA); then \
+ mv -i "$(DESTDIR)$(launchddir)/org.apache.couchdb.plist.dist" \
+ "$(DESTDIR)$(launchddir)/org.apache.couchdb.plist"; \
+ fi
+ mv -i "$(DESTDIR)/$(sysconfdir)/logrotate.d/couchdb.dist" \
+ "$(DESTDIR)/$(sysconfdir)/logrotate.d/couchdb"
+ mv -i "$(DESTDIR)/$(pkgconfdir)/couch.ini.dist" \
+ "$(DESTDIR)/$(pkgconfdir)/couch.ini"
+ mv -i "$(DESTDIR)/$(pkgconfdir)/couch_httpd.conf.dist" \
+ "$(DESTDIR)/$(pkgconfdir)/couch_httpd.conf"
+
+uninstall-hook:
+ rm -f $(DESTDIR)$(initdir)/couchdb
+ rm -f $(DESTDIR)$(launchddir)/org.apache.couchdb.plist
+ rm -f $(DESTDIR)$(sysconfdir)/default/couchdb
+ rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/couchdb
+ rm -f $(DESTDIR)/$(pkgconfdir)/couch.ini
+ rm -f $(DESTDIR)/$(pkgconfdir)/couch_httpd.conf
diff --git a/etc/conf/mime.types b/etc/conf/mime.types
new file mode 100644
index 00000000..9a08ba23
--- /dev/null
+++ b/etc/conf/mime.types
@@ -0,0 +1,462 @@
+# This is a comment. I love comments.
+
+# MIME type Extension
+application/EDI-Consent
+application/EDI-X12
+application/EDIFACT
+application/activemessage
+application/andrew-inset ez
+application/applefile
+application/atomicmail
+application/batch-SMTP
+application/beep+xml
+application/cals-1840
+application/commonground
+application/cybercash
+application/dca-rft
+application/dec-dx
+application/dvcs
+application/eshop
+application/http
+application/hyperstudio
+application/iges
+application/index
+application/index.cmd
+application/index.obj
+application/index.response
+application/index.vnd
+application/iotp
+application/ipp
+application/isup
+application/font-tdpfr
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+application/macwriteii
+application/marc
+application/mathematica
+application/mathematica-old
+application/msword doc
+application/news-message-id
+application/news-transmission
+application/ocsp-request
+application/ocsp-response
+application/octet-stream bin dms lha lzh exe class so dll
+application/oda oda
+application/parityfec
+application/pdf pdf
+application/pgp-encrypted
+application/pgp-keys
+application/pgp-signature
+application/pkcs10
+application/pkcs7-mime
+application/pkcs7-signature
+application/pkix-cert
+application/pkix-crl
+application/pkixcmp
+application/postscript ai eps ps
+application/prs.alvestrand.titrax-sheet
+application/prs.cww
+application/prs.nprend
+application/qsig
+application/remote-printing
+application/riscos
+application/rtf
+application/sdp
+application/set-payment
+application/set-payment-initiation
+application/set-registration
+application/set-registration-initiation
+application/sgml
+application/sgml-open-catalog
+application/sieve
+application/slate
+application/smil smi smil
+application/timestamp-query
+application/timestamp-reply
+application/vemmi
+application/vnd.3M.Post-it-Notes
+application/vnd.FloGraphIt
+application/vnd.accpac.simply.aso
+application/vnd.accpac.simply.imp
+application/vnd.acucobol
+application/vnd.aether.imp
+application/vnd.anser-web-certificate-issue-initiation
+application/vnd.anser-web-funds-transfer-initiation
+application/vnd.audiograph
+application/vnd.businessobjects
+application/vnd.bmi
+application/vnd.canon-cpdl
+application/vnd.canon-lips
+application/vnd.claymore
+application/vnd.commerce-battelle
+application/vnd.commonspace
+application/vnd.comsocaller
+application/vnd.contact.cmsg
+application/vnd.cosmocaller
+application/vnd.cups-postscript
+application/vnd.cups-raster
+application/vnd.cups-raw
+application/vnd.ctc-posml
+application/vnd.cybank
+application/vnd.dna
+application/vnd.dpgraph
+application/vnd.dxr
+application/vnd.ecdis-update
+application/vnd.ecowin.chart
+application/vnd.ecowin.filerequest
+application/vnd.ecowin.fileupdate
+application/vnd.ecowin.series
+application/vnd.ecowin.seriesrequest
+application/vnd.ecowin.seriesupdate
+application/vnd.enliven
+application/vnd.epson.esf
+application/vnd.epson.msf
+application/vnd.epson.quickanime
+application/vnd.epson.salt
+application/vnd.epson.ssf
+application/vnd.ericsson.quickcall
+application/vnd.eudora.data
+application/vnd.fdf
+application/vnd.ffsns
+application/vnd.framemaker
+application/vnd.fsc.weblaunch
+application/vnd.fujitsu.oasys
+application/vnd.fujitsu.oasys2
+application/vnd.fujitsu.oasys3
+application/vnd.fujitsu.oasysgp
+application/vnd.fujitsu.oasysprs
+application/vnd.fujixerox.ddd
+application/vnd.fujixerox.docuworks
+application/vnd.fujixerox.docuworks.binder
+application/vnd.fut-misnet
+application/vnd.grafeq
+application/vnd.groove-account
+application/vnd.groove-identity-message
+application/vnd.groove-injector
+application/vnd.groove-tool-message
+application/vnd.groove-tool-template
+application/vnd.groove-vcard
+application/vnd.hhe.lesson-player
+application/vnd.hp-HPGL
+application/vnd.hp-PCL
+application/vnd.hp-PCLXL
+application/vnd.hp-hpid
+application/vnd.hp-hps
+application/vnd.httphone
+application/vnd.hzn-3d-crossword
+application/vnd.ibm.afplinedata
+application/vnd.ibm.MiniPay
+application/vnd.ibm.modcap
+application/vnd.informix-visionary
+application/vnd.intercon.formnet
+application/vnd.intertrust.digibox
+application/vnd.intertrust.nncp
+application/vnd.intu.qbo
+application/vnd.intu.qfx
+application/vnd.irepository.package+xml
+application/vnd.is-xpr
+application/vnd.japannet-directory-service
+application/vnd.japannet-jpnstore-wakeup
+application/vnd.japannet-payment-wakeup
+application/vnd.japannet-registration
+application/vnd.japannet-registration-wakeup
+application/vnd.japannet-setstore-wakeup
+application/vnd.japannet-verification
+application/vnd.japannet-verification-wakeup
+application/vnd.koan
+application/vnd.lotus-1-2-3
+application/vnd.lotus-approach
+application/vnd.lotus-freelance
+application/vnd.lotus-notes
+application/vnd.lotus-organizer
+application/vnd.lotus-screencam
+application/vnd.lotus-wordpro
+application/vnd.mcd
+application/vnd.mediastation.cdkey
+application/vnd.meridian-slingshot
+application/vnd.mif mif
+application/vnd.minisoft-hp3000-save
+application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf
+application/vnd.mobius.dis
+application/vnd.mobius.msl
+application/vnd.mobius.plc
+application/vnd.mobius.txf
+application/vnd.motorola.flexsuite
+application/vnd.motorola.flexsuite.adsi
+application/vnd.motorola.flexsuite.fis
+application/vnd.motorola.flexsuite.gotap
+application/vnd.motorola.flexsuite.kmr
+application/vnd.motorola.flexsuite.ttc
+application/vnd.motorola.flexsuite.wem
+application/vnd.mozilla.xul+xml
+application/vnd.ms-artgalry
+application/vnd.ms-asf
+application/vnd.ms-excel xls
+application/vnd.ms-lrm
+application/vnd.ms-powerpoint ppt
+application/vnd.ms-project
+application/vnd.ms-tnef
+application/vnd.ms-works
+application/vnd.mseq
+application/vnd.msign
+application/vnd.music-niff
+application/vnd.musician
+application/vnd.netfpx
+application/vnd.noblenet-directory
+application/vnd.noblenet-sealer
+application/vnd.noblenet-web
+application/vnd.novadigm.EDM
+application/vnd.novadigm.EDX
+application/vnd.novadigm.EXT
+application/vnd.osa.netdeploy
+application/vnd.palm
+application/vnd.pg.format
+application/vnd.pg.osasli
+application/vnd.powerbuilder6
+application/vnd.powerbuilder6-s
+application/vnd.powerbuilder7
+application/vnd.powerbuilder7-s
+application/vnd.powerbuilder75
+application/vnd.powerbuilder75-s
+application/vnd.previewsystems.box
+application/vnd.publishare-delta-tree
+application/vnd.pvi.ptid1
+application/vnd.pwg-xhtml-print+xml
+application/vnd.rapid
+application/vnd.s3sms
+application/vnd.seemail
+application/vnd.shana.informed.formdata
+application/vnd.shana.informed.formtemplate
+application/vnd.shana.informed.interchange
+application/vnd.shana.informed.package
+application/vnd.sss-cod
+application/vnd.sss-dtf
+application/vnd.sss-ntf
+application/vnd.street-stream
+application/vnd.svd
+application/vnd.swiftview-ics
+application/vnd.triscape.mxs
+application/vnd.trueapp
+application/vnd.truedoc
+application/vnd.tve-trigger
+application/vnd.ufdl
+application/vnd.uplanet.alert
+application/vnd.uplanet.alert-wbxml
+application/vnd.uplanet.bearer-choice-wbxml
+application/vnd.uplanet.bearer-choice
+application/vnd.uplanet.cacheop
+application/vnd.uplanet.cacheop-wbxml
+application/vnd.uplanet.channel
+application/vnd.uplanet.channel-wbxml
+application/vnd.uplanet.list
+application/vnd.uplanet.list-wbxml
+application/vnd.uplanet.listcmd
+application/vnd.uplanet.listcmd-wbxml
+application/vnd.uplanet.signal
+application/vnd.vcx
+application/vnd.vectorworks
+application/vnd.vidsoft.vidconference
+application/vnd.visio
+application/vnd.vividence.scriptfile
+application/vnd.wap.sic
+application/vnd.wap.slc
+application/vnd.wap.wbxml wbxml
+application/vnd.wap.wmlc wmlc
+application/vnd.wap.wmlscriptc wmlsc
+application/vnd.webturbo
+application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf
+application/vnd.xara
+application/vnd.xfdl
+application/vnd.yellowriver-custom-menu
+application/whoispp-query
+application/whoispp-response
+application/wita
+application/wordperfect5.1
+application/x-bcpio bcpio
+application/x-cdlink vcd
+application/x-chess-pgn pgn
+application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-director dcr dir dxr
+application/x-dvi dvi
+application/x-futuresplash spl
+application/x-gtar gtar
+application/x-gzip
+application/x-hdf hdf
+application/x-javascript js
+application/x-koan skp skd skt skm
+application/x-latex latex
+application/x-netcdf nc cdf
+application/x-sh sh
+application/x-shar shar
+application/x-shockwave-flash swf
+application/x-stuffit sit
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-troff t tr roff
+application/x-troff-man man
+application/x-troff-me me
+application/x-troff-ms ms
+application/x-ustar ustar
+application/x-wais-source src
+application/x400-bp
+application/xml
+application/xml-dtd
+application/xml-external-parsed-entity
+application/zip zip
+audio/32kadpcm
+audio/basic au snd
+audio/g.722.1
+audio/l16
+audio/midi mid midi kar
+audio/mp4a-latm
+audio/mpa-robust
+audio/mpeg mpga mp2 mp3
+audio/parityfec
+audio/prs.sid
+audio/telephone-event
+audio/tone
+audio/vnd.cisco.nse
+audio/vnd.cns.anp1
+audio/vnd.cns.inf1
+audio/vnd.digital-winds
+audio/vnd.everad.plj
+audio/vnd.lucent.voice
+audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800
+audio/vnd.nuera.ecelp7470
+audio/vnd.nuera.ecelp9600
+audio/vnd.octel.sbc
+audio/vnd.qcelp
+audio/vnd.rhetorex.32kadpcm
+audio/vnd.vmx.cvsd
+audio/x-aiff aif aiff aifc
+audio/x-mpegurl m3u
+audio/x-pn-realaudio ram rm
+audio/x-pn-realaudio-plugin rpm
+audio/x-realaudio ra
+audio/x-wav wav
+chemical/x-pdb pdb
+chemical/x-xyz xyz
+image/bmp bmp
+image/cgm
+image/g3fax
+image/gif gif
+image/ief ief
+image/jpeg jpeg jpg jpe
+image/naplps
+image/png png
+image/prs.btif
+image/prs.pti
+image/tiff tiff tif
+image/vnd.cns.inf2
+image/vnd.dwg
+image/vnd.dxf
+image/vnd.fastbidsheet
+image/vnd.fpx
+image/vnd.fst
+image/vnd.fujixerox.edmics-mmr
+image/vnd.fujixerox.edmics-rlc
+image/vnd.mix
+image/vnd.net-fpx
+image/vnd.svf
+image/vnd.wap.wbmp wbmp
+image/vnd.xiff
+image/x-cmu-raster ras
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+message/delivery-status
+message/disposition-notification
+message/external-body
+message/http
+message/news
+message/partial
+message/rfc822
+message/s-http
+model/iges igs iges
+model/mesh msh mesh silo
+model/vnd.dwf
+model/vnd.flatland.3dml
+model/vnd.gdl
+model/vnd.gs-gdl
+model/vnd.gtw
+model/vnd.mts
+model/vnd.vtu
+model/vrml wrl vrml
+multipart/alternative
+multipart/appledouble
+multipart/byteranges
+multipart/digest
+multipart/encrypted
+multipart/form-data
+multipart/header-set
+multipart/mixed
+multipart/parallel
+multipart/related
+multipart/report
+multipart/signed
+multipart/voice-message
+text/calendar
+text/css css
+text/directory
+text/enriched
+text/html html htm
+text/parityfec
+text/plain asc txt
+text/prs.lines.tag
+text/rfc822-headers
+text/richtext rtx
+text/rtf rtf
+text/sgml sgml sgm
+text/tab-separated-values tsv
+text/t140
+text/uri-list
+text/vnd.DMClientScript
+text/vnd.IPTC.NITF
+text/vnd.IPTC.NewsML
+text/vnd.abc
+text/vnd.curl
+text/vnd.flatland.3dml
+text/vnd.fly
+text/vnd.fmi.flexstor
+text/vnd.in3d.3dml
+text/vnd.in3d.spot
+text/vnd.latex-z
+text/vnd.motorola.reflex
+text/vnd.ms-mediapackage
+text/vnd.wap.si
+text/vnd.wap.sl
+text/vnd.wap.wml wml
+text/vnd.wap.wmlscript wmls
+text/x-setext etx
+text/x-server-parsed-html shtml
+text/xml xml xsl
+text/xml-external-parsed-entity
+video/mp4v-es
+video/mpeg mpeg mpg mpe
+video/parityfec
+video/pointer
+video/quicktime qt mov
+video/vnd.fvt
+video/vnd.motorola.video
+video/vnd.motorola.videop
+video/vnd.mpegurl mxu
+video/vnd.mts
+video/vnd.nokia.interleaved-multimedia
+video/vnd.vivo
+video/x-msvideo avi
+video/x-sgi-movie movie
+x-conference/x-cooltalk ice
diff --git a/etc/couch.ini.tpl.in b/etc/couch.ini.tpl.in
new file mode 100644
index 00000000..81b47f7f
--- /dev/null
+++ b/etc/couch.ini.tpl.in
@@ -0,0 +1,19 @@
+; @configure_input@
+
+[Couch]
+
+ConsoleStartupMsg=Apache CouchDB is starting.
+
+DbRootDir=%pkgstatelibdir%
+
+LogFile=%pkgstatelogdir%/couch.log
+
+HttpConfigFile=%pkgconfdir%/couch_httpd.conf
+
+UtilDriverDir=%couchprivlibdir%
+
+LogLevel=info
+
+[Couch Query Servers]
+
+text/javascript=%bindir%/%couchjs_command_name% %pkgdatadir%/server/main.js
diff --git a/etc/couch_httpd.conf.tpl.in b/etc/couch_httpd.conf.tpl.in
new file mode 100644
index 00000000..e4d27493
--- /dev/null
+++ b/etc/couch_httpd.conf.tpl.in
@@ -0,0 +1,11 @@
+# @configure_input@
+
+Port 5984
+#BindAddress 127.0.0.1
+ServerName localhost
+SocketType ip_comm
+Modules mod_couch mod_get mod_log
+ServerRoot %pkgconfdir%
+DocumentRoot %pkgdatadir%/www
+ErrorLog %pkgstatelogdir%/http_error.log
+TransferLog %pkgstatelogdir%/http_access.log
diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am
new file mode 100644
index 00000000..4953462c
--- /dev/null
+++ b/etc/default/Makefile.am
@@ -0,0 +1,13 @@
+## 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.
+
+## This file intentionally left blank.
diff --git a/etc/default/couchdb.tpl.in b/etc/default/couchdb.tpl.in
new file mode 100644
index 00000000..fadef1a7
--- /dev/null
+++ b/etc/default/couchdb.tpl.in
@@ -0,0 +1,10 @@
+# @configure_input@
+
+# Sourced by init script for configuration.
+
+COUCHDB_USER=couchdb
+COUCHDB_INI_FILE=%pkgconfdir%/couch.ini
+COUCHDB_PID_FILE=%localstatedir%/run/couchdb.pid
+COUCHDB_STDOUT_FILE=/dev/null
+COUCHDB_STDERR_FILE=/dev/null
+COUCHDB_RESPAWN_TIMEOUT=5
diff --git a/etc/init/Makefile.am b/etc/init/Makefile.am
new file mode 100644
index 00000000..4953462c
--- /dev/null
+++ b/etc/init/Makefile.am
@@ -0,0 +1,13 @@
+## 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.
+
+## This file intentionally left blank.
diff --git a/etc/init/couchdb.tpl.in b/etc/init/couchdb.tpl.in
new file mode 100755
index 00000000..fbeafa08
--- /dev/null
+++ b/etc/init/couchdb.tpl.in
@@ -0,0 +1,174 @@
+#!/bin/sh -e
+
+# @configure_input@
+
+# 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.
+
+### BEGIN INIT INFO
+# Provides: couchdb
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Apache CouchDB init script
+# Description: Apache CouchDB init script for the database server.
+### END INIT INFO
+
+SCRIPT_OK=0
+SCRIPT_ERROR=1
+
+DESCRIPTION="database server"
+NAME=couchdb
+SCRIPT_NAME=$(basename $0)
+COUCHDB=%bindir%/%couchdb_command_name%
+CONFIGURATION_FILE=%sysconfdir%/default/couchdb
+LSB_LIBRARY=/lib/lsb/init-functions
+
+if test ! -x $COUCHDB; then
+ exit $SCRIPT_ERROR
+fi
+
+if test -r $CONFIGURATION_FILE; then
+ . $CONFIGURATION_FILE
+fi
+
+log_daemon_msg () {
+ # Dummy function to be replaced by LSB library.
+
+ echo $@
+}
+
+log_end_msg () {
+ # Dummy function to be replaced by LSB library.
+
+ if test "$1" != "0"; then
+ echo "Error with $DESCRIPTION: $NAME"
+ fi
+ return $1
+}
+
+if test -r $LSB_LIBRARY; then
+ . $LSB_LIBRARY
+fi
+
+start_couchdb () {
+ # Start Apache CouchDB as a background process.
+
+ command="$COUCHDB -b"
+ if test -n "$COUCHDB_INI_FILE"; then
+ command="$command -c $COUCHDB_INI_FILE"
+ fi
+ if test -n "$COUCHDB_PID_FILE"; then
+ command="$command -p $COUCHDB_PID_FILE"
+ fi
+ if test -n "$COUCHDB_STDOUT_FILE"; then
+ command="$command -o $COUCHDB_STDOUT_FILE"
+ fi
+ if test -n "$COUCHDB_STDERR_FILE"; then
+ command="$command -e $COUCHDB_STDERR_FILE"
+ fi
+ if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
+ command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
+ fi
+ if test -n "$COUCHDB_USER"; then
+ if test -n "$COUCHDB_PID_FILE"; then
+ touch $COUCHDB_PID_FILE
+ chown $COUCHDB_USER $COUCHDB_PID_FILE
+ fi
+ if su $COUCHDB_USER -c "$command" > /dev/null; then
+ return $SCRIPT_OK
+ else
+ return $SCRIPT_ERROR
+ fi
+ else
+ if $command > /dev/null; then
+ return $SCRIPT_OK
+ else
+ return $SCRIPT_ERROR
+ fi
+ fi
+}
+
+stop_couchdb () {
+ # Stop the running Apache CouchDB process.
+
+ command="$COUCHDB -d"
+ if test -n "$COUCHDB_PID_FILE"; then
+ command="$command -p $COUCHDB_PID_FILE"
+ fi
+ if test -n "$COUCHDB_USER"; then
+ if su $COUCHDB_USER -c "$command" > /dev/null; then
+ return $SCRIPT_OK
+ else
+ return $SCRIPT_ERROR
+ fi
+ else
+ if $command > /dev/null; then
+ return $SCRIPT_OK
+ else
+ return $SCRIPT_ERROR
+ fi
+ fi
+}
+
+display_status () {
+ # Display the status of the running Apache CouchDB process.
+
+ $COUCHDB -s
+}
+
+parse_script_option_list () {
+ # Parse arguments passed to the script and take appropriate action.
+
+ case "$1" in
+ start)
+ log_daemon_msg "Starting $DESCRIPTION" $NAME
+ if start_couchdb; then
+ log_end_msg $SCRIPT_OK
+ else
+ log_end_msg $SCRIPT_ERROR
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESCRIPTION" $NAME
+ if stop_couchdb; then
+ log_end_msg $SCRIPT_OK
+ else
+ log_end_msg $SCRIPT_ERROR
+ fi
+ ;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESCRIPTION" $NAME
+ if stop_couchdb; then
+ if start_couchdb; then
+ log_end_msg $SCRIPT_OK
+ else
+ log_end_msg $SCRIPT_ERROR
+ fi
+ else
+ log_end_msg $SCRIPT_ERROR
+ fi
+ ;;
+ status)
+ display_status
+ ;;
+ *)
+ cat << EOF >&2
+Usage: $SCRIPT_NAME {start|stop|restart|force-reload|status}
+EOF
+ exit $SCRIPT_ERROR
+ ;;
+ esac
+}
+
+parse_script_option_list $@
diff --git a/etc/launchd/Makefile.am b/etc/launchd/Makefile.am
new file mode 100644
index 00000000..4953462c
--- /dev/null
+++ b/etc/launchd/Makefile.am
@@ -0,0 +1,13 @@
+## 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.
+
+## This file intentionally left blank.
diff --git a/etc/launchd/org.apache.couchdb.plist.tpl.in b/etc/launchd/org.apache.couchdb.plist.tpl.in
new file mode 100644
index 00000000..ac0c89fd
--- /dev/null
+++ b/etc/launchd/org.apache.couchdb.plist.tpl.in
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!-- @configure_input@ -->
+<plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>org.apache.couchdb</string>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>HOME</key>
+ <string>~</string>
+ <key>DYLD_LIBRARY_PATH</key>
+ <string>/opt/local/lib:$DYLD_LIBRARY_PATH</string>
+ </dict>
+ <key>ProgramArguments</key>
+ <array>
+ <string>%bindir%/%couchdb_command_name%</string>
+ </array>
+ <key>UserName</key>
+ <string>couchdb</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>OnDemand</key>
+ <false/>
+ </dict>
+</plist>
diff --git a/etc/logrotate.d/Makefile.am b/etc/logrotate.d/Makefile.am
new file mode 100644
index 00000000..4953462c
--- /dev/null
+++ b/etc/logrotate.d/Makefile.am
@@ -0,0 +1,13 @@
+## 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.
+
+## This file intentionally left blank.
diff --git a/etc/logrotate.d/couchdb.tpl.in b/etc/logrotate.d/couchdb.tpl.in
new file mode 100644
index 00000000..9bef5b2f
--- /dev/null
+++ b/etc/logrotate.d/couchdb.tpl.in
@@ -0,0 +1,9 @@
+%pkgstatelogdir%/*.log {
+ weekly
+ rotate 10
+ copytruncate
+ delaycompress
+ compress
+ notifempty
+ missingok
+}