-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.sh
executable file
·103 lines (82 loc) · 2.43 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
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
#!/usr/bin/env bash
#
# @name : install.sh
# @version : 2.0.0
# @date : 12/05/2019
# @description : Install le last git version of XXXXX theme for KDE-Plasma.
# @website : https://github.com/Rokin05
#
##
set -e
name="darkine"
gh_repo="darkine-kde"
E='echo -e'
OUT="/dev/null"
: "${PREFIX:=/usr}"
: "${uninstall:=false}"
title() {
$E ; $E "[+]\e[1;33m ${1} \e[m"
$E "------------------------------------"
}
msg() {
$E " - ${1}"
}
_rm() {
# removes parent directories if empty
sudo rm -rf "${1}"
sudo rmdir -p "$(dirname "${1}")" 2>$OUT || true
}
_download() {
msg "Getting the latest version from GitHub ..."
msg "(https://github.com/Rokin05/${gh_repo}/archive/master.tar.gz)"
wget --quiet -O "${temp_file}" \
"https://github.com/Rokin05/${gh_repo}/archive/master.tar.gz"
msg "Unpacking archive ..."
tar -xzf "${temp_file}" -C "${temp_dir}"
}
_uninstall() {
msg "Deleting ${name^}"
_rm "${PREFIX}/share/plasma/look-and-feel/${name,,}"
_rm "${PREFIX}/share/plasma/desktoptheme/${name,,}"
_rm "${PREFIX}/share/color-schemes/${name^}.colors"
_rm "${PREFIX}/share/aurorae/themes/${name^}-classic"
_rm "${PREFIX}/share/aurorae/themes/${name^}-round"
_rm "${PREFIX}/share/Kvantum/${name^}"
_rm "${PREFIX}/share/icons/${name,,}"
_rm "${PREFIX}/share/sddm/themes/${name,,}"
_rm "${PREFIX}/share/wallpapers/${name^}"
_rm "${PREFIX}/share/konsole/Darkine.colorscheme"
_rm "${PREFIX}/share/themes/${name^}"
}
_install() {
msg "Installing"
sudo cp -R \
"${temp_dir}/${gh_repo}-master/plasma" \
"${temp_dir}/${gh_repo}-master/color-schemes" \
"${temp_dir}/${gh_repo}-master/aurorae" \
"${temp_dir}/${gh_repo}-master/Kvantum" \
"${temp_dir}/${gh_repo}-master/icons" \
"${temp_dir}/${gh_repo}-master/sddm" \
"${temp_dir}/${gh_repo}-master/wallpapers" \
"${temp_dir}/${gh_repo}-master/konsole" \
"${temp_dir}/${gh_repo}-master/themes" \
"${PREFIX}/share"
}
_cleanup() {
msg "Clearing cache"
rm -rf "${temp_file}" "${temp_dir}" \
~/.cache/plasma-svgelements-${name,,}* \
~/.cache/plasma_theme_${name,,}*.kcache \
~/.cache/icon-cache.kcache
}
temp_file="$(mktemp -u)"
temp_dir="$(mktemp -d)"
title "${name^}"
trap _cleanup EXIT HUP INT TERM
if [ "$uninstall" = "false" ]; then
_download
_uninstall
_install
else
_uninstall
fi