Compare commits

...

3 Commits

2 changed files with 30 additions and 3 deletions

View File

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -x set -x
if [[ "$(id -u)" -ne 0 ]]; then
>&2 echo "$0: please run this script as root"
exit 1
fi
KICKSTART_BASE="Rocky" KICKSTART_BASE="Rocky"
TODAY="$(TZ='UTC' date +%Y.%m.%d)" TODAY="$(TZ='UTC' date +%Y.%m.%d)"
KICKSTART_FILE="${KICKSTART_BASE}.ks" KICKSTART_FILE="${KICKSTART_BASE}.ks"
@ -15,6 +21,13 @@ for COMMAND in "${COMMANDS_TO_CHECK[@]}"; do
fi fi
done done
if [[ -n "$1" ]]; then
GUSER="^$1"
if ! grep $GUSER /etc/shadow > /dev/null; then
>&2 echo "$0: ERROR: unable to find user '$1'"
fi
fi
function create_new_image { function create_new_image {
UBOOT_MAX_SIZE='32' UBOOT_MAX_SIZE='32'
IMAGE_SIZE=$(( $(stat -c '%s' "${IMAGE_NAME}") / 1024 / 1024 )) IMAGE_SIZE=$(( $(stat -c '%s' "${IMAGE_NAME}") / 1024 / 1024 ))

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 sed -i "s/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/%wheel\tALL=(ALL)\tNOPASSWD: ALL/" /etc/sudoers
# dotfiles # dotfiles
sudo -i -u "${USER_NAME}" git clone --bare https://gitlab.com/thefossguy/dotfiles.git "/home/${USER_NAME}/.dotfiles" cat << EOF > get-dotfiles.sh
sudo -i -u "${USER_NAME}" git --git-dir="/home/${USER_NAME}/.dotfiles" --work-tree="/home/${USER_NAME}" checkout -f #!/usr/bin/env bash
rm -rf "/home/${USER_NAME}/.config/nvim"
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 # Lock the root account
passwd -l root passwd -l root