forked from mriza/XMind-Linux-Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmind-install.sh
executable file
·133 lines (120 loc) · 3.35 KB
/
xmind-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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/usr/env bash
##
## XMind 8 Installer
##
## Author: Felipe Morato - [email protected]
## Author: Mohammad Riza Nurtam - [email protected]
##
## Licensed under GPL V3
## Please refer to https://www.gnu.org/licenses/gpl-3.0.en.html
##
## This script downloads and installs xmind for the current user.
## .xmind files open automatically from the file manager in
## XMind and a logo is provided. Some GNOME themes already come
## with XMind icons and they have precedence over the one that is
## included.
##
## Find configuration options on xmind.conf
##
## To remove XMind from the system, see xmind-uninstall.sh.
##
## How to use this script
## 1. run the script using unprivileged user
##
## example
## sudo bash xmind-install.sh
function echoY() {
prompt="$1"
echo -e -n "\033[32m$prompt"
echo -e -n '\033[0m'
echo ''
}
function echoR() {
prompt="$1"
echo -e -n "\033[31m$prompt"
echo -e -n '\033[0m'
echo ''
}
source ./xmind.conf
ARCH=$(uname -m)
if [ "$ARCH" == "x86_64" ]
then
VERSION="XMind_amd64"
elif [ "$ARCH" == "i686" ]
then
VERSION="XMind_i386"
else
echo 'Sorry, cannot verify your OS architecture'
echo 'The installer will now exit'
exit 1
fi
BIN_DIR=$XMIND_DIR/$VERSION
dl() {
echoY "Downloading XMIND 8 to ${XMIND_FILENAME}"
if ! wget --user-agent="${USER_AGENT}" -O "${XMIND_FILENAME}" "${XMIND_LINK}${XMIND_FILENAME}"; then
echoR "ERROR: couldn't download XMIND" >&2
exit 1
fi
}
xtrct(){
echoY "Extracting files..."
mkdir -p "${XMIND_DIR}"
if ! unzip -q "${XMIND_FILENAME}" -d "${XMIND_DIR}"; then
echoR "ERROR: couldn't extract XMIND" >&2
exit 1
fi
echoY "Removing downloaded file..."
rm "${XMIND_FILENAME}"
}
fnt(){
echoY "Installing additional fonts..."
mkdir -p "$HOME"/.local/share/fonts/xmind
cp -R "$XMIND_DIR"/fonts/* "$HOME"/.local/share/fonts/xmind
fc-cache -f
}
lnchr(){
echoY "Creating laucher..."
cat << EOF > "$HOME"/.local/share/applications/xmind.desktop
[Desktop Entry]
Comment=Create and share mind maps.
Exec=JAVA_HOME=/usr/lib/jvm/java-1.8.0/jre/ $BIN_DIR/XMind %F
Name=XMind 8
Encoding=UTF-8
Terminal=false
Type=Application
StartupNotify=true
Categories=Office;
Icon=xmind
MimeType=application/xmind;
EOF
update-desktop-database "$HOME"/.local/share/applications
}
cnfg(){
echoY "Creating workspace and configuration..."
mkdir -p "${XMIND_CONFIG}"
mkdir -p "${XMIND_WORKSPACE}"
sed -i "s/\.\/configuration/@user\.home\/\.config\/xmind/g" "$BIN_DIR/XMind.ini"
sed -i "s/\.\.\/workspace/@user\.home\/xmind\-workspace/g" "$BIN_DIR/XMind.ini"
sed -i "s/\.xmind/\.config\/xmind/g" "$BIN_DIR/XMind.ini"
sed -i "s/\.\./\@user\.home\/XMind8/g" "$BIN_DIR/XMind.ini"
sed -i "s/\/\.xmind/\/\.config\/xmind/g" "$BIN_DIR/configuration/config.ini"
cp -R "$BIN_DIR"/configuration/* "${XMIND_CONFIG}"
}
mimeicns(){
echoY "Updating MIME database and icons"
mkdir -p "$HOME"/.local/share/mime/packages/
cp xmind.xml "$HOME"/.local/share/mime/packages/
update-mime-database "$HOME"/.local/share/mime
mkdir -p "$HOME"/.local/share/icons/hicolor/mimetypes/
mkdir -p "$HOME"/.local/share/icons/hicolor/scalable/apps/
cp xmind.svg "$HOME"/.local/share/icons/hicolor/mimetypes/
cp xmind.svg "$HOME"/.local/share/icons/hicolor/scalable/apps/application-xmind.svg
gtk-update-icon-cache --quiet "$HOME/.local/share/icons/hicolor/" -f
}
dl
xtrct
fnt
lnchr
cnfg
mimeicns
echoY "Installation finished. Happy mind mapping!"