Disable auto login after installation

This commit is contained in:
Manuel Thalmann 2024-12-08 17:27:03 +01:00
parent 9a911cb93b
commit 93284f2016
2 changed files with 16 additions and 5 deletions

View file

@ -1,6 +1,7 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l dir (status dirname) set -l dir (status dirname)
set -l autologinConfig /etc/systemd/system/getty@tty1.service.d/autologin.conf
source "$dir/../lib/dependencies.fish" source "$dir/../lib/dependencies.fish"
source "$dir/../../Common/OS/setup.fish" source "$dir/../../Common/OS/setup.fish"
source "$dir/../../lib/settings.fish" source "$dir/../../lib/settings.fish"
@ -111,17 +112,20 @@ begin
end end
end end
function autologin -S function autologin -S -V autologinConfig
set -l mountDir (getOSConfig fileSystems.rootDir) set -l mountDir (getOSConfig fileSystems.rootDir)
set -l file "/etc/systemd/system/getty@tty1.service.d/autologin.conf" arch-chroot "$mountDir" mkdir -p (dirname "$autologinConfig")
arch-chroot "$mountDir" mkdir -p (dirname "$file")
and begin and begin
printf %s\n \ printf %s\n \
"[Service]" \ "[Service]" \
"ExecStart=" \ "ExecStart=" \
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I \$TERM" "ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I \$TERM"
end | arch-chroot "$mountDir" tee "$file" >/dev/null end | arch-chroot "$mountDir" tee "$autologinConfig" >/dev/null
end
function getAutologinDisableCommand -V autologinConfig
echo "rm -rf $(string escape (dirname "$autologinConfig"))"
end end
if not type -q getInstallerScript if not type -q getInstallerScript

View file

@ -19,6 +19,12 @@ function runSetup
end end
end end
if not type -q getAutologinDisableCommand
function getAutologinDisableCommand
echo "true"
end
end
function getCloneFile -S -a path function getCloneFile -S -a path
set -l relativeDir (realpath --relative-to "$projectRoot" "$dir") set -l relativeDir (realpath --relative-to "$projectRoot" "$dir")
set -l relativePath (realpath --relative-to "$dir" "$path") set -l relativePath (realpath --relative-to "$dir" "$path")
@ -101,7 +107,8 @@ function runSetup
end end
end) \ end) \
(string escape $script) "&&")) \ (string escape $script) "&&")) \
"rm $tmp ||" \ "rm $tmp &&" \
"$(getAutologinDisableCommand) ||" \
"mv $tmp $profile" "mv $tmp $profile"
end | runChroot "$mountDir" tee "$profile" >/dev/null end | runChroot "$mountDir" tee "$profile" >/dev/null
end end