forked from devzero2000/RPM5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devtool.bashrc
36 lines (34 loc) · 1.27 KB
/
devtool.bashrc
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
##
## devtool.bashrc -- Development Tool GNU Bash convenience function
## Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
##
devtool () {
workdir=`pwd`
basedir=$workdir
while [ ".$basedir" != . ]; do
if [ -f "$basedir/devtool" ]; then
break
else
basedir=`echo "${basedir}" | sed -e 's;[^/]*$;;' -e 's;/*$;;'`
fi
done
if [ ".$basedir" = . ]; then
echo "devtool: sorry, you are staying outside any \"devtool\" controlled area"
else
platform=`(shtool platform -n -L -S "" -C "+" -F '%<ap>-%<sp>' || uname -s) 2>/dev/null`
if [ ".$1" = ".setup-platform" ]; then
if [ ! -d "${basedir}/.devtool/${platform}" ]; then
shtool mkdir -f -p -m 755 "${basedir}/.devtool/${platform}"
fi
else
subdir=`echo "$workdir" | sed -e "s;^$basedir/*;;"`
( if [ -d "${basedir}/.devtool/${platform}/${subdir}" ]; then
cd "${basedir}/.devtool/${platform}/${subdir}"
$basedir/devtool "$@" | tee "${basedir}/.devtool/${platform}/devtool.log"
else
$basedir/devtool "$@" | tee "${basedir}/devtool.log"
fi
) || return $?
fi
fi
}