-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-prot16-xfce-terminal.sh
executable file
·77 lines (62 loc) · 2.62 KB
/
remove-prot16-xfce-terminal.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
#!/bin/sh
# Remove the already installced Prot16 colour schemes for Xfce4 terminal
# NOTE This script requires sudo privileges to remove files from the /usr/ directory
# NOTE The /usr/ directory makes the files available to all users
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Set global variables
gh_repo="prot16-xfce4-terminal"
gh_desc="Prot16 themes"
temp_repo=/tmp/$gh_repo/$gh_repo-master
# Some colours for echo output
greenfg=`tput setaf 2`
bluefg=`tput setaf 4`
magentafg=`tput setaf 5`
colourreset=`tput sgr0`
# Retrieve the latest git archive
echo "${greenfg}=> Getting the latest version from GitHub ...${colourreset}"
wget -O "/tmp/$gh_repo.tar.gz" \
https://github.com/protesilaos/$gh_repo/archive/master.tar.gz
# Decompress the archive
echo "${greenfg}=> Unpacking archive ...${colourreset}"
# Check if staging directory already exists
# NOTE this should only be the case if user attempts multiple installs
if [ -e "/tmp/$gh_repo" ]; then
rm -rf /tmp/$gh_repo
fi
# Make staging directory
mkdir /tmp/$gh_repo
tar -xzf "/tmp/$gh_repo.tar.gz" -C /tmp/$gh_repo
# Delete existing prot16 repo
echo "${magentafg}=> Deleting any old instance of the $gh_desc ...${colourreset}"
# NOTE The `rm -f` option is for skipping non existing files
for item in $(ls ${temp_repo})
do
if [ -e "$item" ]; then
sudo rm -f /usr/share/xfce4/terminal/colorschemes/$item
sudo rm -f $HOME/.local/share/xfce4/terminal/colorschemes/$item
else
echo "No old files to remove"
fi
done
# # Prepare installation
# echo "${greenfg}=> Installing ...${colourreset}"
# for theme in $(ls ${temp_repo} | find ${temp_repo} -name '*.theme')
# do
# sudo cp --no-preserve=mode,ownership -rf \
# $theme /usr/share/xfce4/terminal/colorschemes/
# done
# Remove temporary setup
echo "${magentafg}=> Clearing cache ...${colourreset}"
rm -rf "/tmp/$gh_repo.tar.gz"
rm -rf "/tmp/$gh_repo-master"
echo "${greenfg}=> Done!${colourreset}"
echo "${bluefg}For more about Prot16 see https://protesilaos.com/schemes${colourreset}"