-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathoranchelo-installer.sh
executable file
·131 lines (102 loc) · 2.5 KB
/
oranchelo-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
#! /bin/bash
show_question() {
echo -e "\033[1;34m$@\033[0m"
}
show_dir() {
echo -e "\033[1;32m$@\033[0m"
}
show_error() {
echo -e "\033[1;31m$@\033[0m"
}
end() {
echo -e "\nExiting...\n"
exit 0
}
continue() {
show_question "\nDo you want to continue? (Y)es, (N)o : \n"
read INPUT
case $INPUT in
[Yy]* ) ;;
[Nn]* ) end;;
* ) show_error "\nSorry, try again."; continue;;
esac
}
replace() {
show_question "\nFound an existing installation. Replace it? (Y)es, (N)o :\n"
read INPUT
case $INPUT in
[Yy]* ) rm -rf "$@/Oranchelo*" 2>/dev/null;;
[Nn]* ) ;;
* ) show_error "\tSorry, try again."; replace $@;;
esac
}
install() {
# PREVIEW
# Show destination directory
echo -e "\nOranchelo Icon Theme will be installed in:\n"
show_dir "\t$DEST_DIR"
if [ "$UID" -eq "$ROOT_UID" ]; then
echo -e "\nIt will be available to all users."
else
echo -e "\nTo make them available to all users, run this script as root."
fi
continue
# INSTALL
# Check destination directory
if [ ! -d $DEST_DIR ]; then
mkdir -p $DEST_DIR
elif [ -d $DEST_DIR/Oranchelo ]; then
replace $DEST_DIR
fi
echo -e "\nInstalling Oranchelo..."
# Copying files
cp -rf Oranchelo* $DEST_DIR
chmod -R 755 $DEST_DIR/Oranchelo*
echo "Installation complete!"
echo "Do not forget you have to set icon theme."
}
remove() {
# PREVIEW
# Show installation directory
if [ -d $DEST_DIR/Oranchelo ]; then
echo -e "\nOranchelo Icon Theme installed in:\n"
show_dir "\t$DEST_DIR"
if [ "$UID" -eq "$ROOT_UID" ]; then
echo -e "\nIt will remove for all users."
else
echo -e "\nIt will remove only for current user."
fi
continue
else
show_error "\nOranchelo Icon Theme is not installed in:\n"
show_dir "\t$DEST_DIR\n"
end
fi
# REMOVE
echo -e "\nRemoving Oranchelo..."
# Removing files
rm -rf $DEST_DIR/Oranchelo*
echo "Removing complete!"
echo "I hope to see you soon."
}
main() {
show_question "What you want to do: (I)nstall, (R)emove : \n"
read INPUT
case $INPUT in
[Ii]* ) install;;
[Rr]* ) remove;;
* ) show_error "\nSorry, try again."; main;;
esac
}
ROOT_UID=0
DEST_DIR=
# Destination directory
if [ "$UID" -eq "$ROOT_UID" ]; then
DEST_DIR="/usr/share/icons"
else
DEST_DIR="$HOME/.local/share/icons"
fi
echo -e "\e[1m\n+---------------------------------------------+"
echo -e "| Oranchelo Icon Theme Installer Script |"
echo -e "+---------------------------------------------+\n\e[0m"
main