From 1837357df009ee685385458db31828a972c9fffb Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Sun, 3 Aug 2008 01:22:48 -0400 Subject: [PATCH 1/1] * added decomposition of DB URI * generate nss-pgsql.conf from debian init script svn path=/trunk/packages/sipb-xen-console/; revision=843 --- config.todo | 1 - debian/changelog | 9 +++++++++ debian/sipb-xen-console.init | 42 ++++++++++++++++++++++++++++++++---------- files/etc/nss-pgsql.conf | 18 ------------------ 4 files changed, 41 insertions(+), 29 deletions(-) delete mode 100644 files/etc/nss-pgsql.conf diff --git a/config.todo b/config.todo index 4ef0ca3..beccb96 100644 --- a/config.todo +++ b/config.todo @@ -1,3 +1,2 @@ -files/etc/nss-pgsql.conf files/etc/issue.net.no_tkt files/etc/lots: could benefit from config-package-dev TRANSFORM for upgradeability diff --git a/debian/changelog b/debian/changelog index 43e35dc..ae7047c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +sipb-xen-console (7.7) unstable; urgency=low + + * sipb_xen_database -> invirt.database + * use invirt config in sipb-xen-consolefs + * added decomposition of DB URI + * generate nss-pgsql.conf from debian init script + + -- Yang Zhang Sun, 3 Aug 2008 01:13:37 -0400 + sipb-xen-console (7.6) unstable; urgency=low * Use invirt-getconf to generate config. diff --git a/debian/sipb-xen-console.init b/debian/sipb-xen-console.init index 9deced5..b472606 100755 --- a/debian/sipb-xen-console.init +++ b/debian/sipb-xen-console.init @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: sipb-xen-console # Required-Start: $local_fs $remote_fs @@ -37,15 +37,37 @@ SCRIPTNAME=/etc/init.d/$NAME gen_config() { - (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 + { + for i in $(invirt-getconf --ls hosts); do + local hostname=$(invirt-getconf hosts.$i.hostname) + echo "#include /etc/conserver/conf.d/$hostname" + done + } > /etc/conserver/invirt-hosts.cf + local realm=$(invirt-getconf authn.0.realm) + { + for i in $(invirt-getconf --ls hosts); do + local hostname=$(invirt-getconf hosts.$i.hostname) + echo "host/$hostname@$realm" + done + } > /etc/remctl/acl/invirt-console + + cat > /etc/nss-pgsql.conf << EOF +host = $(invirt-getconf db.host) +port = $(invirt-getconf db.port) +database = $(invirt-getconf db.dbname) +login = $(invirt-getconf db.user) + +querypasswd = SELECT name, NULL, machine_id + 1000 as uid, machine_id + 1000 as gid, '', '/consolefs/'|| name, '/usr/bin/sipb-xen-consolesh' FROM machines +querygroup = SELECT name, NULL, machine_id + 1000 as gid FROM machines +querymembers = SELECT name FROM machines WHERE 1000 + machine_id = %d +queryids = SELECT 1000 + machine_id AS gid FROM machines LIMIT 0 + +passwd_name = name +passwd_uid = 1000 + machine_id + +group_name = name +group_gid = 1000 + machine_id +EOF } # diff --git a/files/etc/nss-pgsql.conf b/files/etc/nss-pgsql.conf deleted file mode 100644 index e0ae1f2..0000000 --- a/files/etc/nss-pgsql.conf +++ /dev/null @@ -1,18 +0,0 @@ -# example configfile for PostgreSQL NSS module - -# these are entries as used with the BOFHMS tool (sf.net/projects/bofhms) -host = sipb-xen-dev -port = 5432 -database = sipb_xen -login = sipb-xen - -querypasswd = SELECT name, NULL, machine_id + 1000 as uid, machine_id + 1000 as gid, '', '/consolefs/'|| name, '/usr/bin/sipb-xen-consolesh' FROM machines -querygroup = SELECT name, NULL, machine_id + 1000 as gid FROM machines -querymembers = SELECT name FROM machines WHERE 1000 + machine_id = %d -queryids = SELECT 1000 + machine_id AS gid FROM machines LIMIT 0 - -passwd_name = name -passwd_uid = 1000 + machine_id - -group_name = name -group_gid = 1000 + machine_id -- 1.7.9.5