diff options
| author | Tyler Murphy <tylerm@tylerm.dev> | 2023-10-07 16:59:12 -0400 |
|---|---|---|
| committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-10-07 16:59:12 -0400 |
| commit | 0be7c27439b75a16cd340b4a72855a7cc6cec06a (patch) | |
| tree | 3ec923632137c223911a21ed169a1247d9051406 /guix-strap/guix-password | |
| parent | format btrfs, no YES on cryptsetup format needed (diff) | |
| download | dotfiles-guix-0be7c27439b75a16cd340b4a72855a7cc6cec06a.tar.gz dotfiles-guix-0be7c27439b75a16cd340b4a72855a7cc6cec06a.tar.bz2 dotfiles-guix-0be7c27439b75a16cd340b4a72855a7cc6cec06a.zip | |
guix strap done (hopefully)
Diffstat (limited to 'guix-strap/guix-password')
| -rwxr-xr-x | guix-strap/guix-password | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/guix-strap/guix-password b/guix-strap/guix-password new file mode 100755 index 0000000..008ad14 --- /dev/null +++ b/guix-strap/guix-password @@ -0,0 +1,51 @@ +#!/run/current-system/profile/bin/bash + +USER_PASSWORD="" +ROOT_PASSWORD="" + +source ./guix-env +source ./guix-log + +get_root_password() { + read -s -p "Root password: " PASSWORD + printf "\n" + read -s -p "Confirm password: " PASSWORD_CONFIRM + printf "\n" + if [ "$PASSWORD" == "$PASSWORD_CONFIRM" ]; then + ROOT_PASSWORD=$PASSWORD + return + else + ERROR "Passwords do not match" + get_root_password + fi +} + +get_user_password() { + read -s -p "User password: " PASSWORD + printf "\n" + read -s -p "Confirm password: " PASSWORD_CONFIRM + printf "\n" + if [ "$PASSWORD" == "$PASSWORD_CONFIRM" ]; then + USER_PASSWORD=$PASSWORD + return + else + ERROR "Passwords do not match" + get_user_password + fi +} + +EVENT "Setup /etc/shadow for root and user" + +get_root_password +get_user_password + +cat << EOF | chroot /mnt +passwd +$ROOT_PASSWORD +$ROOT_PASSWORD +passwd tylerm +$USER_PASSWORD +$USER_PASSWORD +EOF + +EVENT "Successfully set passwords" |