Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autofirma: Improve uninstall config #151676

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions Casks/a/autofirma.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cask "autofirma" do

Check failure on line 1 in Casks/a/autofirma.rb

View workflow job for this annotation

GitHub Actions / test autofirma (macos-13, intel)

Some applications are still installed, add them to uninstall delete: /Applications/AutoFirma.app
arch arm: "M1", intel: "x64"
pkg_arch = on_arch_conditional arm: "aarch64", intel: "x64"

Expand All @@ -10,7 +10,7 @@
verified: "estaticos.redsara.es/comunes/autofirma/"
name "AutoFirma"
desc "Digital signature editor and validator"
homepage "https://firmaelectronica.gob.es/Home/Descargas.htm"
homepage "https://firmaelectronica.gob.es/Home/Descargas.html"

livecheck do
url :url
Expand All @@ -19,23 +19,21 @@

pkg "AutoFirma_#{version.dots_to_underscores}_#{pkg_arch}.pkg"

# remove 'Autofirma ROOT' and '127.0.0.1' certificates from keychain (these were installed by pkg)
# remove 'Autofirma ROOT' certificates from keychain
uninstall_postflight do
system_command "/usr/bin/security",
args: [
"delete-certificate",
"-c", "AutoFirma ROOT"
],
sudo: true

system_command "/usr/bin/security",
args: [
"delete-certificate",
"-c", "127.0.0.1"
],
sudo: true
stdout, * = system_command "/usr/bin/security",
args: ["find-certificate", "-a", "-c", "AutoFirma ROOT", "-Z"],
sudo: true
hashes = stdout.lines.grep(/^SHA-256 hash:/) { |l| l.split(":").second.strip }
hashes.each do |h|
system_command "/usr/bin/security",
args: ["delete-certificate", "-Z", h],
sudo: true
end
end

uninstall pkgutil: "es.gob.afirma",
delete: "/Applications/AutoFirma.app"

zap trash: "~/Library/Application Support/AutoFirma"
end
Loading