-
Notifications
You must be signed in to change notification settings - Fork 2
/
setlXinstaller.sh
executable file
·102 lines (82 loc) · 3.15 KB
/
setlXinstaller.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
#!/usr/bin/env sh
#
# This is a script for installing setlX for UNIX-like OS
# The script is based on the official instruction on how to install setlX
# This script has to be istalled with root rights!
#
##############################################################################
# Set paths and version for the download
setlx_version=2-6-0
TmpDir="$HOME/tmp/setlX"
JarDir="/usr/local/setlX"
LibDir="$HOME/setlXlibrary"
BinDir="/usr/local/bin"
##############################################################################
#CHECK IF JAVA IS INSTALLED
if ! ( which java >/dev/null 2>&1 ) ; then
echo "Java is not installed, please install Java first!"
exit 1
fi
#CHECK for a temporary folder
if ! ( [ -d "$HOME/tmp" ] ) ; then
echo "Creating temporary folder\n\n"
mkdir $HOME/tmp/
if ! ( [ -d ${TmpDir} ] ) ; then
mkdir ${TmpDir}
fi
fi
#CHECK for curl or wget
if ! ( which wget >/dev/null 2>&1 ) ; then
#if ! ( which curl >/dev/null 2>&1 ) ; then
echo "It seems that wget is not installed.\nPlease install wget first!\n\n"
# echo "It seems that you have neither installed wget nor curl.\nPlease install wget or curl!\n\n"
exit 1
#else
#Download setlX binary
# echo "Downloading setlX binary to $HOME/tmp/setlX\n\n"
# curl -o ${TmpDir}/setlX_v${setlx_version}.binary_only.zip "http://download.randoom.org/setlX/pc/setlX_v${setlx_version}.binary_only.zip"
#fi
else
#Download setlX binary
echo "Downloading setlX binary to $HOME/tmp/setlX\n\n"
wget -O ${TmpDir}/setlX_v${setlx_version}.binary_only.zip "http://download.randoom.org/setlX/pc/setlX_v${setlx_version}.binary_only.zip"
fi
unzip ${TmpDir}/setlX_v${setlx_version}.binary_only.zip -d ${TmpDir}/
#CHECK for a setlX folder
if ! ( [ -d ${JarDir}/ ] ) ; then
echo "Creating setlX folder in /usr/local/setlX\n\n"
mkdir ${JarDir}/
fi
# find all files that match 'setlX*.jar' and copy them to ${JarDir} (default: /usr/local/setlX/)
echo "Copying setlX*.jar files\n\n"
sudo find ${TmpDir}/ -type f -name 'setlX*.jar' -exec cp '{}' ${JarDir}/ ';'
#CHECK for a setlXlibrary folder
if ! ( [ -d ${LibDir}/ ] ) ; then
echo "Creating setlX-library folder\n\n"
mkdir ${LibDir}/
fi
#Copy all files from ./setlXlibrary to LibDir
find ${TmpDir}/setlXlibrary -type f -name '*.*' -exec cp '{}' ${LibDir}/ ';'
#Entering the path of the jar- and library-files
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
echo "Adding path of jar and library-files..."
sed -i "" 's/setlXJarDirectory\=\"\.\"/setlXJarDirectory\=\"\/usr\/local\/setlX\/\"/' ${TmpDir}/setlX
sed -i "" 's/setlXlibraryPath\=\"\$HOME\/setlXlibrary\/\"/setlXlibraryPath\=\"\$HOME\/setlXlibrary\/\"/' ${TmpDir}/setlX
;;
Linux)
echo 'Linux'
echo "Adding path of jar and library-files..."
sed -i 's/setlXJarDirectory\=\"\.\"/setlXJarDirectory\=\"\/usr\/local\/setlX\/\"/' ${TmpDir}/setlX
sed -i 's/setlXlibraryPath\=\"\$HOME\/setlXlibrary\/\"/setlXlibraryPath\=\"\$HOME\/setlXlibrary\/\"/' ${TmpDir}/setlX
;;
*)
echo "It seems, that you don't use a Linux or Mac system."
exit 1
;;
esac
sudo cp ${TmpDir}/setlX ${BinDir}/
sudo chmod +x ${BinDir}/setlX
echo "Installation successful\n\n"
exit 0