48 lines
1.3 KiB
Bash
48 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
DEB_FILE="libfprint-2-tod1-goodix_0.0.6-0ubuntu1~somerville1_amd64.deb"
|
|
DEB_URL="http://dell.archive.canonical.com/updates/pool/public/libf/libfprint-2-tod1-goodix/$DEB_FILE"
|
|
EXPECTED_SHA256="b921e155fd35b06341a453b9c6f6c4c7101f199aee314403826c517156a4b038"
|
|
|
|
# Função para baixar e verificar o pacote
|
|
download_and_verify_package() {
|
|
# Verificar se o arquivo .deb já está presente
|
|
if [[ -f "$DEB_FILE" ]]; then
|
|
echo "Arquivo $DEB_FILE já está presente."
|
|
else
|
|
echo "Baixando $DEB_FILE..."
|
|
wget "$DEB_URL"
|
|
fi
|
|
|
|
# Verificar o hash SHA256 do arquivo baixado
|
|
actual_sha256=$(sha256sum "$DEB_FILE" | awk '{print $1}')
|
|
if [[ "$actual_sha256" == "$EXPECTED_SHA256" ]]; then
|
|
echo "O hash SHA256 do arquivo baixado corresponde ao esperado."
|
|
else
|
|
echo "O hash SHA256 do arquivo baixado não corresponde ao esperado. Abortando."
|
|
exit 1
|
|
fi
|
|
|
|
# Instalar o pacote
|
|
sudo dpkg -i "$DEB_FILE"
|
|
}
|
|
|
|
# Função para executar os comandos
|
|
execute_commands() {
|
|
for cmd in "$@"; do
|
|
eval $cmd
|
|
done
|
|
}
|
|
|
|
# Lista de comandos
|
|
commands=(
|
|
"sudo pam-auth-update"
|
|
"fprintd-verify"
|
|
"fwupdmgr update"
|
|
"sudo systemctl restart fprintd.service"
|
|
)
|
|
|
|
# Chamada das funções
|
|
download_and_verify_package
|
|
execute_commands "${commands[@]}"
|