#!/bin/bash

PACKAGE=sipb-xen-dev

. /lib/lsb/init-functions

gen_config () {
    local keyid="$(invirt-getconf apt.keyid)"
    for f in /srv/repository/conf/{distributions,invirt-uploaders}; do
	perl -pe "s/\@apt\.keyid\@/$keyid/g" <"$f".in >"$f"
    done
}

case "$1" in
  start|reload|force-reload|restart)
    log_begin_msg "Reloading config for $PACKAGE"
    gen_config
    log_end_msg $?
    ;;
  stop)
    ;;
  *)
    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
    ;;
esac
