improve the dotfiles setup

This commit is contained in:
Pratham Patel 2023-11-20 17:58:25 +05:30
parent 697f87eeb5
commit 041f5bc97d
No known key found for this signature in database

View File

@ -24,9 +24,23 @@ 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
sudo -i -u "${USER_NAME}" git clone --bare https://gitlab.com/thefossguy/dotfiles.git "/home/${USER_NAME}/.dotfiles"
sudo -i -u "${USER_NAME}" git --git-dir="/home/${USER_NAME}/.dotfiles" --work-tree="/home/${USER_NAME}" checkout -f
rm -rf "/home/${USER_NAME}/.config/nvim"
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