macOS: Use a better Uninstaller
An apple script converted to an App calls the local /usr/local/bin/opensc-uninstall
This commit is contained in:
parent
a0870826a2
commit
25f785e482
|
@ -7,5 +7,4 @@ EXTRA_DIST = build build-package.in Distribution.xml.in libtool-bundle opensc-un
|
|||
resources/Welcome.html.in \
|
||||
scripts \
|
||||
scripts/postinstall \
|
||||
uninstaller-scripts \
|
||||
uninstaller-scripts/postinstall
|
||||
OpenSC_Uninstaller.applescript
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
tell application "System Events"
|
||||
if exists file "/usr/local/bin/opensc-uninstall" then
|
||||
set result to do shell script "/usr/local/bin/opensc-uninstall" with administrator privileges
|
||||
display alert "Removal complete" message result giving up after 10
|
||||
else
|
||||
display alert "OpenSC is not installed" message "Could not find /usr/local/bin/opensc-uninstall" as critical giving up after 10
|
||||
end if
|
||||
end tell
|
|
@ -87,16 +87,15 @@ cp MacOSX/opensc-uninstall target/usr/local/bin
|
|||
# Build package
|
||||
pkgbuild --root target --scripts MacOSX/scripts --identifier org.opensc-project.mac --version @PACKAGE_VERSION@ --install-location / OpenSC.pkg
|
||||
# Build product
|
||||
productbuild --distribution MacOSX/Distribution.xml --package-path . --resources MacOSX/resources OpenSC-@PACKAGE_VERSION@.pkg
|
||||
productbuild --distribution MacOSX/Distribution.xml --package-path . --resources MacOSX/resources "OpenSC @PACKAGE_VERSION@.pkg"
|
||||
|
||||
# Build "uninstaller"
|
||||
pkgbuild --nopayload --identifier org.opensc-project.mac.uninstall --scripts MacOSX/uninstaller-scripts Uninstall_OpenSC.pkg
|
||||
osacompile -o "OpenSC Uninstaller.app" "MacOSX/OpenSC_Uninstaller.applescript"
|
||||
|
||||
# Create .dmg
|
||||
rm -f OpenSC-@PACKAGE_VERSION@.dmg
|
||||
TIMESTAMP=$(date +%Y.%m.%d)
|
||||
i=0
|
||||
while ! hdiutil create -srcfolder Uninstall_OpenSC.pkg -srcfolder OpenSC-@PACKAGE_VERSION@.pkg -volname "OpenSC @PACKAGE_VERSION@ for Mac OS X 10.10+ (${TIMESTAMP})" OpenSC-@PACKAGE_VERSION@.dmg
|
||||
while ! hdiutil create -srcfolder "OpenSC @PACKAGE_VERSION@.pkg" -srcfolder "OpenSC Uninstaller.app" -volname "@PACKAGE_NAME@" OpenSC-@PACKAGE_VERSION@.dmg
|
||||
do
|
||||
i=$[$i+1]
|
||||
if [ $i -gt 2 ]
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
exec /usr/local/bin/opensc-uninstall
|
Loading…
Reference in New Issue