diff options
Diffstat (limited to 'enter-baserock')
-rwxr-xr-x | enter-baserock | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/enter-baserock b/enter-baserock new file mode 100755 index 0000000..f5b6951 --- /dev/null +++ b/enter-baserock @@ -0,0 +1,23 @@ +#!/bin/bash + +SCHROOT_BASE="${SCHROOT_BASE:-/etc/schroot}" +SCHROOT_CONF="${SCHROOT_CONF:-${SCHROOT_BASE}/schroot.conf}" +BASEROCK_BASE="${BASEROCK_BASE:-/opt/baserock/chroots}" + +baserock_default () { + (cd "${BASEROCK_BASE}" && ls -d */default) 2>/dev/null | sed -e's@/default$@@' | head -1 +} + +CHOSEN="$1" + +if test "x$CHOSEN" = "x"; then + CHOSEN=$(baserock_default) +fi + +if test "x$CHOSEN" = "x"; then + echo "No default found, cannot enter baserock without a tag" + exit 1 +fi + +cd / +exec sudo -H schroot -c "baserock-$CHOSEN" |