OSDN Git Service

seperate mount script
authorpaperbenni <paperbenni@gmail.com>
Sat, 30 May 2020 14:34:04 +0000 (16:34 +0200)
committerpaperbenni <paperbenni@gmail.com>
Sat, 30 May 2020 14:34:04 +0000 (16:34 +0200)
bootloader/efi.sh
disk/disk.sh
disk/mount.sh [new file with mode: 0644]
installutils.sh
localinstall.sh
pacstrap/pacstrap.sh

index f686315..6fbec31 100755 (executable)
@@ -4,11 +4,8 @@
 # runs from inside the installation
 # unlike the legacy bios grub script
 
-DISK=$(cat /root/instantARCH/config/disk)
 mkdir /efi
-DISK1=$(fdisk -l | grep "^${DISK}" | grep -o '^[^ ]*' | head -1)
-
-mount "${DISK1}" /efi
+mount "$(cat /root/instantARCH/config/partefi)" /efi
 
 sudo pacman -S efibootmgr grub --noconfirm
 
index 36c0e20..3d9061f 100755 (executable)
@@ -16,6 +16,9 @@ start=618496, type=83, bootable" | sfdisk "${DISK}"
     mkfs.fat -F32 "$DISK1"
     mkfs.ext4 -F "$DISK2"
 
+    echo "$DISK1" >/root/instantARCH/config/partefi
+    echo "$DISK2" >/root/instantARCH/config/partroot
+
 else
     echo "legacy bios"
     echo "label: dos
@@ -23,5 +26,6 @@ type=83, bootable" | sfdisk "${DISK}"
     DISK1="$(fdisk -l | grep "^${DISK}" | grep -o '^[^ ]*' | head -1)"
 
     mkfs.ext4 -F "$DISK1"
+    echo "$DISK1" >/root/instantARCH/config/partroot
 
 fi
diff --git a/disk/mount.sh b/disk/mount.sh
new file mode 100644 (file)
index 0000000..ae82b09
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# mounts all partitions to to the installation medium
+
+# mountpart partname mountpoint
+mountpart() {
+    if [ -e /root/instantARCH/config/part$1 ]; then
+        TMPPART="$(cat /root/instantARCH/config/part$1)"
+        echo "mounting $TMPPART to $2"
+        mount "$TMPPART" "$2"
+    else
+        echo "using default partition for $2"
+    fi
+}
+
+mountpart efi /efi
+mountpart root /mnt
+sleep 2
+
+if ! mount | grep -q '/mnt'; then
+    echo "mount failed"
+    exit 1
+fi
index b100855..123a5bf 100644 (file)
@@ -34,7 +34,7 @@ escript() {
 # scripts executed in installed environment
 chrootscript() {
     setinfo "${2:-info}"
-    if ! mount | grep -q '/mnt.*ext4'; then
+    if ! mount | grep -q '/mnt'; then
         echo "mount failed"
         exit 1
     fi
index 1b126d6..450a3c5 100755 (executable)
@@ -4,5 +4,6 @@ source /root/instantARCH/installutils.sh
 
 escript init/init "configuring time"
 escript disk/disk "partitioning disk"
+escript disk/mount "mounting partitions"
 escript pacstrap/pacstrap "installing base packages"
 sleep 1
index 4cbc140..d8d8e63 100755 (executable)
@@ -1,22 +1,8 @@
 #!/bin/bash
 
-# mount all disks (TODO: make mounting its own module to allow manual partitioning)
 # install base system to target root partition
 
-DISK=$(cat /root/instantARCH/config/disk)
-
-if efibootmgr; then
-    DISK1=$(fdisk -l | grep "^${DISK}" | grep -o '^[^ ]*' | head -1)
-    DISK2=$(fdisk -l | grep "^${DISK}" | grep -o '^[^ ]*' | tail -1)
-
-    mount ${DISK2} /mnt
-    mount ${DISK1} /efi
-else
-    DISK1=$(fdisk -l | grep "^${DISK}" | grep -o '^[^ ]*' | head -1)
-    mount ${DISK1} /mnt
-fi
-
-if ! mount | grep '/mnt.*ext4'; then
+if ! mount | grep '/mnt'; then
     echo "mount failed"
     exit 1
 fi