Generate and install /etc/xen/xend-config.sxp in invirt-xen-config
authorEvan Broder <broder@mit.edu>
Sat, 25 Oct 2008 22:00:22 +0000 (18:00 -0400)
committerEvan Broder <broder@mit.edu>
Sat, 25 Oct 2008 22:00:22 +0000 (18:00 -0400)
svn path=/trunk/packages/invirt-xen-config/; revision=1261

debian/changelog
debian/control
debian/invirt-xen-config.init [changed mode: 0644->0755]
debian/invirt-xen-config.install
debian/rules
debian/transform_xend-config.sxp.invirt.mako [new file with mode: 0755]

index f5bc570..0c76447 100644 (file)
@@ -4,8 +4,9 @@ invirt-xen-config (0.0.1) unstable; urgency=low
   * Rearrange the source package
   * Divert /etc/xen/qemu-ifup, since it existed and we've been scribbling
     over it
+  * Generate /etc/xen/xend-config.sxp
 
- -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 16:15:33 -0400
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 17:41:40 -0400
 
 sipb-xen-dom0 (2.10) unstable; urgency=low
 
index 7d6120b..9c2f4c3 100644 (file)
@@ -2,8 +2,8 @@ Source: invirt-xen-config
 Section: base
 Priority: extra
 Maintainer: Invirt project <invirt@mit.edu>
-Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0)
-Standards-Version: 3.7.2
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0), xen-utils-3.2
+Standards-Version: 3.8.0
 
 Package: invirt-xen-config
 Architecture: all
old mode 100644 (file)
new mode 100755 (executable)
index 857497d..e45b253
@@ -9,14 +9,33 @@
 # Description:       
 ### END INIT INFO
 
-set -e
+PACKAGE=invirt-xen-config
+PARENTPACKAGE=xend
+GEN_FILES=/etc/xen/xend-config.sxp
 
-case $1 in
-    start)
+dpkg -s "$PACKAGE" >/dev/null 2>/dev/null || exit 0
+
+. /lib/init/gen-files.sh
+. /lib/init/std-init.sh
+
+do_start() {
+    gen_files
+    
     echo 1 >/proc/sys/net/ipv4/ip_forward
-    for foo in all default; do
-    echo 1 >/proc/sys/net/ipv4/conf/$foo/rp_filter 
-    echo 1 >/proc/sys/net/ipv4/conf/$foo/proxy_arp
+    for i in all default; do
+        echo 1 >/proc/sys/net/ipv4/conf/$i/rp_filter
+        echo 1 >/proc/sys/net/ipv4/conf/$i/proxy_arp
     done
-    ;;
-    esac
+    
+    invoke-rc.d "$PARENTPACKAGE" "$1"
+}
+
+do_reload() {
+    do_start
+}
+
+do_stop() {
+    invoke-rc.d "$PARENTPACKAGE" "$1"
+}
+
+std_init "$1"
index 8ce7ed6..14062fa 100644 (file)
@@ -1,3 +1,5 @@
 qemu-dm-invirt usr/sbin
 qemu-ifup.invirt etc/xen
 vif-invirtroute etc/xen/scripts
+
+debian/xend-config.sxp.invirt.mako etc/xen
index 090a1f7..a5765c8 100755 (executable)
@@ -3,6 +3,16 @@
 DEB_DIVERT_EXTENSION = .invirt
 
 DEB_DIVERT_FILES_invirt-xen-config += \
-       /etc/xen/qemu-ifup.invirt
+       /etc/xen/qemu-ifup.invirt \
+       /etc/xen/xend-config.sxp.invirt
 
 include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/config-package.mk
+
+common-build-indep:: debian/xend-config.sxp.invirt.mako
+
+debian/xend-config.sxp.invirt.mako: $(call debian_check_files,/etc/xen/xend-config.sxp)
+       debian/transform_xend-config.sxp.invirt.mako < $< > $@
+
+clean::
+       rm -f debian/xend-config.sxp.invirt.mako
diff --git a/debian/transform_xend-config.sxp.invirt.mako b/debian/transform_xend-config.sxp.invirt.mako
new file mode 100755 (executable)
index 0000000..1a3fa9a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -0n
+print <<'EOF';
+<%
+from invirt.config import structs as cfg
+import os
+hostname = os.uname()[1]
+%>
+EOF
+
+s/^\#?\(xend-relocation-address ''\)/(xend-relocation-address '\${hostname}-internal')/m or die;
+s/^\(xend-relocation-hosts-allow '[^']*'\)/(xend-relocation-hosts-allow '')/m or die;
+s/^\(dom0-min-mem [0-9]*\)/(dom0-min-mem 1536)/m or die;
+print;