diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 6aa6a7aa..d3c71640 100644 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -91,11 +91,6 @@ begin and arch-chroot "$mountDir" bash "$tempDir/../Software/sudo/install.sh" and runInOS fish "$tempDir/../Software/GRUB/main.fish" - and USER_NAME="$USER_NAME" \ - USER_DISPLAYNAME="$USER_DISPLAYNAME" \ - USER_GROUPS="$USER_GROUPS" \ - arch-chroot "$mountDir" bash "$tempDir/user.sh" - and if set -l keyLayout (getConfig valhalla.keyboardLayout) set -l serviceName set-keymap.service and set -l serviceFile "$mountDir/etc/systemd/system/$serviceName" diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index 6f494dc8..00b77606 100644 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -39,5 +39,10 @@ else runHook installOS || true runHook installSoftware || true runHook initializeConfig || true + + runHook addUsers || begin + source "$dir/users.fish" + end + runHook postInstall || true end diff --git a/scripts/Common/OS/users.fish b/scripts/Common/OS/users.fish new file mode 100644 index 00000000..7935b25b --- /dev/null +++ b/scripts/Common/OS/users.fish @@ -0,0 +1,27 @@ +#!/bin/env fish +set -l dir (status dirname) +source "$dir/../Scripts/config.fish" +set -l users (getConfig valhalla.users --apply "builtins.attrNames" --json) + + +for name in (echo "$users" | jq '.[]' --raw-output0 | string split0) + function getUserConfig -S -a config + getConfig "valhalla.users.$name.$config" $argv[2..] + end + + set -l displayName (getUserConfig displayName --json) + + useradd --create-home ( + if [ displayName != "null" ] + echo "--comment" + echo "$displayName" | jq --raw-output + end + ) --groups (getUserConfig groups --apply 'builtins.concatStringsSep ","') \ + "$name" + + echo "Please Choose a New Password for User \`$name\`" + + while ! passwd "$name" + echo "An error occurred! Please try again." + end +end