|
@@ -5,7 +5,7 @@ overlaycached(){
|
|
|
|
|
|
|
|
MOVE=false
|
|
MOVE=false
|
|
|
SSHFS=""
|
|
SSHFS=""
|
|
|
- DEPTH=2
|
|
|
|
|
|
|
+ DEPTH=3
|
|
|
WRITE_THROUGH=false
|
|
WRITE_THROUGH=false
|
|
|
SSHFS_CMD="sshfs"
|
|
SSHFS_CMD="sshfs"
|
|
|
while getopts ":dwmS:D:-" opt; do
|
|
while getopts ":dwmS:D:-" opt; do
|
|
@@ -52,9 +52,9 @@ USAGEEOF
|
|
|
esac
|
|
esac
|
|
|
done
|
|
done
|
|
|
shift $((OPTIND -1))
|
|
shift $((OPTIND -1))
|
|
|
- [ -z "$SSHFS" ] && LOWER_DIR="$1" && shift 1
|
|
|
|
|
- $MOVE || { UPPER_DIR="$1" && shift 1; }
|
|
|
|
|
- MOUNT_DIR="$1"
|
|
|
|
|
|
|
+ [ -z "$SSHFS" ] && LOWER_DIR="$(realpath $1)" && shift 1
|
|
|
|
|
+ $MOVE || { UPPER_DIR="$(realpath $1)" && shift 1; }
|
|
|
|
|
+ MOUNT_DIR="$(realpath $1)"
|
|
|
trap cleanup EXIT
|
|
trap cleanup EXIT
|
|
|
if $MOVE; then
|
|
if $MOVE; then
|
|
|
UPPER_DIR="$(realpath "$MOUNT_DIR").upper"
|
|
UPPER_DIR="$(realpath "$MOUNT_DIR").upper"
|
|
@@ -74,11 +74,6 @@ USAGEEOF
|
|
|
LOWER_DIR="$(realpath "$MOUNT_DIR").sshfs"
|
|
LOWER_DIR="$(realpath "$MOUNT_DIR").sshfs"
|
|
|
mkdir -p "$LOWER_DIR"
|
|
mkdir -p "$LOWER_DIR"
|
|
|
SSHFS_OPTS="-oauto_cache,reconnect,no_readahead,allow_other"
|
|
SSHFS_OPTS="-oauto_cache,reconnect,no_readahead,allow_other"
|
|
|
-# if [ ! -z "$SUDO_USER" ]; then
|
|
|
|
|
-# SSHFS_CMD="sudo -u $SUDO_USER $SSHFS_CMD"
|
|
|
|
|
-# chown "$SUDO_UID:$SUDO_GID" "$LOWER_DIR" "$WORK_DIR" "$UPPER_DIR"
|
|
|
|
|
-# chmod ogu+rx "$LOWER_DIR" "$WORK_DIR" "$UPPER_DIR"
|
|
|
|
|
-# fi
|
|
|
|
|
set -x
|
|
set -x
|
|
|
$SSHFS_CMD "$SSHFS" "$LOWER_DIR" "${SSHFS_OPTS}"
|
|
$SSHFS_CMD "$SSHFS" "$LOWER_DIR" "${SSHFS_OPTS}"
|
|
|
set +x
|
|
set +x
|
|
@@ -111,6 +106,7 @@ cleanup(){
|
|
|
echo "Cleaning up mount points...."
|
|
echo "Cleaning up mount points...."
|
|
|
set +e
|
|
set +e
|
|
|
set -x
|
|
set -x
|
|
|
|
|
+ sync
|
|
|
umount "$MOUNT_DIR" # 2> /dev/null
|
|
umount "$MOUNT_DIR" # 2> /dev/null
|
|
|
sync
|
|
sync
|
|
|
if $MOVE; then
|
|
if $MOVE; then
|
|
@@ -124,7 +120,6 @@ cleanup(){
|
|
|
for DIR in ${CLEANUP_DIRS[@]}; do
|
|
for DIR in ${CLEANUP_DIRS[@]}; do
|
|
|
rm -rf "$DIR"
|
|
rm -rf "$DIR"
|
|
|
done
|
|
done
|
|
|
- set +x
|
|
|
|
|
}
|
|
}
|
|
|
show_workdir_contents(){
|
|
show_workdir_contents(){
|
|
|
(cd $WORK_DIR;pwd; ls -alsh)
|
|
(cd $WORK_DIR;pwd; ls -alsh)
|