Skip to content

fix(mount): take what a disk says about itself as values - #28

Merged
inkly merged 1 commit into
mainfrom
fix/mount-arguments
Nov 10, 2026
Merged

inkly merged 1 commit into
mainfrom
fix/mount-arguments

Conversation

@inkly

@inkly inkly commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

A mount point is made of the name asked for, the label and the model of the disk. This change makes all three plain values on their way to mount.

  • MountDisk hands the device and the mount point to local-storage-helper.sh as two arguments, in place of one command line built by joining strings. A label with a space in it ("My Passport") is one mount point.
  • GetMountPoint keeps the mount point one folder of /media: a / in the name becomes _, and a name that would still leave /media falls back to Storage_<device>. A name asked for as Photos/2024 is now /media/Photos_2024.
  • do_mount reads the filesystem type with blkid -o value -s TYPE and takes it as a value. The message for a drive with no filesystem is unchanged.

Tests. Three new tests. One checks the helper receives exactly two arguments, as they are. One checks the mount point for a list of names, labels and models. One runs the shipped script with a stand-in blkid, lsblk and mount, and checks what mount is given. GOOS=linux go vet ./... and go test ./... pass in a golang:1.26 container; the blkid call was checked there against a real formatted image (util-linux 2.41.5). No real disk was mounted.

A mount point is made of the name asked for, the label and the model of
the disk. MountDisk now hands the device and the mount point to the
helper as two arguments, so a label with a space in it is one mount
point; GetMountPoint keeps the mount point one folder of /media; and
do_mount reads the filesystem type as a value from blkid.
@inkly
inkly marked this pull request as ready for review November 10, 2026 14:14
@inkly
inkly merged commit 54efaae into main Nov 10, 2026
2 checks passed
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