diff -r 4bc43250587a -r b36b9eee9c41 debian/postinst --- a/debian/postinst Fri Nov 17 10:15:27 2006 +0000 +++ b/debian/postinst Fri Nov 17 21:32:29 2006 +0000 @@ -1,9 +1,9 @@ #!/bin/sh -# postinst script for ha-config +# postinst script for ha-sync # # see: dh_installdeb(1) - set -e +. /usr/share/debconf/confmodule # summary of how this script can be called: # * `configure' @@ -21,13 +21,54 @@ case "$1" in configure) - update-rc.d ha-hostname start 3 S . - update-rc.d ha-config start 30 S . + { + update-rc.d ha-hostname start 3 S . + update-rc.d ha-config start 30 S . + + test -f /etc/ha-sync/id_rsa || { + ssh-keygen -N "" -C "ha-sync@`hostname`" -f /etc/ha-sync/id_rsa >&2 + chmod u=r,go= /etc/ha-sync/id_rsa + } + + } >&2 + + + TMP=`tempfile`; trap "rm -f $TMP" EXIT + + ## Config file + { + echo "# see /usr/share/doc/ha-sync/examples/ha-sync.conf.ex for" + echo "# example" + echo "" + + db_get ha-sync/dir + echo DIR="'$RET'" - test -f /etc/ha-sync/id_rsa || { - ssh-keygen -N "" -C "ha-sync@`hostname`" -f /etc/ha-sync/id_rsa - chmod u=r,go= /etc/ha-sync/id_rsa - } + db_get ha-sync/nodes + echo "$RET" | while read a b; do + echo NODE_A="'$a'" + echo NODE_B="'$b'" + done + + db_get ha-sync/fs + echo FILESYSTEMS="'${RET//,/}'" + + db_get ha-sync/exclude + echo EXCLUDE="'$RET'" + + } >> $TMP + ucf $TMP /etc/ha-sync/ha-sync.conf + + ## Exclude list + ucf /usr/share/doc/ha-sync/examples/exclude.ex /etc/ha-sync/exclude + + ## noch Verzeichnisse + source /etc/ha-sync/ha-sync.conf + install -d "$DIR"; + for node in $NODE_A $NODE_B; do + install -d $DIR/$node.etc + done + ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -47,3 +88,4 @@ exit 0 +# vim:sts=4 sw=4 aw ai sm: