diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index e281705b..bce53d04 100755 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -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 diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index a78cacd7..2934587b 100755 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -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