-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·81 lines (65 loc) · 2.29 KB
/
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
#!/bin/bash
userServiceDirectory() {
echo "$URSIM_ROOT/service"
}
userDaemonManagerDirectory() {
echo "/etc/runit/runsvdir-ursim-$VERSION"
}
installDaemonManager() {
local userServiceDirectory=`userServiceDirectory`
local userDaemonManagerDirectory=`userDaemonManagerDirectory`
local userDaemonManagerRunScript="$userDaemonManagerDirectory/run"
echo "Installing daemon manager package"
sudo apt-get -y install runit
echo "Creating user daemon service directory"
sudo mkdir -p $userDaemonManagerDirectory
echo '#!/bin/sh' | sudo tee $userDaemonManagerRunScript >/dev/null
echo 'exec 2>&1' | sudo tee -a $userDaemonManagerRunScript >/dev/null
echo "exec chpst -u`whoami` runsvdir $userServiceDirectory" | sudo tee -a $userDaemonManagerRunScript >/dev/null
sudo chmod +x $userDaemonManagerRunScript
echo "Starting user daemon service"
sudo ln -sf $userDaemonManagerDirectory /etc/service/
mkdir -p $userServiceDirectory
}
# if we are not running inside a terminal, make sure that we do
tty -s
if [[ $? -ne 0 ]]
then
xterm -e "$0"
exit 0
fi
set -e
commonDependencies='libcurl3 openjdk-8-jre libjava3d-* ttf-dejavu* fonts-ipafont fonts-baekmuk fonts-nanum fonts-arphic-uming fonts-arphic-ukai'
if [[ $(getconf LONG_BIT) == "32" ]]
then
packages=`ls $PWD/ursim-dependencies/*i386.deb`
pkexec bash -c "apt-get -y install $commonDependencies && (echo '$packages' | xargs dpkg -i)"
else
packages=`ls $PWD/ursim-dependencies/*amd64.deb`
pkexec bash -c "apt-get -y install lib32gcc1 lib32stdc++6 libc6-i386 $commonDependencies && (echo '$packages' | xargs dpkg -i)"
fi
versionString=`java -version 2>&1 | head -n1 | grep 1\.6\.0`
if [[ -z $versionString ]]
then
echo "Please select Java version 1.6 using update-alternatives"
return
fi
source version.sh
URSIM_ROOT=$(dirname $(readlink -f $0))
echo "Install Daemon Manager"
installDaemonManager
for TYPE in UR3 UR5 UR10
do
FILE=$HOME/Desktop/ursim-$VERSION.$TYPE.desktop
echo "[Desktop Entry]" > $FILE
echo "Version=$VERSION" >> $FILE
echo "Type=Application" >> $FILE
echo "Terminal=false" >> $FILE
echo "Name=ursim-$VERSION $TYPE" >> $FILE
echo "Exec=${URSIM_ROOT}/start-ursim.sh $TYPE" >> $FILE
echo "Icon=${URSIM_ROOT}/UR_Logo_24x24.png" >> $FILE
chmod +x $FILE
done
pushd $URSIM_ROOT/lib &>/dev/null
chmod +x ../URControl
popd &>/dev/null