debian/postinst
changeset 1 b36b9eee9c41
parent 0 4bc43250587a
child 37 1cdaa46b79c5
equal deleted inserted replaced
0:4bc43250587a 1:b36b9eee9c41
     1 #!/bin/sh
     1 #!/bin/sh
     2 # postinst script for ha-config
     2 # postinst script for ha-sync
     3 #
     3 #
     4 # see: dh_installdeb(1)
     4 # see: dh_installdeb(1)
     5 
       
     6 set -e
     5 set -e
       
     6 . /usr/share/debconf/confmodule
     7 
     7 
     8 # summary of how this script can be called:
     8 # summary of how this script can be called:
     9 #        * <postinst> `configure' <most-recently-configured-version>
     9 #        * <postinst> `configure' <most-recently-configured-version>
    10 #        * <old-postinst> `abort-upgrade' <new version>
    10 #        * <old-postinst> `abort-upgrade' <new version>
    11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
    11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
    19 
    19 
    20 
    20 
    21 case "$1" in
    21 case "$1" in
    22     configure)
    22     configure)
    23 
    23 
    24     	update-rc.d ha-hostname start 3 S .
    24 	{
    25 	update-rc.d ha-config start 30 S .
    25 	    update-rc.d ha-hostname start 3 S . 
       
    26 	    update-rc.d ha-config start 30 S . 
    26 
    27 
    27 	test -f /etc/ha-sync/id_rsa || {
    28 	    test -f /etc/ha-sync/id_rsa || {
    28 		ssh-keygen -N "" -C "ha-sync@`hostname`" -f /etc/ha-sync/id_rsa
    29 		    ssh-keygen -N "" -C "ha-sync@`hostname`" -f /etc/ha-sync/id_rsa >&2
    29 		chmod u=r,go= /etc/ha-sync/id_rsa
    30 		    chmod u=r,go= /etc/ha-sync/id_rsa
    30 	}
    31 	    }
       
    32 
       
    33 	} >&2
       
    34 
       
    35 
       
    36 	TMP=`tempfile`; trap "rm -f $TMP" EXIT
       
    37 
       
    38 	## Config file 
       
    39 	{
       
    40 	    echo "# see /usr/share/doc/ha-sync/examples/ha-sync.conf.ex for"
       
    41 	    echo "# example"
       
    42 	    echo ""
       
    43 
       
    44 	    db_get ha-sync/dir
       
    45 	    echo DIR="'$RET'"
       
    46 
       
    47 	    db_get ha-sync/nodes
       
    48 	    echo "$RET" | while read a b; do 
       
    49 		    echo NODE_A="'$a'"
       
    50 		    echo NODE_B="'$b'"
       
    51 	    done 
       
    52 
       
    53 	    db_get ha-sync/fs
       
    54 	    echo FILESYSTEMS="'${RET//,/}'"
       
    55 
       
    56 	    db_get ha-sync/exclude
       
    57 	    echo EXCLUDE="'$RET'"
       
    58 
       
    59 	} >> $TMP
       
    60 	ucf $TMP /etc/ha-sync/ha-sync.conf
       
    61 
       
    62 	## Exclude list
       
    63 	ucf /usr/share/doc/ha-sync/examples/exclude.ex /etc/ha-sync/exclude
       
    64 
       
    65 	## noch Verzeichnisse
       
    66 	source /etc/ha-sync/ha-sync.conf
       
    67 	install -d "$DIR";
       
    68 	for node in $NODE_A $NODE_B; do
       
    69 	    install -d $DIR/$node.etc
       
    70 	done
       
    71 
    31     ;;
    72     ;;
    32 
    73 
    33     abort-upgrade|abort-remove|abort-deconfigure)
    74     abort-upgrade|abort-remove|abort-deconfigure)
    34     ;;
    75     ;;
    35 
    76 
    45 #DEBHELPER#
    86 #DEBHELPER#
    46 
    87 
    47 exit 0
    88 exit 0
    48 
    89 
    49 
    90 
       
    91 # vim:sts=4 sw=4 aw ai sm: