refactor: reescrever install.sh para compatibilidade com /bin/sh (POSIX) #134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Este PR reescreve o instalador install.sh para ser totalmente compatível com POSIX (/bin/sh), garantindo funcionamento em Debian, Ubuntu, Fedora/RHEL, Arch e sistemas baseados em rpm-ostree, sem depender de recursos exclusivos do Bash.
Principais mudanças:
Removidos recursos específicos do Bash:
${var,,}
substituído por tr para conversão em minúsculas[[ ... ]]
substituído por[ ... ]
Operador =~ regex substituído por estruturas case
Criada a função auxiliar dl_file() para tratar downloads de forma mais robusta com wget ou curl.
Melhorado o tratamento de erros e códigos de saída claros para:
Padronização do gerenciamento de pacotes por família:
Exclusão automática de pacotes temporários após instalação.
Motivação
Ao executar o script anterior com sh (dash em Debian/Ubuntu), eram exibidos erros como:
Isso ocorria porque o script usava sintaxe exclusiva do Bash. Esta atualização garante compatibilidade real com
/bin/sh
, ampliando a portabilidade.Agora o instalador pode ser executado de forma segura com:
Testes:
✅ Debian 12 / Ubuntu 24.04 (apt)
✅ Fedora / RHEL (dnf)
✅ Arch Linux (pacman)
✅ Sistemas rpm-ostree (ex.: Fedora Silverblue)
✅ Fallback para curl caso wget não esteja disponível