Created
November 1, 2015 17:46
-
-
Save varhub/71070bb379457c4f8b62 to your computer and use it in GitHub Desktop.
shcroot wrapper to allow bootstrap from specified directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Copyright (c) 2015 | |
# Author: Victor Arribas <v.arribas.urjc@gmail.com> | |
# License: GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html> | |
# Usage | |
if [ -z "$1" ]; then | |
echo "Little script to launch an SCHROOT throught a specific workspace" | |
echo "Usage: $0 <schroot name> [workspace] [schroot custom args]" | |
echo ' workspace can be a /workspace or $HOME/workspace' | |
exit 1 | |
fi | |
name=$1 | |
# change dir if needed (try #1: $2, try #2: $HOME/$2) | |
if [ ! -z "$2" ]; then | |
[ -d "$2" ] && path=$2 || path=$HOME/$2 | |
[ -d "$path" ] && cd "$path" | |
fi | |
# let $3 and so on schroot args | |
if [ ! -z "$3" ]; then | |
shift | |
shift | |
args=$* | |
fi | |
# ensure that no one error will forceclose environment setup (default expected behavior) | |
set +e | |
set +u | |
# invoke named chroot | |
schroot -c "$name" $args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment