blob: eee47747843b3d2025149bf458fee4e943e87e9c (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/bash -e
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
APPSTORE_HOME=`dirname "$PRG"`
APPSTORE_HOME=`cd "$APPSTORE_HOME" && pwd`
. $APPSTORE_HOME/lib/common
usage_text() {
echo "usage: $usage_app <command>"
echo ""
echo "Available porcelain commands:"
grep_path "/appstore-.*$" "$APPSTORE_HOME/bin" | \
sed "s,^.*/appstore-, ," | \
sort -n
echo ""
echo "Available plumbing commands:"
grep_path "/appstore-.*$" "$APPSTORE_HOME/libexec" | \
sed "s,^.*/appstore-, ," | \
sort -n
}
if [ $# -eq 0 ]
then
usage
fi
command=$1; shift
bin=`grep_path "/appstore-$command$" "$APPSTORE_HOME/bin"`
if [ ! -x "$bin" ]
then
bin=`grep_path "/appstore-$command$" "$APPSTORE_HOME/libexec"`
if [ ! -x "$bin" ]
then
echo "Unknown command: $command" 2>&1
exit 1
fi
fi
PATH=$APPSTORE_HOME/bin:$PATH
# TODO: this is probably a good place to clean up the environment
exec env \
"APPSTORE_HOME=$APPSTORE_HOME" \
"echo_debug=$echo_debug" \
"$bin" "$@"
|