forked from mattcan/solarized-gedit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstaller
executable file
·62 lines (55 loc) · 1.14 KB
/
installer
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
#!/bin/bash
# shows usage instructions
usage()
{
cat << EOF
usage: $0 [options]
This script installs the Solarized styles for gedit.
OPTIONS:
-h Shows this message
-a Install for all users
-l Install only for you
EOF
}
chkdir()
{
if [ ! -d "$INSTALLPATH" ]; then
if [ "$NEEDSUDO" == true ]; then
sudo mkdir -p "$INSTALLPATH"
else
mkdir -p "$INSTALLPATH"
fi
fi
}
# path to install to
INSTALLPATH=$HOME/.local/share/gedit/styles
# will need to use sudo to install for all users
NEEDSUDO=false
# loop through passed arguments
while getopts "hal" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
a)
INSTALLPATH=/usr/share/gtksourceview-3.0/styles
NEEDSUDO=true
;;
l)
INSTALLPATH=$HOME/.local/share/gedit/styles
;;
?)
INSTALLPATH=$HOME/.local/share/gedit/styles
;;
esac
done
# install for all users when sudo set to true
if [ "$NEEDSUDO" == true ]; then
chkdir
sudo cp solarized-*.xml "$INSTALLPATH"
else
chkdir
cp solarized-*.xml "$INSTALLPATH"
fi