Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils/bin/sea
blob: 13f7f52fcbd1eba2859f59c6e74bd2a4ed8e8974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# this script is intended to work both in narwhal/bin and in
# any project's bin dir; it's copied by tusk --init.

# get the absolute path of the executable
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")

# resolve symlinks
while [ -h "$SELF_PATH" ]; do
	DIR=$(dirname -- "$SELF_PATH")
	SYM=$(readlink -- "$SELF_PATH")
	SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

export PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")

source "$PACKAGE_HOME/bin/activate.bash"

export OLDSEA="$SEA"
export SEA="$PACKAGE_HOME"
export SEALVL="$((SEALVL + 1))" 

if [ "$#" -lt 1 ]; then
    echo PATH="$PATH" >&2
    echo SEA="$SEA" >&2
    echo SEALVL="$SEALVL" >&2
    "$SHELL"
else
    "$SHELL" -c "$*"
fi
if [ "$OLDSEA" != "" ]; then
    echo SEA="$OLDSEA" >&2
fi
echo SEALVL="$((SEALVL - 1))" >&2