summaryrefslogtreecommitdiffstats
path: root/tools/encap-util-xml.sh
diff options
context:
space:
mode:
authorDaniel Joseph Barnhart Clark <dclark@pobox.com>2007-07-19 22:30:26 +0000
committerDaniel Joseph Barnhart Clark <dclark@pobox.com>2007-07-19 22:30:26 +0000
commitdc175a023bf6761d7a9015d83ea4678d60ebc3db (patch)
treed6bbe72eaf65e5f4fe6f668cc34262f79dd60dec /tools/encap-util-xml.sh
parent2fbb9258d1bd069ff4ba07fd1765201da1afa669 (diff)
downloadbcfg2-dc175a023bf6761d7a9015d83ea4678d60ebc3db.tar.gz
bcfg2-dc175a023bf6761d7a9015d83ea4678d60ebc3db.tar.bz2
bcfg2-dc175a023bf6761d7a9015d83ea4678d60ebc3db.zip
Add tools for managing encaps
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3509 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools/encap-util-xml.sh')
-rwxr-xr-xtools/encap-util-xml.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/encap-util-xml.sh b/tools/encap-util-xml.sh
new file mode 100755
index 000000000..0fdd75fe4
--- /dev/null
+++ b/tools/encap-util-xml.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# $Id$
+
+# This builds the XML Pkgmgr files for the encap directory
+# structure created by the place script. It assumes the
+# directory has a *.run file in it (from the bcfg2 encap build)
+
+SITEBASEURI="http://example.com/encaps"
+
+for RUN in $(find * -type f | grep run$); do
+ DIR="$(dirname $RUN)"
+ FILE="$(basename $RUN)"
+ ARCH="$(printf "$FILE" | awk -F\- '{print $4}')"
+ OS="$(printf "$FILE" | awk -F\- '{print $5}' | sed s:\.run$::g)"
+ case $OS in
+ *aix*) OSDIR="aix/$(printf "$OS" | sed s:aix::g)" ;;
+ *solaris*) OSDIR="solaris/$(printf "$OS" | sed s:solaris::g)" ;;
+ *linux*) OSDIR="$(printf "$OS" | sed s:\_:\/:g)" ;;
+ *) exit 1
+ esac
+ XML="./xml/site-encaps-${ARCH}-${OS}.xml"
+ printf "<PackageList priority='0'\n" > $XML
+ printf " type='encap'\n" >> $XML
+ printf " uri='${SITEBASEURI}/%s/%s'>\n" "$OSDIR" "$ARCH" >> $XML
+ printf " <Group name='%s-%s'>\n" "$ARCH" "$OS" >> $XML
+ for FILE in `(cd ./$DIR && ls *-encap-*.tar.gz) | sort`; do
+ printf " <Package file='%s'/>\n" "$FILE" >> $XML
+ done
+ printf " </Group>\n" >> $XML
+ printf "</PackageList>\n" >> $XML
+done
+
+exit 0