use invirt-getconf to generate config in sipb-xen-console
[invirt/packages/invirt-console.git] / debian / sipb-xen-console.init
index 23d439d..9deced5 100755 (executable)
@@ -37,11 +37,15 @@ SCRIPTNAME=/etc/init.d/$NAME
 
 gen_config()
 {
-       perl -pe 's|^|#include /etc/conserver/conf.d/|' \
-           </etc/invirt/hosts >/etc/conserver/invirt-hosts.cf
-       INVIRT_REALM="$(cat /etc/invirt/realm)"
-       perl -pe "s|^|host/|; s|\$|\@$INVIRT_REALM|" \
-           </etc/invirt/hosts >/etc/remctl/acl/invirt-console
+        (for i in $(invirt-getconf --ls hosts); do
+               hostname=$(invirt-getconf hosts.$i.hostname)
+               echo "#include /etc/conserver/conf.d/$hostname"
+       done) >/etc/conserver/invirt-hosts.cf
+       realm=$(invirt-getconf authn.0.realm)
+        (for i in $(invirt-getconf --ls hosts); do
+               hostname=$(invirt-getconf hosts.$i.hostname)
+               echo "host/$hostname@$realm"
+       done) >/etc/remctl/acl/invirt-console
 }
 
 #