From bf5665d1acf2a84e8caf9952aa9aca173fd4473f Mon Sep 17 00:00:00 2001 From: Mathilde Merle Date: Tue, 14 Feb 2023 16:04:57 +0100 Subject: [PATCH] {macOS} solve package error if packaging failed before --- .../apple}/BaseMedinriaPackage.sparseimage.gz | Bin packaging/apple/mac_packager.sh.in | 9 ++++++--- 2 files changed, 6 insertions(+), 3 deletions(-) rename {src/utils/osx_packaging => packaging/apple}/BaseMedinriaPackage.sparseimage.gz (100%) mode change 100644 => 100755 diff --git a/src/utils/osx_packaging/BaseMedinriaPackage.sparseimage.gz b/packaging/apple/BaseMedinriaPackage.sparseimage.gz old mode 100644 new mode 100755 similarity index 100% rename from src/utils/osx_packaging/BaseMedinriaPackage.sparseimage.gz rename to packaging/apple/BaseMedinriaPackage.sparseimage.gz diff --git a/packaging/apple/mac_packager.sh.in b/packaging/apple/mac_packager.sh.in index dd3519b7f0..ecf4cf6e71 100755 --- a/packaging/apple/mac_packager.sh.in +++ b/packaging/apple/mac_packager.sh.in @@ -35,13 +35,16 @@ done #Run fancy packaging apple script -\cp -f @medInria_SOURCE_DIR@/utils/osx_packaging/BaseMedinriaPackage.sparseimage.gz @PROJECT_BINARY_DIR@/MedinriaPackage.sparseimage.gz +# Clean volumes if some packaging failed before, Zsh style +for volume in /Volumes/medInria*; do diskutil unmount $volume; done + +\cp -f ${CMAKE_SOURCE_DIR}/packaging/apple/BaseMedinriaPackage.sparseimage.gz @PROJECT_BINARY_DIR@/MedinriaPackage.sparseimage.gz cd @PROJECT_BINARY_DIR@ gunzip -f MedinriaPackage.sparseimage.gz devName=`hdiutil attach -readwrite -noverify -noautoopen MedinriaPackage.sparseimage | egrep '^/dev/' | sed 1q | awk '{print $1}'` -diskutil rename "medInria base" "medInria @MEDINRIA_SUPERBUILD_VERSION@" -\cp -rf @medInria_BINARY_DIR@/bin/TmpInstall/medInria.app /Volumes/"medInria @MEDINRIA_SUPERBUILD_VERSION@"/ +diskutil rename "medInria base" "medInria.@MEDINRIA_SUPERBUILD_VERSION@" +\cp -rf @medInria_BINARY_DIR@/bin/TmpInstall/medInria.app /Volumes/medInria.@MEDINRIA_SUPERBUILD_VERSION@/ sync hdiutil detach $devName