%post set -x # The official kickstart docs has a 'user' command, but using it somehow # causes 'systemd-logind.service' to fail during boot and you are essentially # locked out even when you enter the correct credentials # User setup USER_COMMENT='Pratham Patel' USER_NAME='pratham' USER_PASSWORD='asdf' USER_GROUPS='mock,wheel' # The 'useradd' binary can't be found in $PATH (idk why), so # execute it using its absolute path /sbin/useradd \ --uid 1000 \ --create-home \ --comment "${USER_COMMENT}" \ --user-group "${USER_NAME}" \ --groups "${USER_GROUPS}" echo -e "${USER_PASSWORD}\n${USER_PASSWORD}" | passwd "${USER_NAME}" sed -i "s/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/%wheel\tALL=(ALL)\tNOPASSWD: ALL/" /etc/sudoers # dotfiles cat << EOF > get-dotfiles.sh #!/usr/bin/env bash set -x if [[ "$(id -u)" -eq 0 ]]; then echo "Not gonna run as root" exit 1 fi echo "Hi $USER" git clone --bare https://gitlab.com/thefossguy/dotfiles.git "${HOME}/.dotfiles" git --git-dir="${HOME}/.dotfiles" --work-tree="${HOME}" checkout -f rm -rf "${HOME}/.config/nvim" EOF chmod +x get-dotfiles.sh sudo -i -u "${USER_NAME}" bash get-dotfiles.sh rm -vf get-dotfiles.sh # Lock the root account passwd -l root %end