Write more verbose logs to the console

This commit is contained in:
Manuel Thalmann 2024-09-23 00:23:41 +02:00
parent 3e13101b37
commit bf2701ba08
3 changed files with 22 additions and 4 deletions

View file

@ -10,7 +10,9 @@ if [ (id -u) -eq 0 ]
runHook createUser || \ runHook createUser || \
begin begin
useradd \ echo "Creating setup user";
and useradd \
--comment "PortValhalla Setup User" \ --comment "PortValhalla Setup User" \
--system \ --system \
--no-user-group \ --no-user-group \
@ -44,7 +46,9 @@ else
end end
and runHook installSoftware || begin and runHook installSoftware || begin
if [ -n "$deployScript" ] echo "Installing software..."
and if [ -n "$deployScript" ]
source $deployScript source $deployScript
end end
end end
@ -52,8 +56,10 @@ else
runHook initializeUsers || begin runHook initializeUsers || begin
if [ -n "$deployScript" ] if [ -n "$deployScript" ]
source "$dir/../Scripts/config.fish" source "$dir/../Scripts/config.fish"
for name in (getUsers | jq '.[]' --raw-output0 | string split0) for name in (getUsers | jq '.[]' --raw-output0 | string split0)
source $deployScript userConfig $name echo "Configuring user `$name`..."
and source $deployScript userConfig $name
end end
end end
end end
@ -62,6 +68,7 @@ else
and sudo git config remove-section --system safe and sudo git config remove-section --system safe
and begin and begin
echo "Cleaning installation scripts..."
set -l projectPath (realpath "$(status dirname)/../../..") set -l projectPath (realpath "$(status dirname)/../../..")
cd (dirname "$projectPath") cd (dirname "$projectPath")
sudo rm -rf "$projectPath" sudo rm -rf "$projectPath"

View file

@ -43,21 +43,29 @@ function runSetup
"$argv" "$argv"
end end
getOSConfig partition.script > "$script" echo "Partitioning drives..."
and getOSConfig partition.script > "$script"
and "$script" and "$script"
and rm "$script" and rm "$script"
# Copy `nixpkgs` channel # Copy `nixpkgs` channel
and echo "Preparing nix..."
and begin and begin
set -l channelDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs set -l channelDir /nix/var/nix/profiles/per-user/root/channels/nixpkgs
mkdir -p (dirname "$mountDir/$channelDir") mkdir -p (dirname "$mountDir/$channelDir")
cp -r "$channelDir" "$mountDir/$channelDir" cp -r "$channelDir" "$mountDir/$channelDir"
end end
and echo "Installing dependencies..."
and runHook installValhallaDeps and runHook installValhallaDeps
and echo "Cloning project..."
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT" and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
runChroot "$mountDir" git config --system --add safe.directory "$PROJECT_CLONE_ROOT" runChroot "$mountDir" git config --system --add safe.directory "$PROJECT_CLONE_ROOT"
and runHook setupOS || true and runHook setupOS || true
and echo "Preparing auto-login..."
and runHook autologin || true and runHook autologin || true
and begin and begin

View file

@ -3,8 +3,11 @@ set -l dir (status dirname)
source "$dir/../Scripts/config.fish" source "$dir/../Scripts/config.fish"
set -l users (getUsers) set -l users (getUsers)
echo "Creating users..."
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0) for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
echo "Creating user `$name`..."
function getUserInfo -V name -a config function getUserInfo -V name -a config
getUserConfig "$name" "$config" $argv[2..] getUserConfig "$name" "$config" $argv[2..]
end end