|
|
@@ -52,26 +52,26 @@ USAGEEOF
|
|
|
esac
|
|
|
done
|
|
|
shift $((OPTIND -1))
|
|
|
- [ -z "$SSHFS" ] && LOWER_DIR="$(realpath $1)" && shift 1
|
|
|
- $MOVE || { UPPER_DIR="$(realpath $1)" && shift 1; }
|
|
|
- MOUNT_DIR="$(realpath $1)"
|
|
|
+ [ -z "$SSHFS" ] && LOWER_DIR="$(realpath -s $1)" && shift 1
|
|
|
+ $MOVE || { UPPER_DIR="$(realpath -s $1)" && shift 1; }
|
|
|
+ MOUNT_DIR="$(realpath -s $1)"
|
|
|
trap cleanup EXIT
|
|
|
if $MOVE; then
|
|
|
- UPPER_DIR="$(realpath "$MOUNT_DIR").upper"
|
|
|
- WORK_DIR="$(realpath "$MOUNT_DIR").work"
|
|
|
+ UPPER_DIR="$(realpath -s "$MOUNT_DIR").upper"
|
|
|
+ WORK_DIR="$(realpath -s "$MOUNT_DIR").work"
|
|
|
set -x
|
|
|
mv "$MOUNT_DIR" "$UPPER_DIR"
|
|
|
mkdir -p "$MOUNT_DIR"
|
|
|
set +x
|
|
|
else
|
|
|
- WORK_DIR="$(realpath "$UPPER_DIR").work"
|
|
|
+ WORK_DIR="$(realpath -s "$UPPER_DIR").work"
|
|
|
fi
|
|
|
mkdir -p "$WORK_DIR"
|
|
|
CLEANUP_DIRS=(
|
|
|
"$WORK_DIR"
|
|
|
)
|
|
|
if [ ! -z "$SSHFS" ]; then
|
|
|
- LOWER_DIR="$(realpath "$MOUNT_DIR").sshfs"
|
|
|
+ LOWER_DIR="$(realpath -s "$MOUNT_DIR").sshfs"
|
|
|
mkdir -p "$LOWER_DIR"
|
|
|
SSHFS_OPTS="-oauto_cache,reconnect,no_readahead,allow_other"
|
|
|
set -x
|
|
|
@@ -91,7 +91,7 @@ handle_inotify_event(){
|
|
|
do
|
|
|
[[ "$EVT" =~ "ISDIR" ]] && continue
|
|
|
echo "$DIR $EVT $FILE"
|
|
|
- local RELPATH="$(realpath --relative-to="$MOUNT_DIR" "$DIR")/$FILE"
|
|
|
+ local RELPATH="$(realpath -s --relative-to="$MOUNT_DIR" "$DIR")/$FILE"
|
|
|
|
|
|
[[ "$EVT" =~ "CLOSE_NOWRITE" ]] && [ ! -f "$UPPER_DIR/$RELPATH" ] && {
|
|
|
echo "$LOWER_DIR/$RELPATH" ">" "$MOUNT_DIR/$RELPATH"
|