Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit d3b1e31

Browse files
mtibbentonivdv
authored andcommitted
Resolve firmlinks so we agree with nfsd on the path (#102)
1 parent 7188bfd commit d3b1e31

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docker-machine-nfs.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ setPropDefaults()
141141
prop_timeout=
142142
}
143143

144+
# @info: Resolve APFS firmlinks to their actual location
145+
resolveHostPath()
146+
{
147+
firmlinked_dir="/System/Volumes/Data$1"
148+
if [ -d "$firmlinked_dir" ] ; then
149+
echo $firmlinked_dir
150+
else
151+
echo $1
152+
fi
153+
}
154+
144155
# @info: Parses and validates the CLI arguments
145156
parseCli()
146157
{
@@ -370,7 +381,7 @@ configureNFS()
370381
for shared_folder in "${prop_shared_folders[@]}"
371382
do
372383
# Add new exports
373-
exports="${exports}\"$shared_folder\" $machine_ip $prop_nfs_config\n"
384+
exports="${exports}\"$(resolveHostPath "$shared_folder")\" $machine_ip $prop_nfs_config\n"
374385
done
375386

376387
# Write new exports block ending
@@ -413,7 +424,7 @@ configureBoot2Docker()
413424
for shared_folder in "${prop_shared_folders[@]}"
414425
do
415426
bootlocalsh="${bootlocalsh}
416-
sudo mount -t nfs -o "$prop_mount_options" "$prop_nfshost_ip":\""$shared_folder"\" \""$shared_folder"\""
427+
sudo mount -t nfs -o "$prop_mount_options" "$prop_nfshost_ip":\""$(resolveHostPath "$shared_folder")"\" \""$shared_folder"\""
417428
done
418429

419430
local file="/var/lib/boot2docker/bootlocal.sh"
@@ -446,7 +457,7 @@ isNFSMounted()
446457
for shared_folder in "${prop_shared_folders[@]}"
447458
do
448459
local nfs_mount=$(docker-machine ssh $prop_machine_name "sudo mount" |
449-
grep "$prop_nfshost_ip:$prop_shared_folders on")
460+
grep "$prop_nfshost_ip:$(resolveHostPath "$shared_folder") on")
450461
if [ "" = "$nfs_mount" ]; then
451462
echo "false";
452463
return;

0 commit comments

Comments
 (0)