M8: add command to append a single device to config

New 'arca add <device>' subcommand detects a LUKS device via udisks2 and
appends it to the config with passphrase as default method. Supports
--alias/-a to override the generated name. Skips if UUID already
configured. Adds Config.Save() and Config.HasUUID() to config package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 08:38:32 -07:00
parent 0c19f94292
commit feb22db039
3 changed files with 113 additions and 11 deletions

View File

@@ -4,8 +4,6 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"git.wntrmute.dev/kyle/arca/internal/config"
"git.wntrmute.dev/kyle/arca/internal/udisks"
@@ -102,12 +100,3 @@ func isRootBacking(path dbus.ObjectPath, rootDevices []dbus.ObjectPath) bool {
return false
}
func aliasFromUUID(uuid string) string {
// Use first 8 chars of UUID as a stable alias.
// "b8b2f8e3-4cde-4aca-a96e-df9274019f9f" -> "b8b2f8e3"
clean := strings.ReplaceAll(uuid, "-", "")
if len(clean) > 8 {
clean = clean[:8]
}
return clean
}