mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
fix(greeter): remove auto-login state resolution from first install configuration
- Update auto-login command to: `dms greeter sync --autologin`
This commit is contained in:
@@ -75,7 +75,7 @@ var greeterSyncCmd = &cobra.Command{
|
|||||||
auth, _ := cmd.Flags().GetBool("auth")
|
auth, _ := cmd.Flags().GetBool("auth")
|
||||||
local, _ := cmd.Flags().GetBool("local")
|
local, _ := cmd.Flags().GetBool("local")
|
||||||
profile, _ := cmd.Flags().GetBool("profile")
|
profile, _ := cmd.Flags().GetBool("profile")
|
||||||
autologinOnly, _ := cmd.Flags().GetBool("autologin-only")
|
autologinOnly, _ := cmd.Flags().GetBool("autologin")
|
||||||
term, _ := cmd.Flags().GetBool("terminal")
|
term, _ := cmd.Flags().GetBool("terminal")
|
||||||
if term {
|
if term {
|
||||||
if err := syncInTerminal(yes, auth, local, profile, autologinOnly); err != nil {
|
if err := syncInTerminal(yes, auth, local, profile, autologinOnly); err != nil {
|
||||||
@@ -101,7 +101,7 @@ func init() {
|
|||||||
greeterSyncCmd.Flags().BoolP("auth", "a", false, "Configure PAM for fingerprint and U2F (adds both if modules exist); overrides UI toggles")
|
greeterSyncCmd.Flags().BoolP("auth", "a", false, "Configure PAM for fingerprint and U2F (adds both if modules exist); overrides UI toggles")
|
||||||
greeterSyncCmd.Flags().BoolP("local", "l", false, "Developer mode: force greetd config to use a local DMS checkout path")
|
greeterSyncCmd.Flags().BoolP("local", "l", false, "Developer mode: force greetd config to use a local DMS checkout path")
|
||||||
greeterSyncCmd.Flags().BoolP("profile", "p", false, "Sync only your per-user greeter slot (no sudo; for secondary accounts)")
|
greeterSyncCmd.Flags().BoolP("profile", "p", false, "Sync only your per-user greeter slot (no sudo; for secondary accounts)")
|
||||||
greeterSyncCmd.Flags().Bool("autologin-only", false, "Apply only greeter auto-login on startup settings to greetd (no theme or auth sync)")
|
greeterSyncCmd.Flags().Bool("autologin", false, "Apply only greeter auto-login on startup settings to greetd (no theme or auth sync)")
|
||||||
}
|
}
|
||||||
|
|
||||||
var greeterEnableCmd = &cobra.Command{
|
var greeterEnableCmd = &cobra.Command{
|
||||||
@@ -544,7 +544,7 @@ func syncInTerminal(nonInteractive bool, forceAuth bool, local bool, profileOnly
|
|||||||
syncFlags = append(syncFlags, "--profile")
|
syncFlags = append(syncFlags, "--profile")
|
||||||
}
|
}
|
||||||
if autologinOnly {
|
if autologinOnly {
|
||||||
syncFlags = append(syncFlags, "--autologin-only")
|
syncFlags = append(syncFlags, "--autologin")
|
||||||
}
|
}
|
||||||
shellSyncCmd := "dms greeter sync"
|
shellSyncCmd := "dms greeter sync"
|
||||||
if len(syncFlags) > 0 {
|
if len(syncFlags) > 0 {
|
||||||
|
|||||||
@@ -2153,18 +2153,6 @@ vt = 1
|
|||||||
commandLine := fmt.Sprintf(`command = "%s"`, commandValue)
|
commandLine := fmt.Sprintf(`command = "%s"`, commandValue)
|
||||||
newConfig := upsertDefaultSession(configContent, greeterUser, commandLine)
|
newConfig := upsertDefaultSession(configContent, greeterUser, commandLine)
|
||||||
|
|
||||||
homeDir, homeErr := os.UserHomeDir()
|
|
||||||
if homeErr == nil {
|
|
||||||
enabled, loginUser, sessionExec, resolveErr := resolveGreeterAutoLoginState(GreeterCacheDir, homeDir)
|
|
||||||
if resolveErr != nil {
|
|
||||||
logFunc(fmt.Sprintf("⚠ Warning: Failed to resolve greeter auto-login state: %v", resolveErr))
|
|
||||||
} else if enabled && loginUser != "" && sessionExec != "" {
|
|
||||||
newConfig = upsertInitialSession(newConfig, loginUser, sessionExec, true)
|
|
||||||
} else {
|
|
||||||
newConfig = upsertInitialSession(newConfig, "", "", false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := writeGreetdConfig(configPath, newConfig, logFunc, sudoPassword, fmt.Sprintf("✓ Updated greetd configuration (user: %s, command: %s)", greeterUser, commandValue)); err != nil {
|
if err := writeGreetdConfig(configPath, newConfig, logFunc, sudoPassword, fmt.Sprintf("✓ Updated greetd configuration (user: %s, command: %s)", greeterUser, commandValue)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function launchGreeterAutoLoginSyncTerminalFallback(details) {
|
function launchGreeterAutoLoginSyncTerminalFallback(details) {
|
||||||
ToastService.showWarning(I18n.tr("Opening terminal to update greetd"), I18n.tr("DMS needs administrator access. The terminal closes automatically when done.") + (details ? "\n\n" + details : ""), "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
ToastService.showWarning(I18n.tr("Opening terminal to update greetd"), I18n.tr("DMS needs administrator access. The terminal closes automatically when done.") + (details ? "\n\n" + details : ""), "dms greeter sync --autologin", "greeter-autologin-sync");
|
||||||
greeterAutoLoginSyncTerminalFallbackStderr = "";
|
greeterAutoLoginSyncTerminalFallbackStderr = "";
|
||||||
greeterAutoLoginSyncTerminalFallbackProcess.running = true;
|
greeterAutoLoginSyncTerminalFallbackProcess.running = true;
|
||||||
}
|
}
|
||||||
@@ -530,7 +530,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property var greeterAutoLoginSyncProcess: Process {
|
property var greeterAutoLoginSyncProcess: Process {
|
||||||
command: ["dms", "greeter", "sync", "--yes", "--autologin-only"]
|
command: ["dms", "greeter", "sync", "--yes", "--autologin"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
@@ -570,7 +570,7 @@ Singleton {
|
|||||||
onExited: exitCode => {
|
onExited: exitCode => {
|
||||||
const enabling = root.settingsRoot && root.settingsRoot.greeterAutoLogin;
|
const enabling = root.settingsRoot && root.settingsRoot.greeterAutoLogin;
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
ToastService.showWarning(enabling ? I18n.tr("Applying auto-login on startup…") : I18n.tr("Disabling auto-login on startup…"), "", "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
ToastService.showWarning(enabling ? I18n.tr("Applying auto-login on startup…") : I18n.tr("Disabling auto-login on startup…"), "", "dms greeter sync --autologin", "greeter-autologin-sync");
|
||||||
root.greeterAutoLoginSyncProcess.running = true;
|
root.greeterAutoLoginSyncProcess.running = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -580,7 +580,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property var greeterAutoLoginSyncTerminalFallbackProcess: Process {
|
property var greeterAutoLoginSyncTerminalFallbackProcess: Process {
|
||||||
command: ["dms", "greeter", "sync", "--terminal", "--yes", "--autologin-only"]
|
command: ["dms", "greeter", "sync", "--terminal", "--yes", "--autologin"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
stderr: StdioCollector {
|
stderr: StdioCollector {
|
||||||
@@ -592,7 +592,7 @@ Singleton {
|
|||||||
root.greeterAutoLoginSyncSuccessToast("");
|
root.greeterAutoLoginSyncSuccessToast("");
|
||||||
} else {
|
} else {
|
||||||
let details = (root.greeterAutoLoginSyncTerminalFallbackStderr || "").trim();
|
let details = (root.greeterAutoLoginSyncTerminalFallbackStderr || "").trim();
|
||||||
ToastService.showError(I18n.tr("Couldn't open a terminal for the auto-login update.") + " (exit " + exitCode + ")", details, "dms greeter sync --autologin-only", "greeter-autologin-sync");
|
ToastService.showError(I18n.tr("Couldn't open a terminal for the auto-login update.") + " (exit " + exitCode + ")", details, "dms greeter sync --autologin", "greeter-autologin-sync");
|
||||||
}
|
}
|
||||||
root.finishGreeterAutoLoginSync();
|
root.finishGreeterAutoLoginSync();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user