Last active
September 7, 2022 06:49
-
-
Save Andelnyr/5bf0745dd7aa5a83d2b941b05ec1946f to your computer and use it in GitHub Desktop.
Personalizando RockLinux9 para funcionar como "Terminal de Operação"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| clear | |
| # Este script deve ser executado como root | |
| if [ "$USER" != "root" ]; then | |
| echo "=================================================" | |
| echo "+ ERRO: Este script deve ser executado como root." | |
| echo "=================================================" | |
| exit | |
| fi | |
| echo -e "\n+ INFO: REMOVENDO VERSÕES ANTIGAS DO CACHE" | |
| echo -e " =========================================\n" | |
| dnf clean all | |
| echo -e "\n+ INFO: BAIXANDO E INSTALANDO PACOTES INDISPENSÁVEIS" | |
| echo -e " ===================================================\n" | |
| dnf -y install epel-release glibc-langpack-pt\* tar rsync | |
| localectl set-locale LANG=pt_BR.UTF8 | |
| # Foi informado um argumento & ele existe? | |
| # SIM: É um cache comprimido! | |
| # Descompactar o cache em /var/cache/dnf | |
| # Setar a variável EXISTE_CACHE | |
| if [ $# -gt 0 -a -e $1 ]; then | |
| echo -e "\n+ INFO: POPULANDO /var/cache/dnf" | |
| echo -e " ===============================\n" | |
| tar -zxf $1 -C "/" | |
| EXISTE_CACHE=1 | |
| fi | |
| # Existe cache? | |
| # NÃO: Setar keepcache em /etc/yum.conf e gerar cache de pacotes | |
| # Atualizando o S.O. e criando cópia de pacotes RPM | |
| if [ -z "$EXISTE_CACHE" ]; then | |
| echo -e "\n+ INFO: CONFIGURANDO E CRIANDO CACHE DE PACOTES EM /VAR/CACHE" | |
| echo -e " ============================================================\n" | |
| if ! grep 'keepcache=1' /etc/yum.conf > /dev/null 2>&1; then | |
| echo 'keepcache=1' >> /etc/yum.conf | |
| fi | |
| dnf makecache | |
| echo -e "\n+ INFO: ATUALIZANDO O SO..." | |
| echo -e "===========================\n" | |
| dnf -y update | |
| echo -e "\n+ INFO: INSTALANDO APLICAÇÕES PARA O FUNCIONAMENTO DO TO" | |
| echo -e "========================================================\n" | |
| dnf -y groupinstall base-x | |
| dnf -y groupinstall Xfce | |
| dnf -y install motif xterm geany | |
| echo -e "\n+ INFO: GERANDO UMA CÓPIA DO CACHE PARA USO POSTERIOR" | |
| echo -e "=====================================================\n" | |
| ts=$(date +%Y%m%d_%H%M%S) | |
| cache_rpm="cache_RLinux_${ts}.tar.gz" | |
| tar -czf "$cache_rpm" '/var/cache/' | |
| else | |
| # Instalando os pacotes pelo cache | |
| dnf -C -y groupinstall base-x | |
| dnf -C -y groupinstall Xfce | |
| dnf -C -y install motif xterm geany | |
| fi | |
| echo -e "\n+ INFO: INSTALAÇÃO CONCLUÍDA COM SUCESSO" | |
| echo -e "========================================\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment