forked from forge/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forge-install.sh
115 lines (94 loc) · 2.66 KB
/
forge-install.sh
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
# This is the Forge install script!
# To install Forge
# Just open up your terminal and type:
# curl http://forge.jboss.org/sh | sh
# This way to install FORGE currently works with:
# Mac OSX and Linux
# POSIX sh script
set -e
set -u
#using stderr
exec 1>&2
#OS Check
UNAME=$(uname)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
echo "Sorry: this OS is not supported yet."
exit 1
fi
#Java Check
if type -p java; then
_java=java
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
_java="$JAVA_HOME/bin/java"
else
echo "Java not installed . Please install java. Aborting"
exit 1
fi
if [ "$_java" ]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [ "$version" \< "1.7" ]; then
echo "JDK Version is less than 1.7 . Forge requires JDK 7+ . Aborting."
exit 1
fi
fi
trap "echo Installation failed." EXIT
#Clean Installation
if [ -d ~/forge ]; then
echo "Removing your existing Forge installation."
rm -rf ~/forge
fi
INSTALL_DIR=~/forge
INSTALLER_DIR=~/.forge
rm -rf $INSTALLER_DIR
mkdir $INSTALLER_DIR
mkdir $INSTALL_DIR
echo "Downloading Forge"
curl --location --fail --progress-bar https://repository.jboss.org/nexus/service/local/artifact/maven/redirect\?r\=releases\&g\=org.jboss.forge\&a\=forge-distribution\&v\=LATEST\&e\=zip\&c\=offline > $INSTALLER_DIR/forge_installer.zip
test -f $INSTALLER_DIR/forge_installer.zip
unzip $INSTALLER_DIR/forge_installer.zip -d $INSTALL_DIR
PACKAGE="$(ls $INSTALL_DIR)"
rm -rf $INSTALLER_DIR
test -x $INSTALL_DIR/$PACKAGE
echo
echo "FORGE has been installed inside the directory : "$ ~/"forge."
echo
trap - EXIT
FORGE_HOME=~/forge/$PACKAGE
#Adding The Path Variables to ~/.bash_profile
if [ -f ~/.bash_profile ];then
{
echo export FORGE_HOME=~/forge/$PACKAGE
echo
echo export PATH="$PATH":$FORGE_HOME/bin
} >> ~/.bash_profile
fi
#Adding The Path Variables to ~/.bashrc
if [ -f ~/.bashrc ];then
{
echo export FORGE_HOME=~/forge/$PACKAGE
echo
echo export PATH="$PATH":$FORGE_HOME/bin
} >> ~/.bashrc
fi
#Adding The Path Variables to ~/.profile
if [ -f ~/.profile ];then
{
echo export FORGE_HOME=~/forge/$PACKAGE
echo
echo export PATH="$PATH":$FORGE_HOME/bin
} >> ~/.profile
fi
cat <<EOF
To get started fast:
run forge - located in $FORGE_HOME/bin/
localhost:~ $ forge
[~] $
If you have not yet seen the Forge built-in commands, you may either press TAB to see a list of the currently available commands, or get a more descriptive list by typing:
$ command-list
Then to get started - see the docs at
http://forge.jboss.org/documentation
Consider installing Git and Maven 3.1+ (both optional)
Restart Terminal to use forge.
EOF
trap - EXIT