Go CLI using cobra with mount, unmount, status, and init subcommands. Unlocks via udisks2 D-Bus (passphrase/keyfile) or cryptsetup (FIDO2/TPM2) with ordered method fallback. Includes NixOS-specific LD_LIBRARY_PATH injection for systemd cryptsetup token plugins. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
744 B
Go
28 lines
744 B
Go
package udisks
|
|
|
|
import "github.com/godbus/dbus/v5"
|
|
|
|
const (
|
|
busName = "org.freedesktop.UDisks2"
|
|
objectPrefix = "/org/freedesktop/UDisks2"
|
|
|
|
ifaceObjectManager = "org.freedesktop.DBus.ObjectManager"
|
|
ifaceBlock = "org.freedesktop.UDisks2.Block"
|
|
ifaceEncrypted = "org.freedesktop.UDisks2.Encrypted"
|
|
ifaceFilesystem = "org.freedesktop.UDisks2.Filesystem"
|
|
)
|
|
|
|
// BlockDevice represents a udisks2 block device.
|
|
type BlockDevice struct {
|
|
ObjectPath dbus.ObjectPath
|
|
DevicePath string // e.g., "/dev/sda1"
|
|
UUID string
|
|
HasEncrypted bool
|
|
HasFilesystem bool
|
|
CryptoBackingDevice dbus.ObjectPath
|
|
}
|
|
|
|
func noOptions() map[string]dbus.Variant {
|
|
return make(map[string]dbus.Variant)
|
|
}
|