-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·194 lines (159 loc) · 4.29 KB
/
install.sh
File metadata and controls
executable file
·194 lines (159 loc) · 4.29 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/env bash
# --------------------------------------------------
# Conky Installer (Portable / Resilient / Multi-distro)
# By Fernando Gilli fernando<at>wekers(dot)org
# Last modified:2026-03-19
# --------------------------------------------------
set -u # evita variáveis não definidas (sem quebrar o script)
echo "[Conky] Preparing environment..."
# --------------------------------------------------
# Detect OS
# --------------------------------------------------
OS_ID="unknown"
if [ -f /etc/os-release ]; then
. /etc/os-release
OS_ID=$ID
fi
# --------------------------------------------------
# Helper: safe command
# --------------------------------------------------
safe_run() {
"$@" || {
echo "[Conky] Warning: command failed → $*"
return 0
}
}
# --------------------------------------------------
# Install Debian / Ubuntu / Mint
# --------------------------------------------------
install_debian() {
echo "[Conky] Detected Debian/Ubuntu/Mint"
echo "[Conky] Updating package lists..."
if ! sudo apt update; then
echo "[Conky] Warning: apt update failed (continuing anyway)"
fi
# Detect correct Conky package
if apt-cache show conky-all >/dev/null 2>&1; then
CONKY_PKG="conky-all"
else
CONKY_PKG="conky"
fi
echo "[Conky] Installing dependencies..."
safe_run sudo apt install -y \
"$CONKY_PKG" \
curl \
bc \
libxml2-utils \
lm-sensors \
imagemagick \
perl \
jq \
cpanminus
# --------------------------------------------------
# Install Perl module (Moon phase)
# --------------------------------------------------
if ! perl -MAstro::MoonPhase -e1 2>/dev/null; then
echo "[Conky] Installing Astro::MoonPhase..."
if command -v cpanm >/dev/null; then
safe_run sudo cpanm Astro::MoonPhase
else
safe_run sudo cpan -T -i Astro::MoonPhase
fi
else
echo "[Conky] Astro::MoonPhase already installed"
fi
}
# --------------------------------------------------
# Fedora / RHEL
# --------------------------------------------------
install_fedora() {
echo "[Conky] Detected Fedora/RHEL"
safe_run sudo dnf install -y \
conky \
curl \
bc \
libxml2 \
lm_sensors \
ImageMagick \
perl \
jq \
perl-App-cpanminus
if ! perl -MAstro::MoonPhase -e1 2>/dev/null; then
safe_run sudo cpanm Astro::MoonPhase
fi
}
# --------------------------------------------------
# Arch Linux
# --------------------------------------------------
install_arch() {
echo "[Conky] Detected Arch Linux"
safe_run sudo pacman -Sy --noconfirm \
conky \
curl \
bc \
libxml2 \
lm_sensors \
imagemagick \
perl \
jq \
cpanminus
if ! perl -MAstro::MoonPhase -e1 2>/dev/null; then
safe_run sudo cpanm Astro::MoonPhase
fi
}
# --------------------------------------------------
# Slackware (manual)
# --------------------------------------------------
install_slackware() {
echo "[Conky] Slackware detected"
echo "[Conky] Please install dependencies manually:"
echo " - conky"
echo " - curl"
echo " - bc"
echo " - libxml2 (xmllint)"
echo " - lm_sensors"
echo " - ImageMagick"
echo " - perl + Astro::MoonPhase"
}
# --------------------------------------------------
# Dispatcher
# --------------------------------------------------
case "$OS_ID" in
ubuntu|debian|linuxmint)
install_debian
;;
fedora|rhel|centos)
install_fedora
;;
arch)
install_arch
;;
slackware)
install_slackware
;;
*)
echo "[Conky] Unknown distribution: $OS_ID"
echo "[Conky] Please install dependencies manually."
;;
esac
# --------------------------------------------------
# Fix permissions
# --------------------------------------------------
echo "[Conky] Setting executable permissions..."
chmod +x ./*.sh 2>/dev/null || true
# --------------------------------------------------
# Create directories
# --------------------------------------------------
mkdir -p "$HOME/.config/conky"
mkdir -p "$HOME/.cache"
# --------------------------------------------------
# Done
# --------------------------------------------------
echo "[Conky] Done."
echo ""
echo "Next steps:"
echo " 1. Configure API key:"
echo " nano ~/.config/conky/secrets.conf"
echo ""
echo " 2. Run Conky:"
echo " ./conky.sh"