Closed treimers closed 3 years ago
Hi @treimers!
It seems that there's a .Trashes
folder, and you don't have permissions to set the writing permissions:
Excuse me the redundance 😄
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'chmod' -Rf go-w /Volumes/datasqill [ERROR] chmod: /Volumes/datasqill/.Trashes: Permission denied
I think it's because you are not the owner of that folder, and as far as I know, only the owner or
root
can change permissions of a file/folder. I suppose that it's created by the OS, but I'm not sure why it's there.
Hi @fvarrui,
thank you for your response.
Yes, you are right, I do not have permission to change that folder. But this is the mounted DMG image under Mac OS X and the .Trashes folder is created automatically during the image build.
When I execute an "ls" I can see that I do not have read rights:
$ ls -la /Volumes/datasqill
total 528
drwxr-xr-x 9 treimers staff 374 3 Nov 20:02 .
drwxrwxrwt@ 4 root admin 204 3 Nov 20:02 ..
-rw-r--r--@ 1 treimers staff 10244 3 Nov 20:02 .DS_Store
d-wx--x--t 2 treimers staff 68 3 Nov 20:02 .Trashes
-rw-r--r-- 1 treimers staff 253781 3 Nov 14:48 .VolumeIcon.icns
drwxr-xr-x 3 treimers staff 102 3 Nov 20:02 .background
drwx------ 3 treimers staff 102 3 Nov 20:02 .fseventsd
lrwxr-xr-x 1 treimers staff 13 3 Nov 20:02 Applications -> /Applications
drwxr-xr-x 3 treimers staff 102 3 Nov 20:02 datasqill.app
I am able to set read permissions manually and executed the failing command successfully afterwards:
$ chmod -t,u+r /Volumes/datasqill/.Trashes
$ chmod -Rf go-w /Volumes/datasqill
I replaced chmod in my environment and the build was successful afterwards
$ echo '/bin/chmod $@' > chmod
$ echo 'exit 0' >> chmod
$ chmod +x chmod
$ export PATH=.:$PATH
$ mvn clean package
...
[INFO] Generating DMG image...
[INFO] Creating Applications link
[INFO] Creating symbolic link [/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill/Applications] to [/Applications]
[INFO] Copying background image
[INFO] Copying resource [/mac/background.png] to file [/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill/.background/background.png]
[INFO] Copying icon file: /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/src/main/deploy/package/mac/datasqill.icns
[INFO] Copying file [/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/src/main/deploy/package/mac/datasqill.icns] to folder [/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill/.VolumeIcon.icns]
[INFO] Creating image: /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'hdiutil' create -srcfolder /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill -volname datasqill -fs HFS+ -format UDRW /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg
[INFO] created: /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg
[INFO] Mounting image: /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'hdiutil' attach -readwrite -noverify -noautoopen /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg
[INFO] /dev/disk5 GUID_partition_scheme
[INFO] /dev/disk5s1 Apple_HFS /Volumes/datasqill
[INFO] - Device name: /dev/disk5s1
[INFO] Rendering DMG customization applescript ...
[INFO] Applescript rendered in /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/customize-dmg.applescript!
[INFO] Running applescript
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && '/usr/bin/osascript' /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/customize-dmg.applescript datasqill
[ERROR] waited 1 seconds for .DS_STORE to be created.
[INFO] Fixing permissions...
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'chmod' -Rf go-w /Volumes/datasqill
[ERROR] chmod: /Volumes/datasqill/.Trashes: Permission denied
[INFO] Blessing ...
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'bless' --folder /Volumes/datasqill --openfolder /Volumes/datasqill
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'SetFile' -a C /Volumes/datasqill
[INFO] Unmounting disk image...
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'hdiutil' detach /dev/disk5s1
[INFO] "disk5" unmounted.
[INFO] "disk5" ejected.
[INFO] Compressing disk image...
[INFO] Executing command: /bin/sh -c cd '/Users/treimers/Documents/datasqill/git/datasqillj15/workbench/.' && 'hdiutil' convert /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/assets/datasqill_3.4.6.dmg -format UDZO -imagekey zlib-level=9 -o /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill_3.4.6.dmg
[INFO] Image-Funktion vorbereiten …
[INFO] Protective Master Boot Record (MBR : 0) lesen …
[INFO] (CRC32 $2A3B1E28: Protective Master Boot Record (MBR : 0))
[INFO] GPT Header (Primary GPT Header : 1) lesen …
[INFO] (CRC32 $1E051F54: GPT Header (Primary GPT Header : 1))
[INFO] GPT Partition Data (Primary GPT Table : 2) lesen …
[INFO] (CRC32 $81B10735: GPT Partition Data (Primary GPT Table : 2))
[INFO] (Apple_Free : 3) lesen …
[INFO] (CRC32 $00000000: (Apple_Free : 3))
[INFO] disk image (Apple_HFS : 4) lesen …
[INFO] (CRC32 $9AF1250C: disk image (Apple_HFS : 4))
[INFO] GPT Partition Data (Backup GPT Table : 5) lesen …
[INFO] (CRC32 $81B10735: GPT Partition Data (Backup GPT Table : 5))
[INFO] GPT Header (Backup GPT Header : 6) lesen …
[INFO] (CRC32 $D0A74789: GPT Header (Backup GPT Header : 6))
[INFO] Ressourcen hinzufügen …
[INFO] Dauer: 2.977s
[INFO] Dateigröße: 66844179 Byte, Prüfsumme: CRC32 $4EB9F966
[INFO] Bearbeitete Sektoren: 208113, 175428 komprimiert
[INFO] Geschwindigkeit: 28.8M Byte/s
[INFO] Ersparnis: 37.3 %
[INFO] created: /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill_3.4.6.dmg
[INFO] DMG image generated in /Users/treimers/Documents/datasqill/git/datasqillj15/workbench/target/datasqill_3.4.6.dmg!
I do not know why the .Trashes folder is not readable in my environment. Maybe I have some special set up or some strange software installation on my machine. I don't know, I will try to figure out.
I now tried two other Mac OS X computers, both running High Sierra, 10.13.6. The problem does not show on these other computers and I verified that the .Trashes folder is not created on them.
I do not understand what creates the .Trashes folder on my computer and why it is not readable by the owner.
Do you guys think it would be possible to add an enhancement to the class GenerateDmg?!
Instead of
CommandUtils.execute("chmod", "-Rf", "go-w", mountFolder);
it would help in my case to run
CommandUtils.execute("chmod", "-Rf", "u+r,go-w", mountFolder);
If you agree I can prepare that change and create a pull request for it.
Thanks in advance!
Hi @treimers! Are you sure that setting the read permissions would solve your problem?
A PR will be welcomed ... but, please, check first that this modification solves the problem.
I'll been doing some research about .Trashes
folder creation, and it seems it's related to Spotlight service. I haven't test it, but this should prevent Spotlight from creating the .Trashes
folder on all mounted volumes:
sudo mdutil -a -i off
Thanks!
Hi @fvarrui,
yes, I think this will help. I created a test script to investigate
set -x
rm datasqill_3.4.6.dmg
hdiutil create -srcfolder mysources -volname datasqill -fs HFS+ -format UDRW datasqill_3.4.6.dmg
hdiutil attach -readwrite -noverify -noautoopen datasqill_3.4.6.dmg
osascript customize-dmg.applescript datasqill
chmod -Rf go-w /Volumes/datasqill
if [[ $? -ne 0 ]]
then
exit 0
fi
hdiutil eject /Volumes/datasqill
This fails as well but when changing to
chmod -Rf u+r,go-w /Volumes/datasqill
it worked on my computer.
BTW: I tried another Mac Book running El Capitan, same effect. Maybe this is related to OS version.
I tried your proposal with Spotlight but it did not help. Thanks for that!
I also did a complete disk check in recovery mode on my machine. There were smaller repairs but it did not change the behaviour at the end.
So, I would be glad to create a patch and a pull request. I shall come back to you afterwards.
Don't worry about the PR ... I'm right now implementing another requested feature and can apply your change.
It will appear published in v1.4.0.
v1.4.0 released to Maven Central
I'm submitting a…
Hello guys, hello Fran,
first of all I would like to congratulate and thank you for a really awesome work you did.
Great!
The build of our maven project works fine with this plugin after we switched from Java 8 to Java 15.
Only problem I did encounter is the generation of the DMG file under Mac OS X. It works but it shows errors and does not unmount the image file afterwards.
What is the expected behavior?
The mounted DMG file should be unmount after build process ends.
What is the current behavior?
There are error messages during build and the DMG keeps mounted.
Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?
Fine below the output of the plugin invocation. There are some [ERROR] lines, first when waiting for creation of .DS_STORE, later when trying to execute a chmod. I think that the DMG build stops at that moment but maybe I am wrong? At least the DMG disk is not unmounted afterwards:
Please tell us about your environment:
Thanks for any help in advance!