-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·181 lines (161 loc) · 6.84 KB
/
install.sh
File metadata and controls
executable file
·181 lines (161 loc) · 6.84 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
#!/bin/sh
# POSIX sh compatible installer
#
# install.sh
# Created: 2023/01/10
# Altered: 2024/09/23
# Updated: ter 06 jan 2026 22:00:53 -04
#
# Copyright (c) 2019-2026, Vilmar Catafesta <vcatafesta@gmail.com>
# Copyright (c) 2025-2026, VoidLinuxBR Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#sh <(curl -s -L https://raw.githubusercontent.com/voidlinuxbr/void-install/master/install.sh)
#sh <(wget -q -O - https://raw.githubusercontent.com/voidlinuxbr/void-install/master/install.sh)
#source <(curl -s -L https://raw.githubusercontent.com/voidlinuxbr/void-install/master/install.sh)
#source <(wget -q -O - https://raw.githubusercontent.com/voidlinuxbr/void-install/master/install.sh)
#!/bin/sh
# install.sh — POSIX sh, colorido, compatível com ISO (sh)
###############################################################################
# CORES ANSI (POSIX)
###############################################################################
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
CYAN='\033[1;36m'
RESET='\033[0m'
BOLD='\033[1m'
# desliga cores se não for TTY
[ -t 1 ] || {
RED= GREEN= YELLOW= BLUE= CYAN= RESET= BOLD=
}
###############################################################################
# FUNÇÕES DE LOG
###############################################################################
msg() { printf "%b\n" "${CYAN}==>${RESET} $*"; }
ok() { printf "%b\n" "${GREEN}[OK]${RESET} $*"; }
warn() { printf "%b\n" "${YELLOW}[WARN]${RESET} $*"; }
err() { printf "%b\n" "${RED}[ERRO]${RESET} $*" >&2; }
oops() { err "$*"; exit 1; }
###############################################################################
# CONFIGURAÇÃO
###############################################################################
umask 0022
url="https://raw.githubusercontent.com/voidlinuxbr/void-install/master"
url_blob="https://github.com/voidlinuxbr/void-install/blob/master"
files_bin="void-install"
files_home="LICENSE README.md"
files_lang="void-install"
files_blob="void-x86_64-base-custom-current.tar.xz"
idioma="en es it de fr ru zh-CN zh-TW ja ko"
tmpDir="$HOME/void-install"
dir_locale="usr/share/locale"
###############################################################################
# PREPARAÇÃO
###############################################################################
msg "Preparando diretório temporário"
[ -d "$tmpDir" ] || mkdir -p "$tmpDir" || oops "Unable to create $tmpDir"
ok "Diretório $tmpDir pronto"
require_util() {
command -v "$1" >/dev/null 2>&1 ||
oops "Você não tem '$1' instalado (necessário para $2)"
}
###############################################################################
# DOWNLOAD TOOL
###############################################################################
if command -v curl >/dev/null 2>&1; then
cmdfetch() { curl -fsSL "$1" -o "$2"; }
elif command -v wget >/dev/null 2>&1; then
cmdfetch() { wget -q "$1" -O "$2"; }
else
require_util curl downloader
require_util wget downloader
fi
###############################################################################
# DOWNLOAD BINÁRIOS
###############################################################################
for f in $files_bin; do
msg "Baixando $f"
cmdfetch "$url/$f" "$tmpDir/$f" || oops "Falha no download: $f"
ok "$f baixado"
done
###############################################################################
# DOWNLOAD ARQUIVOS HOME
###############################################################################
for f in $files_home; do
msg "Baixando $f"
cmdfetch "$url/$f" "$tmpDir/$f" || oops "Falha no download: $f"
ok "$f baixado"
done
###############################################################################
# DOWNLOAD BLOBS
###############################################################################
for f in $files_blob; do
msg "Baixando $f"
cmdfetch "$url_blob/$f" "$tmpDir/$f" || oops "Falha no download: $f"
ok "$f baixado"
done
###############################################################################
# DOWNLOAD IDIOMAS
###############################################################################
for lang in $idioma; do
for f in $files_lang; do
target="$tmpDir/$dir_locale/$lang/LC_MESSAGES"
[ -d "$target" ] || mkdir -p "$target" || oops "Unable to create $target"
msg "Idioma $lang: $f.mo"
cmdfetch "$url/$dir_locale/$lang/LC_MESSAGES/$f.mo" \
"$target/$f.mo" >/dev/null 2>&1 || true
done
done
ok "Idiomas processados"
###############################################################################
# INSTALA LOCALES
###############################################################################
msg "Instalando arquivos de idioma"
sudo cp -rf "$tmpDir/usr/share/locale/"* /usr/share/locale/ \
|| oops "Falha ao instalar locales"
ok "Locales instalados"
###############################################################################
# INSTALA BINÁRIOS
###############################################################################
msg "Instalando binários"
for f in $files_bin; do
sudo chmod +x "$tmpDir/$f"
sudo cp -f "$tmpDir/$f" /usr/bin/ || oops "Falha ao instalar $f"
done
ok "Binários instalados"
###############################################################################
# FINAL
###############################################################################
echo
msg "Conteúdo de $tmpDir"
ls -la --color=auto "$tmpDir"
echo
printf "%b\n" "${BOLD}${GREEN}Pronto! Para continuar:${RESET}"
echo
printf "%b\n" " ${YELLOW}sudo bash void-install${RESET}"
echo
printf "%b\n" "${CYAN}ou entre em:${RESET} ${BOLD}$tmpDir${RESET}"
printf "%b\n" " ${BLUE}cd $tmpDir${RESET}"
printf "%b\n" " ${YELLOW}sudo bash void-install${RESET}"
echo