Support first KDE image calibration and native setup handoff
This commit is contained in:
parent
ce27ecfb50
commit
16f7a67494
1 changed files with 8 additions and 3 deletions
|
|
@ -76,7 +76,6 @@ pub fn reconcile() -> Result<()> {
|
|||
if Path::new("/etc/archipelago/provisioned").exists() { return Ok(()); }
|
||||
let kde = fs::read_to_string("/usr/lib/archipelago/purpose").map_err(|e| e.to_string())?.trim() == "purpose/desktop/kde";
|
||||
if kde && !Path::new("/etc/plasma-setup-done").is_file() { return Ok(()); }
|
||||
let login_service = if kde { "sddm" } else { "gdm-password" };
|
||||
let sessions: Value = serde_json::from_str(&output("/usr/bin/loginctl", &["list-sessions", "--json=short"])?).map_err(|e| e.to_string())?;
|
||||
for session in sessions.as_array().ok_or("Invalid session list")? {
|
||||
let id = session["session"].as_str().ok_or("Missing session ID")?;
|
||||
|
|
@ -84,8 +83,14 @@ pub fn reconcile() -> Result<()> {
|
|||
let text = output("/usr/bin/loginctl", &["show-session", id, "-p", "Name", "-p", "User",
|
||||
"-p", "Class", "-p", "Type", "-p", "Service", "-p", "Active", "-p", "Remote"])?;
|
||||
let fields: BTreeMap<_, _> = text.lines().filter_map(|line| line.split_once('=')).collect();
|
||||
// Plasma Setup hands off the newly created user through a temporary SDDM
|
||||
// autologin. Its completion marker plus the account checks below are
|
||||
// required; the setup service account itself is never accepted.
|
||||
let login_service = if kde {
|
||||
matches!(fields.get("Service"), Some(&"sddm") | Some(&"sddm-autologin"))
|
||||
} else { fields.get("Service") == Some(&"gdm-password") };
|
||||
if fields.get("Active") != Some(&"yes") || fields.get("Remote") != Some(&"no") ||
|
||||
fields.get("Class") != Some(&"user") || fields.get("Service") != Some(&login_service) ||
|
||||
fields.get("Class") != Some(&"user") || !login_service ||
|
||||
!matches!(fields.get("Type"), Some(&"wayland") | Some(&"x11")) { continue; }
|
||||
let name = *fields.get("Name").ok_or("Missing user name")?;
|
||||
username(name)?;
|
||||
|
|
@ -120,7 +125,7 @@ pub fn reconcile() -> Result<()> {
|
|||
}
|
||||
fs::create_dir_all("/etc/archipelago").map_err(|e| e.to_string())?;
|
||||
atomic(Path::new("/etc/archipelago/provisioned"), format!("{name}\n").as_bytes())?;
|
||||
println!("Desktop onboarding observed after authenticated user login: {name}");
|
||||
println!("Native desktop onboarding observed with a verified primary user session: {name}");
|
||||
return Ok(());
|
||||
}
|
||||
// Pending is normal while the native setup session is active.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue