diff options
author | jmmv <jmmv@pkgsrc.org> | 2005-01-12 12:52:50 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2005-01-12 12:52:50 +0000 |
commit | 715ac4a22f2c0e50ce961f65cba95982c96f2196 (patch) | |
tree | 6b9ff57f922a4f6ff7c8dd027daefb79dcbadfa2 | |
parent | eed42efbcc86a7ea000f88860670d2ae8d42a8ad (diff) | |
download | pkgsrc-715ac4a22f2c0e50ce961f65cba95982c96f2196.tar.gz |
Initial import of monotone-server, version 0.16 (number matches the
devel/monotone package it depends on):
Monotone is a free distributed version control system. It provides a
simple, single-file transactional version store, with fully disconnected
operation and an efficient peer-to-peer synchronization protocol. It
understands history-sensitive merging, lightweight branches, integrated
code review and 3rd party testing. It uses cryptographic version naming
and client-side RSA certificates. It has good internationalization
support, has no external dependencies, runs on NetBSD, Linux, Solaris,
OSX and Windows (among others), and is licensed under the GNU GPL.
This package provides all the necessary stuff to easily configure a
dedicated Monotone server. Of special interest are the included rc.d
script and the monotone-server-init script, which will greatly simplify
the whole process.
-rw-r--r-- | devel/monotone-server/DESCR | 13 | ||||
-rw-r--r-- | devel/monotone-server/MESSAGE | 7 | ||||
-rw-r--r-- | devel/monotone-server/Makefile | 68 | ||||
-rw-r--r-- | devel/monotone-server/PLIST | 5 | ||||
-rw-r--r-- | devel/monotone-server/files/branches.conf | 8 | ||||
-rw-r--r-- | devel/monotone-server/files/hooks.conf | 40 | ||||
-rw-r--r-- | devel/monotone-server/files/monotone-server-init.sh | 109 | ||||
-rw-r--r-- | devel/monotone-server/files/monotone.sh | 35 |
8 files changed, 285 insertions, 0 deletions
diff --git a/devel/monotone-server/DESCR b/devel/monotone-server/DESCR new file mode 100644 index 00000000000..92c80dcc5af --- /dev/null +++ b/devel/monotone-server/DESCR @@ -0,0 +1,13 @@ +Monotone is a free distributed version control system. It provides a +simple, single-file transactional version store, with fully disconnected +operation and an efficient peer-to-peer synchronization protocol. It +understands history-sensitive merging, lightweight branches, integrated +code review and 3rd party testing. It uses cryptographic version naming +and client-side RSA certificates. It has good internationalization +support, has no external dependencies, runs on NetBSD, Linux, Solaris, +OSX and Windows (among others), and is licensed under the GNU GPL. + +This package provides all the necessary stuff to easily configure a +dedicated Monotone server. Of special interest are the included rc.d +script and the monotone-server-init script, which will greatly simplify +the whole process. diff --git a/devel/monotone-server/MESSAGE b/devel/monotone-server/MESSAGE new file mode 100644 index 00000000000..a7b5ce08bf2 --- /dev/null +++ b/devel/monotone-server/MESSAGE @@ -0,0 +1,7 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ + +You should now run 'monotone-server-init' to finish installation _before_ +enabling the server. Then, follow the on-screen instructions. + +=========================================================================== diff --git a/devel/monotone-server/Makefile b/devel/monotone-server/Makefile new file mode 100644 index 00000000000..3276eaf93b8 --- /dev/null +++ b/devel/monotone-server/Makefile @@ -0,0 +1,68 @@ +# $NetBSD: Makefile,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +# + +DISTNAME= monotone-server-0.16 +CATEGORIES= devel +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= jmmv@NetBSD.org +HOMEPAGE= http://www.venge.net/monotone/ +COMMENT= Simplifies the configuration of a dedicated Monotone server + +DEPENDS+= monotone>=0.16:../../devel/monotone + +EXTRACT_ONLY= # empty +NO_BUILD= yes +NO_BUILDLINK= yes +NO_CHECKSUM= yes +USE_PKGINSTALL= yes +WRKSRC= ${WRKDIR} + +RCD_SCRIPTS= monotone + +PKG_SYSCONFSUBDIR= monotone-server + +BUILD_DEFS+= MONOTONE_GROUP MONOTONE_USER + +EXAMPLEDIR= ${PREFIX}/share/examples/monotone-server +CONF_FILES_PERMS= ${EXAMPLEDIR}/branches.conf \ + ${PKG_SYSCONFDIR}/branches.conf \ + ${MONOTONE_USER} ${MONOTONE_GROUP} 600 +CONF_FILES_PERMS+= ${EXAMPLEDIR}/hooks.conf \ + ${PKG_SYSCONFDIR}/hooks.conf \ + ${MONOTONE_USER} ${MONOTONE_GROUP} 600 + +PKG_USERS= ${MONOTONE_USER}:${MONOTONE_GROUP}::Monotone\\ dedicated\\ server:${VARBASE}/monotone:${SH} +PKG_GROUPS= ${MONOTONE_GROUP} + +SUBST_CLASSES+= vars +SUBST_STAGE.vars= do-configure +SUBST_MESSAGE.vars= "Configuring sources." +SUBST_FILES.vars= ${WRKSRC}/* +SUBST_SED.vars= -e 's|@MONOTONE@|${PREFIX}/bin/monotone|g' +SUBST_SED.vars+= -e 's|@MONOTONE_GROUP@|${MONOTONE_GROUP}|g' +SUBST_SED.vars+= -e 's|@MONOTONE_USER@|${MONOTONE_USER}|g' +SUBST_SED.vars+= -e 's|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g' +SUBST_SED.vars+= -e 's|@SH@|${SH}|g' +SUBST_SED.vars+= -e 's|@VARBASE@|${VARBASE}|g' + +FILES_SUBST+= MONOTONE_GROUP=${MONOTONE_GROUP} +FILES_SUBST+= MONOTONE_USER=${MONOTONE_USER} + +INSTALLATION_DIRS= sbin + +do-extract: +.for f in branches.conf hooks.conf monotone-server-init.sh + ${CP} ${FILESDIR}/${f} ${WRKSRC} +.endfor +.undef f + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/monotone-server-init.sh \ + ${PREFIX}/sbin/monotone-server-init + ${INSTALL_DATA_DIR} ${EXAMPLEDIR} + ${INSTALL_DATA} ${WRKSRC}/branches.conf ${EXAMPLEDIR}/branches.conf + ${INSTALL_DATA} ${WRKSRC}/hooks.conf ${EXAMPLEDIR}/hooks.conf + +.include "../../mk/bsd.pkg.mk" diff --git a/devel/monotone-server/PLIST b/devel/monotone-server/PLIST new file mode 100644 index 00000000000..032f415f203 --- /dev/null +++ b/devel/monotone-server/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +sbin/monotone-server-init +share/examples/monotone-server/branches.conf +share/examples/monotone-server/hooks.conf +@dirrm share/examples/monotone-server diff --git a/devel/monotone-server/files/branches.conf b/devel/monotone-server/files/branches.conf new file mode 100644 index 00000000000..acb7ab3ef0f --- /dev/null +++ b/devel/monotone-server/files/branches.conf @@ -0,0 +1,8 @@ +# $NetBSD: branches.conf,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +# +# This file belongs to the monotone-server package. It lists all branches +# that will be served by Monotone, each one in its own line. +# + +#net.example.project1 +#net.example.project2.subbranch diff --git a/devel/monotone-server/files/hooks.conf b/devel/monotone-server/files/hooks.conf new file mode 100644 index 00000000000..9befecfaf8f --- /dev/null +++ b/devel/monotone-server/files/hooks.conf @@ -0,0 +1,40 @@ +-- $NetBSD: hooks.conf,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +-- +-- This file belongs to the monotone-server package. This is the typical +-- ~/.monotonerc configuration file, but is system-wide. +-- + +function get_passphrase(identity) +-- if (identity == "PUT_KEYNAME_HERE") then +-- return "PUT_PASSPHRASE_HERE" +-- end + return false +end + +function get_netsync_read_permitted (collection, identity) +-- if (collection == "net.example.project1") then +-- if (identity == "user1@example.org") then return true end +-- end +-- if (collection == "net.example.project2.subbranch") then +-- if (identity == "user1@example.org") then return true end +-- if (identity == "user2@example.org") then return true end +-- end + return false +end + +function get_netsync_write_permitted (collection, identity) +-- if (collection == "net.example.project1") then +-- if (identity == "user1@example.org") then return true end +-- end +-- if (collection == "net.example.project2.subbranch") then +-- if (identity == "user1@example.org") then return true end +-- if (identity == "user2@example.org") then return true end +-- end + return false +end + +function get_netsync_anonymous_read_permitted (collection) +-- if (collection == "net.example.project1") then return true end +-- if (collection == "net.example.project2.branch2") then return true end + return false +end diff --git a/devel/monotone-server/files/monotone-server-init.sh b/devel/monotone-server/files/monotone-server-init.sh new file mode 100644 index 00000000000..8f49b80e4f1 --- /dev/null +++ b/devel/monotone-server/files/monotone-server-init.sh @@ -0,0 +1,109 @@ +#!@SH@ +# +# $NetBSD: monotone-server-init.sh,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +# + +progname=$(basename $0) + +MONOTONE=@MONOTONE@ +MONOTONE_GROUP=@MONOTONE_GROUP@ +MONOTONE_USER=@MONOTONE_USER@ +PKG_SYSCONFDIR=@PKG_SYSCONFDIR@ +VARBASE=@VARBASE@ + +if [ $(id -u) -ne 0 ]; then + echo "${progname}: this program must be run as \`root'" 1>&2 + exit 1 +fi + +cat <<EOF +The monotone package is currently configured to use the +${VARBASE}/monotone directory to hold the public database. +You may now change this default path to something else that is +more suitable for your system, if you wish. + +EOF + +printf "Enter home directory [${VARBASE}/monotone]: " +read home +: ${home:=${VARBASE}/monotone} + +if [ ${home} != ${VARBASE}/monotone ]; then + + if ! usermod -d ${home} ${MONOTONE_USER}; then + echo "cannot modify home directory of user " \ + "\`${MONOTONE_USER}'" 1>&2 + exit 1 + fi + + echo "monotone_home=${home}" >>${PKG_SYSCONFDIR}/rc.conf +fi + +cat <<EOF + +In order to serve a collection, you must now create a public/private key +pair to access the database. This has to be _different_ to the key pair +you use for development; it will only be used by the server process. + +The key name should be in the form of an email address. Typicall, it will +be something like monotone@your_host_name. + +I have determined that monotone@$(hostname) is probably a good choice. + +EOF +printf "Enter key name [monotone@$(hostname)]: " +read keyname +: ${keyname:=monotone@$(hostname)} + +if [ ! -d ${home} ]; then + echo "Initializing new home directory: \`${home}'" + mkdir -p ${home} + chmod 755 ${home} + chown ${MONOTONE_USER}:${MONOTONE_GROUP} ${home} +fi + +cd ${home} + +echo "Initializing database: \`${home}'/monotone.db" +${MONOTONE} --db=monotone.db db init + +cat <<EOF + +Monotone will now ask you for a passphrase to protect the key pair we are +creating. Choose a hard one and write it down temporarily; you will need +to put it in one of the configuration files in a later step. After that, +you can forget about it (assuming you have a safe copy). + +EOF + +${MONOTONE} --db=monotone.db genkey ${keyname} +${MONOTONE} --db=monotone.db pubkey ${keyname} >${keyname}-public +${MONOTONE} --db=monotone.db privkey ${keyname} >${keyname}-private + +chown ${MONOTONE_USER}:${MONOTONE_GROUP} monotone.db \ + ${keyname}-public ${keyname}-private +chmod 600 monotone.db +chmod 444 ${keyname}-public +chmod 400 ${keyname}-private + +cat <<EOF + +Initialization process finished! + +You should now backup the following files and store them in a safe place +in case you need to reconstruct the database from scratch: + + ${home}/${keyname}-public + ${home}/${keyname}-private + +At last, edit the following files to finish the configuration of your +new server: + + ${PKG_SYSCONFDIR}/branches.conf + ${PKG_SYSCONFDIR}/hooks.conf + +Once finished, use the installed rc.d script (monotone) to start the +dedicated server process. +EOF + +exit 0 diff --git a/devel/monotone-server/files/monotone.sh b/devel/monotone-server/files/monotone.sh new file mode 100644 index 00000000000..7b88efbe712 --- /dev/null +++ b/devel/monotone-server/files/monotone.sh @@ -0,0 +1,35 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: monotone.sh,v 1.1.1.1 2005/01/12 12:52:50 jmmv Exp $ +# +# PROVIDE: monotone +# REQUIRE: DAEMON + +. /etc/rc.subr + +if [ -f "@PKG_SYSCONFDIR@/rc.conf" ]; then + . @PKG_SYSCONFDIR@/rc.conf +fi + +if [ -f "@PKG_SYSCONFDIR@/branches.conf" ]; then + monotone_branches=$(cat @PKG_SYSCONFDIR@/branches.conf | grep -v '^#') +fi + +: ${monotone_group=@MONOTONE_GROUP@} +: ${monotone_home=@VARBASE@/monotone} +: ${monotone_user=@MONOTONE_USER@} + +name="monotone" +rcvar=${name} +command="@PREFIX@/bin/monotone" +command_args="--norc \ + --rcfile=@PKG_SYSCONFDIR@/hooks.conf \ + --db=${monotone_home}/monotone.db \ + serve 0.0.0.0 ${monotone_branches} \ + >>${monotone_home}/monotone.log 2>&1 &" +required_files="@PKG_SYSCONFDIR@/branches.conf \ + @PKG_SYSCONFDIR@/hooks.conf \ + ${monotone_home}/monotone.db" + +load_rc_config $name +run_rc_command "$1" |