summaryrefslogtreecommitdiff
path: root/installer/guix-partition
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-partition
parentupdate guixstrap (diff)
downloaddotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.tar.gz
dotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.tar.bz2
dotfiles-guix-cf5d8d92f1904511006a89970349dbf723ae1732.zip
update things
Diffstat (limited to 'installer/guix-partition')
-rwxr-xr-xinstaller/guix-partition66
1 files changed, 66 insertions, 0 deletions
diff --git a/installer/guix-partition b/installer/guix-partition
new file mode 100755
index 0000000..7acaefd
--- /dev/null
+++ b/installer/guix-partition
@@ -0,0 +1,66 @@
+#!/run/current-system/profile/bin/bash
+
+set -o emacs;
+
+DISK=""
+
+source ./guix-log
+source ./guix-env
+
+EVENT "Partitioning disks"
+
+check_disk() {
+ lsblk $1 &> /dev/null || exit 1
+ FS=$(df $1 | tail -n 1 | awk '{print $1}')
+ if [ "$FS" == "none" ]; then
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+get_disk() {
+ CONFIRM=""
+ read -ep "Enter disk (e.g. /dev/sda): " DISK
+ if [ ! -b "$DISK" ]; then
+ ERROR "$DISK: file does not exist"
+ get_disk
+ return
+ fi
+ (check_disk "$DISK");
+ if [ "$?" -ne 0 ]; then
+ ERROR "$DISK: not a valid disk"
+ get_disk
+ return
+ fi
+ (confirm "$DISK");
+ if [ "$?" -ne 0 ]; then
+ get_disk
+ fi
+}
+
+get_disk
+
+EVENT "Partitioning disks with fdisk..."
+
+fdisk "$DISK" <<EOF
+g
+n
+
+
++1GiB
+t
+EFI System
+n
+
+
+
+t
+2
+Linux Filesystem
+w
+EOF
+
+echo "DISK=\"$DISK\"" >> ./guix-env
+
+EVENT "Disks have been successfully partitioned on $DISK"