|
| 1 | +function hasFailed__18_v0 { |
| 2 | + local command=$1 |
| 3 | + ${command} > /dev/null 2>&1 |
| 4 | +__AMBER_STATUS=$?; |
| 5 | +if [ $__AMBER_STATUS != 0 ]; then |
| 6 | +$(exit $__AMBER_STATUS) |
| 7 | +: |
| 8 | +fi; |
| 9 | + __AMBER_FUN_hasFailed18_v0=$(echo $__AMBER_STATUS '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//'); |
| 10 | + return 0 |
| 11 | +} |
1 | 12 | __0_name="AmberNative";
|
2 | 13 | __1_target="amber";
|
3 |
| -__2_tag="0.3.0-alpha"; |
| 14 | +__2_tag="0.3.1-alpha"; |
4 | 15 | __3_place="/opt/amber";
|
5 | 16 | __AMBER_VAL_0=$(uname -s);
|
6 | 17 | __AMBER_STATUS=$?;
|
@@ -36,57 +47,35 @@ $(exit $__AMBER_STATUS)
|
36 | 47 | fi
|
37 | 48 | fi;
|
38 | 49 | echo "Installing Amber";
|
39 |
| - isDone=0; |
40 |
| - ruby -v > /dev/null 2>&1 |
41 |
| -__AMBER_STATUS=$?; |
42 |
| -if [ $__AMBER_STATUS != 0 ]; then |
43 |
| -$(exit $__AMBER_STATUS) |
44 |
| -: |
45 |
| -fi; |
46 |
| - if [ $(echo $__AMBER_STATUS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
| 50 | + hasFailed__18_v0 "ruby -v"; |
| 51 | + hasFailed__18_v0 "curl -v"; |
| 52 | + hasFailed__18_v0 "wget -V"; |
| 53 | + if [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
47 | 54 | code="require \"open-uri\"; open(\"${__1_target}\", \"wb\") do |file|; file << open(\"${url}\").read; end";
|
48 | 55 | echo "Using ruby as a download method...";
|
49 |
| - ruby -e "${code}" |
50 |
| -__AMBER_STATUS=$?; |
51 |
| -if [ $__AMBER_STATUS != 0 ]; then |
52 |
| -$(exit $__AMBER_STATUS) |
53 |
| -: |
54 |
| -fi; |
55 |
| - isDone=1 |
56 |
| -fi; |
57 |
| - curl -v > /dev/null 2>&1 |
| 56 | + sudo ruby -e "${code}" |
58 | 57 | __AMBER_STATUS=$?;
|
59 | 58 | if [ $__AMBER_STATUS != 0 ]; then
|
60 | 59 | $(exit $__AMBER_STATUS)
|
61 | 60 | :
|
62 |
| -fi; |
63 |
| - if [ $(echo $__AMBER_STATUS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
| 61 | +fi |
| 62 | +elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
64 | 63 | echo "Using curl as a download method...";
|
65 | 64 | curl -o "${__1_target}" "${url}"
|
66 | 65 | __AMBER_STATUS=$?;
|
67 | 66 | if [ $__AMBER_STATUS != 0 ]; then
|
68 | 67 | $(exit $__AMBER_STATUS)
|
69 | 68 | :
|
70 |
| -fi; |
71 |
| - isDone=1 |
72 |
| -fi; |
73 |
| - wget -v > /dev/null 2>&1 |
74 |
| -__AMBER_STATUS=$?; |
75 |
| -if [ $__AMBER_STATUS != 0 ]; then |
76 |
| -$(exit $__AMBER_STATUS) |
77 |
| -: |
78 |
| -fi; |
79 |
| - if [ $(echo $__AMBER_STATUS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
| 69 | +fi |
| 70 | +elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
80 | 71 | echo "Using wget as a download method...";
|
81 | 72 | wget -O "${__1_target}" "${url}"
|
82 | 73 | __AMBER_STATUS=$?;
|
83 | 74 | if [ $__AMBER_STATUS != 0 ]; then
|
84 | 75 | $(exit $__AMBER_STATUS)
|
85 | 76 | :
|
86 |
| -fi; |
87 |
| - isDone=1 |
88 |
| -fi; |
89 |
| - if [ $(echo '!' ${isDone} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then |
| 77 | +fi |
| 78 | +else |
90 | 79 | echo "Neither ruby, curl or wget are installed on your system.";
|
91 | 80 | echo "Please install one of them and try again.";
|
92 | 81 | exit 1
|
|
0 commit comments