forked from crystax/android-crew-staging
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrew
executable file
·73 lines (63 loc) · 1.81 KB
/
crew
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
crew_file_dir=$(cd $(dirname $0); pwd)
if [[ -z $CREW_NDK_DIR ]]; then
dev_ndk_dir="$(dirname $crew_file_dir)/platform/ndk"
if [[ -d $dev_ndk_dir ]]; then
CREW_NDK_DIR=$dev_ndk_dir
elif [[ $(basename $crew_file_dir) == "crew.dir" ]]; then
CREW_NDK_DIR=$(cd $(dirname $crew_file_dir); pwd)
else
echo "error: could not find NDK directory"
exit 1
fi
fi
if [[ -z $CREW_TOOLS_DIR ]]; then
crew_host_os=$(uname -s | tr '[:upper:]' '[:lower:]')
crew_host_cpu=$(uname -m)
CREW_TOOLS_DIR="$CREW_NDK_DIR/prebuilt/$crew_host_os-$crew_host_cpu"
fi
if [[ -f "$CREW_TOOLS_DIR/bin/ruby" ]]; then
crew_ruby="$CREW_TOOLS_DIR/bin/ruby"
unset GEM_HOME
unset GEM_PATH
unset RUBYLIB
unset RUBYOPT
else
crew_ruby=ruby
warnings="yes"
for arg in "$@"; do
if [[ "$arg" == "-W" || "$arg" == "--no-warnings" ]]; then
warnings="no"
break
fi
done
if [[ "$warnings" == "yes" ]]; then
echo "Warning: using system ruby"
fi
fi
if [[ -z $SSL_CERT_FILE ]]; then
SSL_CERT_FILE="$crew_file_dir/etc/ca-certificates.crt"
fi
export LD_LIBRARY_PATH="$CREW_TOOLS_DIR/lib"
export DYLD_LIBRARY_PATH="$CREW_TOOLS_DIR/lib"
export SSL_CERT_FILE CREW_NDK_DIR CREW_TOOLS_DIR
"$crew_ruby" -W0 "$crew_file_dir/crew.rb" "$@"
status=$?
if [[ $status != 0 ]]; then
exit $status
fi
if [[ -f "$crew_file_dir/crew.new" ]]; then
exec "$crew_file_dir/bin/update-crew-script.sh $crew_file_dir"
fi
if [[ -d "$CREW_NDK_DIR/postpone" ]]; then
echo "Start postponed upgrade process"
"$CREW_NDK_DIR/postpone/upgrade.sh"
status=$?
if [[ $status != 0 ]]; then
echo "= ERROR: upgrade script failed!"
exit $status
else
echo "= Cleaning up"
rm -rf "$CREW_NDK_DIR/postpone"
fi
fi