# lib/usb-lib.sh — shared USB-storage detection + pick flow. Used by # pos-system-backup (post-verify USB copy) and pos-media-sync (Music sync). # Requires common.sh helpers: log/warn/ok/section/confirm/run. Defines ONLY # usb_* functions plus the USB_MOUNTED / USB_UNMOUNTED / USB_ROOT globals. # # Seams (env overrides; the BACKUP_* names are kept as aliases so existing # system.env lines keep working): # USB_MOUNT_BASE where an unmounted stick is offered to mount (default /media) # USB_BYID /dev/disk/by-id dir consulted by usb_related_present # # API: # usb_detect fill USB_MOUNTED ("mp|label|size|model|fs", # one per removable USB storage partition; # EFI system partitions are excluded) and # USB_UNMOUNTED ("path|label|size|model") # usb_related_present whole-system "is any USB storage attached?" # usb_mount_offer offer to mount detected-but-unmounted sticks # (sudo, mirrors usb-automount: /media/