Skip to content

Commit d073173

Browse files
committed
Exit immediately on error
1 parent 1c41158 commit d073173

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Diff for: installjava

100644100755
+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/data/data/com.termux/files/usr/bin/bash
22

33
#Setup
4+
set -e
45
shopt -s expand_aliases
56
alias ee='echo -e'
67

@@ -32,31 +33,31 @@ else
3233
*)
3334
ee "\e[91mERROR: Unknown architecture."; echo; exit ;;
3435
esac
35-
36+
3637
#Actual installation
3738
ee "\e[32m[*] \e[34mDownloading JDK-8 (~70Mb) for ${archname}... 🕛This will take some time, so better make a coffee.🕛"
3839
wget https://github.com/Hax4us/java/releases/download/${tag}/jdk8_${archname}.tar.gz -q
39-
40+
4041
ee "\e[32m[*] \e[34mMoving JDK to system..."
4142
mv jdk8_${archname}.tar.gz $PREFIX/share
42-
43+
4344
ee "\e[32m[*] \e[34mExtracting JDK..."
4445
cd $PREFIX/share
4546
tar -xhf jdk8_${archname}.tar.gz
46-
47+
4748
ee "\e[32m[*] \e[34mSeting-up %JAVA_HOME%..."
4849
export JAVA_HOME=$PREFIX/share/jdk8
4950
echo "export JAVA_HOME=$PREFIX/share/jdk8" >> $HOME/.profile
50-
51+
5152
ee "\e[32m[*] \e[34mCoping Java wrapper scripts to bin..."
5253
#I'm not 100% sure, but getting rid of bin contnent MAY cause some issues with %JAVA_HOME%, thus it's no longer moved - copied instead. Sorry to everyone short on storage.
5354
cp bin/* $PREFIX/bin
54-
55+
5556
ee "\e[32m[*] \e[34mCleaning up temporary files..."
5657
rm -rf $HOME/installjava
5758
rm -rf $PREFIX/share/jdk8_${archname}.tar.gz
5859
rm -rf $PREFIX/share/bin
59-
60+
6061
echo
6162
ee "\e[32mJava was successfully installed!\e[39m"
6263
echo "Enjoy your new, tasty Java :D (and a coffee, if you didn't drink it yet)"

0 commit comments

Comments
 (0)