forked from mriza/XMind-Linux-Installer
-
Notifications
You must be signed in to change notification settings - Fork 4
/
xmind-installer.sh
133 lines (120 loc) · 2.54 KB
/
xmind-installer.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
##
## XMind 8 Installer
##
## Author: DinoLai
## Email: [email protected]
## Fork from: https://github.com/mriza/XMind-Linux-Installer
##
## Licensed under GPL V3
## Please refer to https://www.gnu.org/licenses/gpl-3.0.en.html
##
## How to use this script
## 1. Download XMind zip file from official website
## 2. run the script using privileged user or using sudo command
##
## example
## sudo bash xmind8-installer.sh
status_flag=0
ARCH=`uname -m`
XMIND_DIR="/opt/xmind"
if [ $ARCH == "x86_64" ]
then
VERSION="XMind_amd64"
BIN_DIR=$XMIND_DIR/$VERSION
elif [ $ARCH == "i686" ]
then
VERSION="XMind_i386"
BIN_DIR=$XMIND_DIR/$VERSION
else
echo 'Sorry, cannot verify your OS architecture'
echo 'The installer will now exit'
exit 1
fi
echo "[setup] Installing dependencies...."
apt-get install default-jre libgtk2.0-0 libwebkitgtk-1.0-0 lame libc6 libglib2.0-0
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Extracting files..."
unzip -q xmind-8-update?-linux.zip -d xmind
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Installing..."
mv xmind /opt/
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Create command..."
if [ $VERSION == "XMind_amd64" ]
then
cp usr/bin/XMind_64 /usr/bin/XMind
else
cp usr/bin/XMind_32 /usr/bin/XMind
fi
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Copy share folder to /usr/share for create launcher, mime, and icon..."
cp -dR --no-preserve all usr/share/. /usr/share/.
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Creating workspaces..."
mkdir $HOME/{workspace,.configuration}
cp -R $BIN_DIR/configuration/* $HOME/.configuration
chown -R $SUDO_USER:$SUDO_GID $HOME/workspace $HOME/.configuration
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Post installatin configurations..."
sed -i "s/\.\.\/workspace/@user\.home\/workspace/g" "$BIN_DIR/XMind.ini"
sed -i "s/\.\/configuration/@user\.home\/\.configuration/g" "$BIN_DIR/XMind.ini"
sed -i "s/^\.\./\/opt\/xmind/g" "$BIN_DIR/XMind.ini"
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Updating mime database and font cache, please waiting few seconds..."
# Update application mime database
update-mime-database /usr/share/mime/
# Update mime cache database
update-desktop-database /usr/share/applications
# Update font cache
fc-cache --force
if [ $? != 0 ]
then
status_flag=1
echo "Failed"
else
echo "OK"
fi
echo "Installation finished. Happy mind mapping!"