# # # delete "debian/monotone-server.prerm" # # add_dir "debian/po" # # add_file "debian/monotone-server.config" # content [6df9a17931a643f2f9602f623361915ba6b65a66] # # add_file "debian/monotone-server.postrm" # content [0e6c20d9f0358ac1b30051e5bfb9706d173edd2e] # # add_file "debian/monotone-server.templates" # content [ab74340c50f18d590fccdd810ec307070a3526b3] # # add_file "debian/po/POTFILES.in" # content [e9acdf63ad327fc5d50ea4d48067d21dd0c50b6c] # # add_file "debian/po/templates.pot" # content [e79edfd6a012c7ebc9d8e1db9827fbee81a33626] # # patch "contrib/monotone.bash_completion" # from [d03afdef8e888c8e263c2d023c0cff23fc4a6c87] # to [5beb8b066092f03674d44d816e6bd6030c3a55ad] # # patch "debian/control" # from [dda812ddf83af01a939f1239f73d36bd153103ed] # to [f1c5b0ff96d275a107367963c51d9b2afefa37e0] # # patch "debian/monotone-server.postinst" # from [a3561f8177b3650a683dc3be72dde1d029e46ed8] # to [2ac4a5b45afc9a5930090741e7477341d8c8c0d7] # ============================================================ --- debian/monotone-server.config 6df9a17931a643f2f9602f623361915ba6b65a66 +++ debian/monotone-server.config 6df9a17931a643f2f9602f623361915ba6b65a66 @@ -0,0 +1,68 @@ +#! /bin/sh +# vim: set ft=sh sw=4 et: +# postinst script for monotone-server +# +# see: dh_installdeb(1) + +set -e + +# source debconf stuff +. /usr/share/debconf/confmodule + +# we only want to change these values on the initial configuration + +gen_pass () + { + # this algorithm was taken from the advanced bash scripting howto + MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + + LENGTH="$1" + if [ -z "$LENGTH" ]; then + LENGTH=8 + fi + + PASS="" + n=1 + while [ "$n" -le "$LENGTH" ]; do + PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}" + let n+=1 + done + } + +case "$1" in + configure) + # set the default monotone keyname + db_set monotone-server/key `hostname --fqdn` + + db_input medium monotone-server/manage-db || true + db_go || true + + # make sure we should manage things + db_get monotone_server/manage + if [ "$RET" = false ]; then + exit 0 + fi + + db_input medium monotone-server/purge-db || true + db_go || true + + db_input low monotone-server/key || true + db_input medium monotone-server/passphrase || true + db_go || true + + # no passphrase was entered, generate one + # make sure this is the initial configuration + db_get monotone-server/passphrase + if [ -z "$RET" ] && [ -z "$2" ]; then + gen_pass + db_set monotone-server/passphrase "$PASS" + fi + ;; + reconfigure) + ;; + *) + echo "config called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + ============================================================ --- debian/monotone-server.postrm 0e6c20d9f0358ac1b30051e5bfb9706d173edd2e +++ debian/monotone-server.postrm 0e6c20d9f0358ac1b30051e5bfb9706d173edd2e @@ -0,0 +1,59 @@ +#! /bin/sh +# vim: set ft=sh sw=4 et: +# postrm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf stuff +. /usr/share/debconf/confmodule + +case "$1" in + purge) + + MTN_DB=/var/lib/monotone/default.db + MTN_HOME=/var/lib/monotone + MTN_CONFDIR=/etc/monotone + MTN_KEYDIR=$MTN_HOME/keys + + # remove database if debconf variable is set + db_get monotone-server/purge-db + if [ "$RET" = false ]; then + DELUSER_FLAGS="--remove-home" + echo "deleting monotone database" >&2 + fi + + /usr/sbin/deluser --quiet $DELUSER_FLAGS monotone + /usr/sbin/delgroup --quiet monotone + + echo "monotone user and group removed" >&2 + + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 ============================================================ --- debian/monotone-server.templates ab74340c50f18d590fccdd810ec307070a3526b3 +++ debian/monotone-server.templates ab74340c50f18d590fccdd810ec307070a3526b3 @@ -0,0 +1,25 @@ +Template: monotone-server/manage-db +Type: boolean +Default: true +_Description: Automatically manage monotone database? + Select this option to automatically manage the monotone database. If + selected, the database will automatically be created. Also when upgrading, + the database will be automatically migrated if necessary. + +Template: monotone-server/key +Type: string +_Description: Monotone key id. + Enter the id of the key your monotone server will use. + +Template: monotone-server/passphrase +Type: password +_Description: Monotone key passphrase: + Please choose a passphrase for your monotone key. If left blank, one will + be generated for you. + +Template: monotone-server/purge-db +Type: boolean +Default: false +_Description: Delete monotone database when monotone-server is removed? + If this option is selected, the monotone database and keys will be removed + when the package is removed. ============================================================ --- debian/po/POTFILES.in e9acdf63ad327fc5d50ea4d48067d21dd0c50b6c +++ debian/po/POTFILES.in e9acdf63ad327fc5d50ea4d48067d21dd0c50b6c @@ -0,0 +1,1 @@ +[type: gettext/rfc822deb] monotone-server.templates ============================================================ --- debian/po/templates.pot e79edfd6a012c7ebc9d8e1db9827fbee81a33626 +++ debian/po/templates.pot e79edfd6a012c7ebc9d8e1db9827fbee81a33626 @@ -0,0 +1,72 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: address@hidden" +"POT-Creation-Date: 2005-12-04 13:48-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../monotone-server.templates:4 +msgid "Automatically manage monotone database?" +msgstr "" + +#. Type: boolean +#. Description +#: ../monotone-server.templates:4 +msgid "" +"Select this option to automatically manage the monotone database. If " +"selected, the database will automatically be created. Also when upgrading, " +"the database will be automatically migrated if necessary." +msgstr "" + +#. Type: string +#. Description +#: ../monotone-server.templates:11 +msgid "Monotone key id." +msgstr "" + +#. Type: string +#. Description +#: ../monotone-server.templates:11 +msgid "Enter the id of the key your monotone server will use." +msgstr "" + +#. Type: password +#. Description +#: ../monotone-server.templates:16 +msgid "Monotone key passphrase:" +msgstr "" + +#. Type: password +#. Description +#: ../monotone-server.templates:16 +msgid "" +"Please choose a passphrase for your monotone key. If left blank, one will be " +"generated for you." +msgstr "" + +#. Type: boolean +#. Description +#: ../monotone-server.templates:23 +msgid "Delete monotone database when monotone-server is removed?" +msgstr "" + +#. Type: boolean +#. Description +#: ../monotone-server.templates:23 +msgid "" +"If this option is selected, the monotone database and keys will be removed " +"when the package is removed." +msgstr "" ============================================================ --- contrib/monotone.bash_completion d03afdef8e888c8e263c2d023c0cff23fc4a6c87 +++ contrib/monotone.bash_completion 5beb8b066092f03674d44d816e6bd6030c3a55ad @@ -95,8 +95,7 @@ --full-version --xargs --ticker --nostd --norc --rcfile --key --db --root --verbose -k -d -@ -m -b -r --branch --message --date --author - --depth --execute'\ - -- $cur) ) + --depth --execute --keydir --confdir' -- $cur) ) ;; * ) case $prev in @@ -196,6 +195,7 @@ esac else unset prev2 + _filedir fi ;; esac @@ -212,6 +212,8 @@ merge propagate refresh_inodeprints setup set unset add attr ci commit drop identify mv rename revert rm update' -- $cur) ) + else + _filedir fi ;; esac ============================================================ --- debian/control dda812ddf83af01a939f1239f73d36bd153103ed +++ debian/control f1c5b0ff96d275a107367963c51d9b2afefa37e0 @@ -1,10 +1,10 @@ Source: monotone Section: devel Priority: optional Maintainer: Tomas Fasth -Build-Depends: cdbs (>= 0.4.28), debhelper (>= 4.0.0), autotools-dev, +Build-Depends: cdbs (>= 0.4.28), debhelper (>= 4.1.16), autotools-dev, libboost-date-time-dev, libboost-filesystem-dev, libboost-regex-dev, - libboost-test-dev, libboost-dev, texinfo, libz-dev, + libboost-test-dev, libboost-dev, texinfo, libz-dev, po-debconf, g++ [!arm !hppa !m68k], g++-3.4 [arm hppa m68k] Standards-Version: 3.6.2 @@ -21,7 +21,7 @@ Package: monotone-server Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, monotone (= 0.23) +Depends: ${shlibs:Depends}, ${misc:Depends}, monotone (= ${Source-Version}), adduser Description: A distributed version (revision) control system Monotone is a free, distributed version control system. It provides fully disconnected operation, manages complete tree versions, keeps ============================================================ --- debian/monotone-server.postinst a3561f8177b3650a683dc3be72dde1d029e46ed8 +++ debian/monotone-server.postinst 2ac4a5b45afc9a5930090741e7477341d8c8c0d7 @@ -17,6 +17,9 @@ # the debian-policy package # +# source debconf stuff +. /usr/share/debconf/confmodule + MONOTONE=/usr/bin/monotone case "$1" in @@ -27,10 +30,22 @@ MTN_CONFDIR=/etc/monotone MTN_KEYDIR=$MTN_HOME/keys - # TODO: debconf monotone stuff - #MTN_KEY= - #MTN_KEY_PASSWD= + db_get monotone-server/manage + if [ -z "$RET" ]; then + exit 0 + fi + # read our passphrase from a file + if [ -e "$MTN_HOME/$MTN_KEY.passphrase" ]; then + db_set monotone-server/passphrase "`cat $MTN_HOME/$MTN_KEY.passphrase`" + fi + + db_get monotone-server/key + MTN_KEY=$RET + + db_get monotone-server/passphrase + MTN_KEY_PASSWD=$RET + MTN_VERSION="$2" # Since we are configuring, we should check if we are upgrading. If we are @@ -41,9 +56,9 @@ # create monotone user and fix permissions of files if [ -z "`id -u monotone 2> /dev/null`" ]; then /usr/sbin/adduser --system --group --home $MTN_HOME --no-create-home --disabled-password --quiet monotone --gecos "Monotone" - chown monotone.monotone $MTN_HOME - chown monotone.monotone $MTN_CONFDIR - chown monotone.monotone $MTN_KEYDIR + chown monotone:monotone $MTN_HOME + chown monotone:monotone $MTN_CONFDIR + chown monotone:monotone $MTN_KEYDIR chmod 0740 $MTN_HOME chmod 0740 $MTN_CONFDIR chmod 0740 $MTN_KEYDIR @@ -51,39 +66,44 @@ # if there is no database, create one if [ ! -e $MTN_DB ]; then - echo "Creating Monotone database..." + echo "Creating Monotone database..." >&2 $MONOTONE --db $MTN_DB db init chmod 0600 $MTN_DB - echo "Creating Monotone server keypair..." + echo "Creating Monotone server keypair..." >&2 yes "$MTN_KEY_PASSWD" | $MONOTONE --db $MTN_DB genkey $MTN_KEY \ - --norc --keydir $MTN_KEYDIR --confdir $MTN_CONFDIR &> /dev/null + --norc --keydir $MTN_KEYDIR --confdir $MTN_CONFDIR > /dev/null $MONOTONE --db $MTN_DB pubkey $MTN_KEY \ --norc --keydir $MTN_KEYDIR --confdir $MTN_CONFDIR > $MTN_HOME/$MTN_KEY.pubkey - echo "Monotone database created successfully." + echo "Monotone database created successfully." >&2 fi elif [ dpkg --compare-versions "$MTN_VERSION" lt 0.17 ]; then # monotone version to old to automatically upgrade - echo "Cannot automatically upgrade from monotone version $2." + echo "Cannot automatically upgrade from monotone version $2." >&2 echo -e "Please see UPGRADE and README.changesets in /usr/share/doc/monotone for\n \ - information on upgrading." + information on upgrading." >&2 elif [ dpkg --compare-versions "$MTN_VERSION" lt 0.22 ]; then # upgradable version of monotone - echo "Attempting to migrate monotone database..." - echo "A backup will be created in $MTN_HOME." + echo "Attempting to migrate monotone database..." >&2 + echo "A backup will be created in $MTN_HOME." >&2 cp $MTN_DB $MTN_DB~ (yes "$MTN_KEY_PASSWD" | $MONOTONE --db $MTN_DB db migrate \ --norc --keydir $MTN_KEYDIR --confdir $MTN_CONFDIR && - echo "Database successfully migrated.") || - (echo "*** Error migrating database. ***" && + echo "Database successfully migrated." >&2) || + (echo "*** Error migrating database. ***" >&2 && echo -e "Please see UPGRADE and README.changesets in /usr/share/doc/monotone for\n \ - information on manually upgrading your database.") + information on manually upgrading your database." >&2) fi + + echo "$MTN_KEY_PASSWD" > $MTN_HOME/$MTN_KEY.passphrase + chmod 0600 $MTN_HOME/$MTN_KEY.passphrase + db_set monotone-server/passphrase "" + ;; abort-upgrade|abort-remove|abort-deconfigure)