Hi! I am trying to automate my install process by creating a json file that can be used by archinstall (example). One of the example shows how you can run custom commands to get paru (yay, but written in Rust):

"custom-commands": [
        "cd /home/devel; git clone https://aur.archlinux.org/paru.git",
        "chown -R devel:devel /home/devel/paru",
    ]

However, their example doesn't provide any further information about installing packages with paru. I would like to install some stuff just for my user.

My idea was the following:

  • using archinstall, install everything according to the config
  • disregard the "custom-commands" option in the config and create a separate custom script
  • get all the users from the system and allow user to choose which one to chroot as
  • run all commands as the chosen user ( e.g., install Rust with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh )

I need to install a few packages that are not in the official repository, as well as moving my dotfiles in /home/user/.config and making sure everything is accessible by that user. If there are any better approaches to this, I would be glad to hear them!

An example of the script I am planning to use after running archinstall:

spoiler
#!/bin/bash

# Find all users on the system
for user in $(ls /home); do
    if [ "$user" != "lost+found" ]; then
        users+=($user)
    fi
done

# If there is more than one user, ask which user to install for
if [ ${#users[@]} -gt 1 ]; then
    echo "Multiple users found on system. Please select a user to install for:"
    select user in "${users[@]}"; do
        if [[ " ${users[@]} " =~ " ${user} " ]]; then
            break
        else
            echo "Invalid selection"
        fi
    done
else
    user=${users[0]}
fi

echo "Installing for user $user"

# chroot as the user
arch-chroot -u $user /mnt/archinstall # This only opens bash, but I am working on it :D 
cd /home/$user

# Install paru
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si

# Install stuff with paru
paru -S tlrc --noconfirm