forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yehuda Sadeh <[email protected]>
- Loading branch information
Showing
6 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
MENV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" | ||
|
||
export PATH=${MENV_ROOT}/bin:$PATH | ||
alias mset='source $MENV_ROOT/mset.sh' | ||
|
||
case "$TERM" in | ||
xterm-*color) | ||
PS1='\[\033[$MRUN_PROMPT_COLOR;1m\]${MRUN_PROMPT}\[\033[00m\]'${PS1} | ||
;; | ||
*) | ||
PS1='${MRUN_PROMPT}'${PS1} | ||
;; | ||
esac | ||
|
||
export MRUN_CEPH_ROOT=$HOME/ceph | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ceph-menv | ||
|
||
Installation | ||
|
||
1. Build links | ||
|
||
# assuming ceph build directory is at $HOME/ceph/build | ||
$ cd ceph-menv | ||
$ ./build_links.sh | ||
|
||
A different ceph repository can be passed as the first argument to build_links.sh. | ||
|
||
2. Configure shell environment | ||
|
||
To your shell startup script (such as $HOME/.bashrc) add the following: | ||
|
||
source ~/ceph-menv/.menvrc | ||
|
||
(modify line appropriately if ceph-menv was installed at a different location) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ceph-menv | ||
|
||
Environment assistant for use in conjuction with multiple ceph vstart (or more accurately mstart) clusters. Eliminates the need to specify the cluster that is being used with each and every command. Can provide a shell prompt feedback about the currently used cluster. | ||
|
||
|
||
Usage: | ||
|
||
$ mset <cluster> | ||
|
||
|
||
For example: | ||
|
||
$ mstart.sh c1 -n | ||
$ mset c1 | ||
[ c1 ] $ ceph -w | ||
|
||
|
||
To un-set cluster: | ||
|
||
$ mset | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
DIR=`dirname $0` | ||
ROOT=$1 | ||
|
||
[ "$ROOT" == "" ] && ROOT="$HOME/ceph" | ||
|
||
mkdir -p $DIR/bin | ||
|
||
echo $PWD | ||
for f in `ls $ROOT/build/bin`; do | ||
echo $f | ||
ln -sf ../mdo.sh $DIR/bin/$f | ||
done | ||
|
||
echo "MRUN_CEPH_ROOT=$ROOT" > $DIR/.menvroot |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
cmd=`basename $0` | ||
MENV_ROOT=`dirname $0`/.. | ||
|
||
if [ -f $MENV_ROOT/.menvroot ]; then | ||
. $MENV_ROOT/.menvroot | ||
fi | ||
|
||
[ "$MRUN_CEPH_ROOT" == "" ] && MRUN_CEPH_ROOT=$HOME/ceph | ||
|
||
if [ "$MRUN_CLUSTER" == "" ]; then | ||
${MRUN_CEPH_ROOT}/build/bin/$cmd "$@" | ||
exit $? | ||
fi | ||
|
||
${MRUN_CEPH_ROOT}/src/mrun $MRUN_CLUSTER $cmd "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
get_color() { | ||
s=$1 | ||
sum=1 # just so that 'c1' isn't green that doesn't contrast with the rest of my prompt | ||
for i in `seq 1 ${#s}`; do | ||
c=${s:$((i-1)):1}; | ||
o=`printf '%d' "'$c"` | ||
sum=$((sum+$o)) | ||
done | ||
echo $sum | ||
} | ||
|
||
if [ "$1" == "" ]; then | ||
unset MRUN_CLUSTER | ||
unset MRUN_PROMPT | ||
else | ||
export MRUN_CLUSTER=$1 | ||
export MRUN_PROMPT='['${MRUN_CLUSTER}'] ' | ||
col=$(get_color $1) | ||
MRUN_PROMPT_COLOR=$((col%7+31)) | ||
fi | ||
|