2023-10-07 20:59:12 +00:00
|
|
|
#!/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
|
2024-06-21 18:11:32 +00:00
|
|
|
passwd freya
|
2023-10-07 20:59:12 +00:00
|
|
|
$USER_PASSWORD
|
|
|
|
$USER_PASSWORD
|
|
|
|
EOF
|
|
|
|
|
|
|
|
EVENT "Successfully set passwords"
|