Skip to content

Use temporary directories for mounting#102

Closed
matthijskooijman wants to merge 3 commits into
billw2:masterfrom
matthijskooijman:temp-mount-dir
Closed

Use temporary directories for mounting#102
matthijskooijman wants to merge 3 commits into
billw2:masterfrom
matthijskooijman:temp-mount-dir

Conversation

@matthijskooijman
Copy link
Copy Markdown

This creates a temporary directory for src and dst mounts, rather than hardcoding /mnt/clone and /mnt/clone-src. This allows running the script twice in parallel, without conflicts.

To prevent littering tons of directories around, automatic cleanup of these directories is added (which has the added advantage of also unmounting and cleaning up when the script is somehow interrupted or fails in an unexpected way).

This also changes the interface to the rpi-clone-setup script slightly, since that also used to hardcode this directory name.

See commit messages for some more details.

Instead, pass the mount location through an environment variable.
The `$clone` directory is already used when figuring out disk space for
unmounted partitions, so this could fail on the first run.
This allows using the script multiple times in parallel on different
disks.

To prevent all these directories littering the filesystem, an exit
handler is registered to remove them again when the script exits (also
unmounting any mounted filesystems just in case).
@matthijskooijman
Copy link
Copy Markdown
Author

I've resubmitted this PR in a more actively maintained fork: geerlingguy#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant