diff --git a/README.md b/README.md index 125c122..aa0dc3d 100755 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ These are the included binaries and utilities: archivemount` if you have it installed. Use "--check" to only check if a file is an archive. It returns 0 if it is, 1 otherwise. - - SquashFS tools (squasher): + - squasher: These convenient set of tools allow you to easily create XZ-compressed SquashFS images from existing folders to save disk space. The resulting folder is still writable since it is @@ -74,7 +74,7 @@ These are the included binaries and utilities: not exist yet. When the file appears on disk, the tool quits and simply returns the filename. This can be used in personal workflows to stall a longer - command that relies on the existence of said file.= + command that relies on the existence of said file. - agenda: Sets up a folder that is backed by a date-based tree directory structure. Requires an argument for the name diff --git a/squasher b/squasher index 3049be8..213181d 100755 --- a/squasher +++ b/squasher @@ -75,17 +75,17 @@ case "$COMMAND" in echo "-------------------------------------------------------------------------" SERVICE_CONTENT="[Unit] -Description=SquashFS Mount for %I -After=local-fs.target + Description=SquashFS Mount for %I + After=local-fs.target -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=${BIN_DIR}/squasher mount %I -ExecStop=${BIN_DIR}/squasher umount %I + [Service] + Type=oneshot + RemainAfterExit=yes + ExecStart=${BIN_DIR}/squasher mount %I + ExecStop=${BIN_DIR}/squasher umount %I -[Install] -WantedBy=multi-user.target" + [Install] + WantedBy=multi-user.target" echo "$SERVICE_CONTENT" | sudo tee /etc/systemd/system/squash-mount@.service > /dev/null sudo systemctl daemon-reload @@ -94,6 +94,7 @@ WantedBy=multi-user.target" SERVICE_NAME="squash-mount@$ESC_PATH.service" read -p "Enable auto-mount service ($SERVICE_NAME)? [y/N] " yn + if [[ "$yn" =~ ^[Yy]$ ]]; then sudo systemctl enable --now "$SERVICE_NAME" sudo systemctl stop "$SERVICE_NAME" @@ -112,6 +113,7 @@ WantedBy=multi-user.target" "$0" umount "$DIR" 2>/dev/null mkdir -p "$OVERLAY_LOWER" sudo mount "${OVERLAY_ROOT}.img" "$OVERLAY_LOWER" -t squashfs -o loop + if [[ $? -ne 0 ]]; then echo "Error: Failed to mount squashfs image." >&2 exit 1 @@ -125,6 +127,7 @@ WantedBy=multi-user.target" sudo umount "$OVERLAY_LOWER" 2>/dev/null exit 1 fi + echo "SquashFS filesystem is mounted and ready." ;; @@ -136,6 +139,7 @@ WantedBy=multi-user.target" echo "Warning: Filesystem is still mounted. Check for open processes." exit 1 fi + echo "SquashFS filesystem has been unmounted." ;;