forked from cmatthew/Lind-misc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlindfs
executable file
·57 lines (48 loc) · 1.27 KB
/
lindfs
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
#!/bin/sh
ret=0
cwd="$PWD"
trap 'cd "$cwd"; exit "$ret"' EXIT
export LIND_PREFIX="${LIND_PREFIX:-$HOME}"
export LIND_BASE="${LIND_BASE:-$LIND_PREFIX/lind_project}"
export LIND_SRC="${LIND_SRC:-$LIND_BASE/lind}"
export REPY_PATH="${REPY_PATH:-$LIND_SRC/repy}"
export NACL_SDK_ROOT="${NACL_SDK_ROOT:-$REPY_PATH/sdk}"
export PYTHON="${PYTHON:-python2}"
export PNACLPYTHON="${PNACLPYTHON:-python2}"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-/lib/glibc}"
if test $# -ge 0; then
args=''
for i in $(seq -s' ' 1 $#); do
eval "arg=\"\$(realpath -qe --relative-to \"\$REPY_PATH/repy\" \$$i)\""
eval "args=\"\$args \${arg:-\$$i}\""
done
set -- $args
fi
cd "$REPY_PATH/repy" || exit 1
if command -v tput >/dev/null 2>&1; then
reset="$(tput -T xterm sgr0)"
purple="$(tput -T xterm setaf 13)"
else
reset=""
purple=""
fi
if test "$1" = cp || test "$1" = update; then
action="$1"
shift
set -- "$action" "$REPY_PATH/repy" "$@"
fi
printf 'running: [%s%s%s]\n' "$reset$purple" "python2 lind_fs_utils.py $*" "$reset"
# if command is "cp" retry using "update" on failure
if test "$1" = cp; then
python2 lind_fs_utils.py "$@" 2>/dev/null
ret=$?
if test "$ret" -ne 0; then
shift
python2 lind_fs_utils.py update "$@"
ret=$?
fi
else
python2 lind_fs_utils.py "$@"
ret=$?
fi
exit "$ret"