~galacpropo-deactivatedaccount-deactivatedaccount/minimal-de/trunk

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
#!/bin/bash

# MDE - Minimal Desktop Environment
# MDE extras (un)installer -- 'mde-extras'

# Copyright 2014 GalacticProportions
# Licensed under the Apache License 2.0
# A copy of the license can be obtained at
# 	http://www.apache.org/licenses/LICENSE-2.0

syntax() {
	echo "mde-extras: syntax: $0 <i|r|u> [-oh]" >&2
}

# ----------------------------

# Am I root?
if [[ "$UID" != "0" ]]; then
	echo "mde-extras: must be root to do that"
	exit 1
fi

# Do I have a command?
if [[ "$#" == "0" ]]; then
	echo "mde-extras: no command given, assuming i"
	echo "mde-extras: for syntax, run \"$0 + -h\""
	echo "mde-extras: pausing for 3 seconds to allow Ctrl+C"
	sleep 3s
	command="i"
fi

# Extract the command.
[ -z "$command" ] && command=$1
shift

# Options
exec 3>/dev/null 4>/dev/null
while getopts ":oh" opt; do
	case $opt in
		o)
			exec 3>&1 4>&2
			;;
		h)
			syntax
			exit 0
			;;
		\?)
			syntax
			exit 1
			;;
	esac
	shift; OPTIND=1
done

# ----------------------

# Install
install() {
	echo -n "Installing GTK themes..."
	pacman -S --noconfirm --needed gtk-engines gnome-icon-theme >&3 2>&4
	echo "ok"
	
	echo -n "Installing GTK configurator..."
	pacman -S --noconfirm --needed lxappearance >&3 2>&4
	echo "ok"
	
	echo -n "Installing cursor themes..."
	pacman -S --noconfirm --needed xcursor-themes xcursor-premium xcursor-bluecurve >&3 2>&4
	echo "ok"
}

# Uninstall
uninstall() {
	echo -n "Removing GTK themes..."
	pacman -Rc --noconfirm gtk-engines gnome-icon-theme >&3 2>&4
	echo "ok"
	
	echo -n "Removing GTK configurator..."
	pacman -Rc --noconfirm lxappearance >&3 2>&4
	echo "ok"
		
	echo -n "Removing cursor themes..."
	pacman -Rc --noconfirm xcursor-themes xcursor-premium xcursor-bluecurve >&3 2>&4
	echo "ok"
}

# Upgrade
upgrade() {
	echo -n "Removing outdated packages..."
#	pacman -Rc --noconfirm *** >&3 2>&4
	echo "ok"
	
	echo
	echo "To finish, run $0 i."
}

case $command in
	i|install)
		install
		;;
	r|remove)
		uninstall
		;;
	u|upgrade)
		upgrade
		;;
	*)
		syntax
		exit 1
		;;
esac