Disable auto login after installation

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

View file

@ -1,6 +1,7 @@
#!/bin/env fish
begin
set -l dir (status dirname)
set -l autologinConfig /etc/systemd/system/getty@tty1.service.d/autologin.conf
source "$dir/../lib/dependencies.fish"
source "$dir/../../Common/OS/setup.fish"
source "$dir/../../lib/settings.fish"
@ -111,17 +112,20 @@ begin
end
end
function autologin -S
function autologin -S -V autologinConfig
set -l mountDir (getOSConfig fileSystems.rootDir)
set -l file "/etc/systemd/system/getty@tty1.service.d/autologin.conf"
arch-chroot "$mountDir" mkdir -p (dirname "$file")
arch-chroot "$mountDir" mkdir -p (dirname "$autologinConfig")
and begin
printf %s\n \
"[Service]" \
"ExecStart=" \
"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
if not type -q getInstallerScript

View file

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