Bastian Blank
2011-Oct-26 22:40 UTC
[Pkg-xen-changes] r929 - trunk/xen-common/debian/scripts
Author: waldi Date: Wed Oct 26 22:40:50 2011 New Revision: 929 Log: * debian/scripts/xen-toolstack: Add script to return selected toolstack. * debian/scripts/xen-toolstack-wrapper: Add script to wrap toolstacks. Added: trunk/xen-common/debian/scripts/xen-toolstack (contents, props changed) trunk/xen-common/debian/scripts/xen-toolstack-wrapper (contents, props changed) Added: trunk/xen-common/debian/scripts/xen-toolstack =============================================================================--- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/xen-common/debian/scripts/xen-toolstack Wed Oct 26 22:40:50 2011 (r929) @@ -0,0 +1,34 @@ +#!/bin/sh -e + +configfile=/etc/defaults/xen + +dir=$(. /usr/lib/xen-common/bin/xen-dir); ret=$?; [ $ret -eq 0 ] || exit $ret + +export PATH="$dir:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +if [ -e $configfile ]; then + . $configfile || true +fi + +if [ "$TOOLSTACK" ]; then + cmd=$(command -v "$TOOLSTACK") + if [ "$cmd" ]; then + echo "$cmd" + else + echo "WARING: Can''t find toolstack $TOOLSTACK, fallback to default!" >&2 + TOOLSTACK+ fi +fi + +if [ -z "$TOOLSTACK" ]; then + cmd_xm=$(command -v xm) + cmd_xl=$(command -v xl) + if [ "$cmd_xm" ]; then + echo "$cmd_xm" + elif [ "$cmd_xl" ]; then + echo "$cmd_xl" + else + echo "ERROR: Toolstack not specifed and nothing detected, bailing out!" >&2 + exit 127 + fi +fi Added: trunk/xen-common/debian/scripts/xen-toolstack-wrapper =============================================================================--- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/xen-common/debian/scripts/xen-toolstack-wrapper Wed Oct 26 22:40:50 2011 (r929) @@ -0,0 +1,11 @@ +#!/bin/sh -e + +COMMAND="$(basename $0)" +TOOLSTACK=$(. /usr/lib/xen-common/bin/xen-toolstack); RET=$?; [ $RET -eq 0 ] || exit $RET + +if [ "$(basename "$TOOLSTACK")" != "$COMMAND" ]; then + echo "ERROR: A different toolstack have been selected!" >&2 + exit 1 +fi + +exec "$TOOLSTACK" "$@"