From fb2ff92b73bac633351ab060608f151a665731dc Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 19 Sep 2024 21:23:16 +0200 Subject: [PATCH] Refactor the `sudo` configuration script --- scripts/Arch/OS/setup.fish | 3 +-- scripts/Arch/Scripts/deploy.fish | 1 + scripts/Arch/Software/sudo/main.fish | 15 +++++++++++++++ scripts/Common/OS/install.fish | 2 +- scripts/Common/OS/setup.fish | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 scripts/Arch/Software/sudo/main.fish diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 111bd25c..628cd47c 100755 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -11,7 +11,7 @@ begin end function installValhallaDeps -V mountDir - pacstrap -K "$mountDir" fish git jq nix tmux + pacstrap -K "$mountDir" fish git jq nix sudo tmux end function getInstallerScript -V dir -S @@ -82,7 +82,6 @@ begin and arch-chroot "$mountDir" mkinitcpio -P and runHook installDrivers "Installing drivers..." || true - and arch-chroot "$mountDir" bash "$tempDir/../Software/sudo/install.sh" and runInOS fish "$tempDir/../Software/GRUB/main.fish" and if set -l keyLayout (getConfig valhalla.keyboardLayout) diff --git a/scripts/Arch/Scripts/deploy.fish b/scripts/Arch/Scripts/deploy.fish index 3f92c8d7..f1b7e909 100644 --- a/scripts/Arch/Scripts/deploy.fish +++ b/scripts/Arch/Scripts/deploy.fish @@ -36,6 +36,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action end and source "$dir/../../Common/Software/bash/main.fish" $argv + and source "$dir/../Software/sudo/main.fish" $argv and source "$dir/../Software/openssh/main.fish" $argv and source "$dir/../Software/vim/main.fish" $argv and source "$dir/../Software/git/main.fish" $argv diff --git a/scripts/Arch/Software/sudo/main.fish b/scripts/Arch/Software/sudo/main.fish new file mode 100755 index 00000000..0c012615 --- /dev/null +++ b/scripts/Arch/Software/sudo/main.fish @@ -0,0 +1,15 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../Scripts/software.fish" + + function installSW + pacinst sudo + end + + function configureSW + echo "%wheel ALL=(ALL:ALL) ALL" | sudo tee /etc/sudoers.d/wheel > /dev/null + end + + runInstaller $argv +end diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index c57b704a..35b7d33e 100755 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -14,7 +14,7 @@ if [ (id -u) -eq 0 ] --comment "PortValhalla setup user" \ --system \ --no-user-group \ - --groups wheel,nix-users \ + --groups nix-users \ --create-home \ --uid (getConfig valhalla.setupUser.id --json) \ "$name" diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 057cadf5..03cfe308 100755 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -18,7 +18,7 @@ function runSetup if not type -q installValhallaDeps function installValhallaDeps - echo 'Please set up the hook `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix` and `tmux`.' + echo 'Please set up the hook `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.' exit 1 end end