-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·65 lines (59 loc) · 2.34 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
#!/bin/bash
_INSTALL_PREFIX=/usr/local/
_AUTOSTART_DIR=/etc/xdg/autostart
_APP_DIR=/usr/local/share/applications
uninstall_indicatoremojitwo(){
# Remove files
rm -f $_INSTALL_PREFIX/bin/indicator-emojitwo
rm -f $_AUTOSTART_DIR/indicator-emojitwo_autostart.desktop
rm -rf $_INSTALL_PREFIX/share/indicator-emojitwo
# Remove desktop entry
rm -f $_APP_DIR/indicator-emojitwo.desktop
# Uninstall iconsa
for SIZE in 16 22 24 32 48 64 ; do
xdg-icon-resource uninstall --theme ubuntu-mono-dark --size ${SIZE} indicator-emojitwo
xdg-icon-resource uninstall --theme ubuntu-mono-light --size ${SIZE} indicator-emojitwo
xdg-icon-resource uninstall --theme default --size ${SIZE} indicator-emojitwo
done
}
install_indicatoremojitwo(){
# Make directories
mkdir -p $_INSTALL_PREFIX/bin
mkdir -p $_AUTOSTART_DIR
mkdir -p $_INSTALL_PREFIX/share/indicator-emojitwo
# Copy files
cp indicator-emojitwo $_INSTALL_PREFIX/bin
cp indicator-emojitwo_autostart.desktop $_AUTOSTART_DIR
cp -rf assets $_INSTALL_PREFIX/share/indicator-emojitwo/
# Fix autostart paths
sed -i $_AUTOSTART_DIR/indicator-emojitwo_autostart.desktop -e "s*/usr*$_INSTALL_PREFIX*g"
# Install icons
for SIZE in 16 22 24 32 48 64 ; do
xdg-icon-resource install --theme ubuntu-mono-dark --size ${SIZE} assets/icon-mono-dark-${SIZE}.png indicator-emojitwo
xdg-icon-resource install --theme ubuntu-mono-light --size ${SIZE} assets/icon-mono-light-${SIZE}.png indicator-emojitwo
xdg-icon-resource install --theme default --size ${SIZE} assets/icon-default-${SIZE}.png indicator-emojitwo
done
# Install desktop entry
mkdir -p $_APP_DIR
cp -f indicator-emojitwo.desktop $_APP_DIR
}
cd "${0%/*}" || exit
if [ "$(id -u)" != "0" ]; then
echo "Since you are running this as plain user, the program will be installed just for the current user."
_INSTALL_PREFIX=~/.local
_AUTOSTART_DIR=~/.config/autostart
_APP_DIR=~/.local/share/applications
else
_INSTALL_PREFIX=/usr/local
_AUTOSTART_DIR=/etc/xdg/autostart
_APP_DIR=/usr/local/share/applications
fi
if [ -f "$_INSTALL_PREFIX/bin/indicator-emojitwo" ] ; then
read -p -r "Installation detected. Press enter to uninstall or Ctrl-C to abort"
uninstall_indicatoremojitwo
echo "Uninstall completed."
else
read -p -r "Press enter to install indicator-emojitwo or Ctrl-C to abort"
install_indicatoremojitwo
echo "Installation completed."
fi