Files
dotfiles/.local/bin/station-setup-password

25 lines
850 B
Plaintext
Raw Normal View History

2026-03-01 23:15:53 +00:00
#! /bin/bash
2026-03-01 00:09:35 +00:00
2026-03-14 16:07:57 +00:00
echo "-------------------------------------"
echo "Password Setup Script"
echo "-------------------------------------"
if gum confirm "Do you need to change your password?"; then
2026-03-22 14:01:11 +00:00
new_password=$(gum input --password --placeholder "Enter new password")
confirm_password=$(gum input --password --placeholder "Confirm new password")
2026-03-14 16:07:57 +00:00
2026-03-22 14:01:11 +00:00
if [ "$new_password" != "$confirm_password" ]; then
echo "Passwords do not match."
exit 1
elif [[ $new_password == "" ]]; then
echo "Password cannot be empty."
exit 1
fi
sudo sh -c 'mkpasswd -m sha-512 "$new_password" > /persist/passwords/user'
echo
echo "New password written to /persist/passwords/user"
echo "Password will become active next time you run:"
echo "sudo nixos-rebuild switch"e
2026-03-14 16:07:57 +00:00
echo "Password change skipped."
fi