-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·66 lines (50 loc) · 1.99 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
#!/bin/bash
_version="7.5-update1"
_wdir=`mktemp -d` && cd $dir
declare -r TRUE=0
declare -r FALSE=1
is_root_user() {
[ $(id -u) -eq 0 ] && return $TRUE || return $FALSE
}
install() {
echo "Starting Xmind Installation"
echo " * Downloading:"
wget -U 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' http://www.xmind.net/xmind/downloads/xmind-${_version}-linux_amd64.deb || exit 1
echo " * Extracting DEB:"
ar -x xmind-${_version}-linux_amd64.deb || echo "==> Warning: failed to extract"
echo " * Exctracting data.tar.gz:"
tar xf data.tar.gz || echo "==> Warning: failed to extract"
echo " * Moving xmind to /opt"
[ -d /opt/xmind ] && rm -rf /opt/xmind && echo "/opt/xmind already existing. Removed it .."
mv usr/lib/xmind /opt/ || echo "==> Warning: failed to move xmind to /opt"
echo " * Moving XMind.ini"
mv etc/XMind.ini /opt/xmind/ || echo "==> Warning: failed to move XMind.ini to /opt/xmind"
echo " * Changing XMind lib path to /opt/xmind/XMind"
sed -i -e 's|^XMIND=.*|XMIND=/opt/xmind/XMind|g' usr/bin/XMind || echo "==> Warning: failed to substitue"
echo " * Moving Xmind to /usr/bin/XMind"
mv usr/bin/XMind /usr/bin/ || echo "==> Warning: failed to move"
echo " * Copying usr/share/* to /usr/share"
cp -Rv usr/share/* /usr/share/ || echo "==> Warning: failed to copy"
echo " * Editing desktop entry"
sed -i -e 's|^Exec=.*|Exec=XMind %U|g' /usr/share/applications/xmind.desktop
}
cleanup() {
echo " * Leaving working dir"
cd ..
echo " * Removing working dir"
rm -Rv "${_wdir}" || echo "==> Warning: failed to remove working dir"
}
update_mime_desktop_db() {
set -e
echo "Updating desktop database"
update-desktop-database
echo "Updating mime database"
update-mime-database /usr/share/mime/
echo "Updating fonts cache"
fc-cache --force
}
is_root_user || echo "No root privileges. Aborting ..." && exit 1
install
update_mime_desktop_db
cleanup
exit 0