fix NAS mounts

This commit is contained in:
2026-07-30 11:57:14 -07:00
parent fbd1cee0ba
commit 1c1dbf7f21
2 changed files with 48 additions and 29 deletions

View File

@@ -21,7 +21,6 @@ NIMO_SRC="/home/schmeeve/ComfyUI/output"
SHARE="//mini.nas/miniShare1"
NAS_SUBPATH="Pictures"
MOUNTPOINT="${HOME}/mnt/miniShare1"
CREDENTIALS="${HOME}/.smb/mini.nas"
RENAME_SCRIPT="${HOME}/git/schmeeve-toolz/rename-ai-snaps"
@@ -30,22 +29,29 @@ ORGANIZE_SCRIPT="${HOME}/git/schmeeve-toolz/organize-images"
START="$(date +%s)"
echo "[sync-comfyui-snaps] Starting at $(date)"
# 1. Mount NAS if not already mounted
if mount | grep -q "${MOUNTPOINT}"; then
echo "[sync-comfyui-snaps] Already mounted at ${MOUNTPOINT}"
# 1. Determine NAS mount — use pre-mounted /mini.nas/miniShare1 on nimo.loc
# if available; otherwise mount via CIFS under ~/mnt/miniShare1
if [ -d "/mini.nas/miniShare1" ]; then
MOUNTPOINT="/mini.nas/miniShare1"
echo "[sync-comfyui-snaps] Using existing mount at ${MOUNTPOINT}"
else
echo "[sync-comfyui-snaps] Mounting ${SHARE} → ${MOUNTPOINT}"
mkdir -p "${MOUNTPOINT}"
OPTS="username=schmeeve,uid=$(id -u),gid=$(id -g),forceuid,forcegid,nounix,serverino"
if [ -f "${CREDENTIALS}" ]; then
OPTS="${OPTS},credentials=${CREDENTIALS}"
MOUNTPOINT="${HOME}/mnt/miniShare1"
if mount | grep -q "${MOUNTPOINT}"; then
echo "[sync-comfyui-snaps] Already mounted at ${MOUNTPOINT}"
else
echo "[sync-comfyui-snaps] Mounting ${SHARE} → ${MOUNTPOINT}"
mkdir -p "${MOUNTPOINT}"
OPTS="username=schmeeve,uid=$(id -u),gid=$(id -g),forceuid,forcegid,nounix,serverino"
if [ -f "${CREDENTIALS}" ]; then
OPTS="${OPTS},credentials=${CREDENTIALS}"
fi
sudo mount -t cifs "${SHARE}" "${MOUNTPOINT}" -o "${OPTS}"
if ! mount | grep -q "${MOUNTPOINT}"; then
echo "[sync-comfyui-snaps] ERROR: Failed to mount ${SHARE}"
exit 1
fi
echo "[sync-comfyui-snaps] Mounted at ${MOUNTPOINT}"
fi
sudo mount -t cifs "${SHARE}" "${MOUNTPOINT}" -o "${OPTS}"
if ! mount | grep -q "${MOUNTPOINT}"; then
echo "[sync-comfyui-snaps] ERROR: Failed to mount ${SHARE}"
exit 1
fi
echo "[sync-comfyui-snaps] Mounted at ${MOUNTPOINT}"
fi
DEST="${MOUNTPOINT}/${NAS_SUBPATH}"
@@ -67,9 +73,10 @@ rsync -vu --checksum \
"${SRC}" "${DEST}/"
# 3. Rename AI snaps (non-interactive for automation)
AI_OUTPUT="${DEST}/Images/AI"
if [ -x "${RENAME_SCRIPT}" ]; then
echo "[sync-comfyui-snaps] Running rename-ai-snaps on ${DEST}"
"${RENAME_SCRIPT}" "${DEST}" --no-interactive
echo "[sync-comfyui-snaps] Running rename-ai-snaps on ${DEST} → ${AI_OUTPUT}"
"${RENAME_SCRIPT}" "${DEST}" --output "${AI_OUTPUT}" --no-interactive
else
echo "[sync-comfyui-snaps] WARNING: rename-ai-snaps not found at ${RENAME_SCRIPT}"
fi