summaryrefslogtreecommitdiff
path: root/installer/guix-password
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-06-21 22:52:21 -0400
committerFreya Murphy <freya@freyacat.org>2024-06-21 22:52:21 -0400
commitcf5d8d92f1904511006a89970349dbf723ae1732 (patch)
tree2deb7af8e9031a502b6b7f1c263198e4d6b93f9f /installer/guix-password
parentupdate guixstrap (diff)
downloaddotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.tar.gz
dotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.tar.bz2
dotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.zip
update things
Diffstat (limited to 'installer/guix-password')
-rwxr-xr-xinstaller/guix-password51
1 files changed, 51 insertions, 0 deletions
diff --git a/installer/guix-password b/installer/guix-password
new file mode 100755
index 0000000..a39c566
--- /dev/null
+++ b/installer/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 freya
+$USER_PASSWORD
+$USER_PASSWORD
+EOF
+
+EVENT "Successfully set passwords"