minor fixes and improvements
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index afd88a007fc3d503e33f39a65e0dfbbe772b66b0..7c88c7492a8b808ceeb52eaf0c3eb25b87260c47 100755 (executable)
@@ -153,18 +153,23 @@ else
   wipe=true
 fi
 
-## ignore disks that are mounted, eg when running from fai-cd
-declare -A disk_excludes
-while read -r l; do
-  eval "$l"
-  if [[ ! $PKNAME ]]; then
-    PKNAME="$KNAME"
-  fi
-  if [[ $MOUNTPOINT ]]; then
-    disk_excludes[$PKNAME]=true
-  fi
-done < <(lsblk -nP -o KNAME,MOUNTPOINT,PKNAME)
+if ((`nproc` > 2)); then
+  mopts=,compress=zstd
+fi
 
+declare -A disk_excludes
+if ! ifclass USE_MOUNTED; then
+  ## ignore disks that are mounted, eg when running from fai-cd
+  while read -r l; do
+    eval "$l"
+    if [[ ! $PKNAME ]]; then
+      PKNAME="$KNAME"
+    fi
+    if [[ $MOUNTPOINT ]]; then
+      disk_excludes[$PKNAME]=true
+    fi
+  done < <(lsblk -nP -o KNAME,MOUNTPOINT,PKNAME)
+fi
 
 hdds=()
 ssds=()
@@ -582,8 +587,8 @@ EOF
 else
   # note, fai creates the mountpoints listed here
   cat > /tmp/fai/fstab <<EOF
-$first_root_crypt  /  btrfs          noatime,subvol=root_$DISTRO  0 0
-$first_root_crypt  /mnt/root  btrfs  nofail,noatime,subvolid=0  0 0
+$first_root_crypt  /  btrfs          noatime,subvol=root_$DISTRO$mopts  0 0
+$first_root_crypt  /mnt/root  btrfs  nofail,noatime,subvolid=0$mopts  0 0
 $first_boot_dev  /boot  btrfs        nofail,noatime,subvol=$boot_vol  0 0
 $first_boot_dev  /mnt/boot  btrfs    nofail,noatime,subvolid=0  0 0
 EOF