Comment 11 for bug 435719

Revision history for this message
John Doe (b2109455) wrote :

@ossjunkie: Didn't look at it before my previous comment as I hadn't noticed it was there. It looks OK apart from the predictable location. As you say, not a big adjustment to change that though.

# only apply when home directory is on NFS
if [ "$(stat -f -L -c %T $HOME)" = "nfs" ]; then
  # remove existing ~/.gvfs dir if empty
  rmdir ~/.gvfs
  if [ ! $? -eq 0 ]; then
    # remove link or move unempty dir/file
    if [ -h .gvfs ]; then
      rm ~/.gvfs
    else
      mv ~/.gvfs ~/.gvfs_moved_for_gvfs-fuse_on_nfs
    fi
  fi
  # create the symlink to unpredictably named directory with secure permissions
  ln -s "$(mktemp -d)" ~/.gvfs
fi

As well as creating an unpredictable location using mktemp also means you don't need to worry about permissions since by default it creates files/directories with read/write for owner only.