From d8512ed9d3e1faced1b26316e6489195975bce11 Mon Sep 17 00:00:00 2001 From: DavHau <42246742+DavHau@users.noreply.github.com> Date: Fri, 14 Feb 2020 08:04:27 +0700 Subject: [PATCH] add LVM support (#44) --- nixos-infect | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nixos-infect b/nixos-infect index 5aa4f30..aca4417 100755 --- a/nixos-infect +++ b/nixos-infect @@ -36,8 +36,8 @@ EOF { ... }: { imports = [ ]; - boot.loader.grub.device = "/dev/$disk"; - fileSystems."/" = { device = "/dev/${disk}1"; fsType = "ext4"; }; + boot.loader.grub.device = "$grubdev"; + fileSystems."/" = { device = "$rootfsdev"; fsType = "ext4"; }; } EOF @@ -147,8 +147,12 @@ removeSwap() { } prepareEnv() { - # $disk is used in makeConf() - for disk in vda sda; do [[ -e /dev/$disk ]] && break; done + # $grubdev is used in makeConf() + for grubdev in /dev/vda /dev/sda; do [[ -e $grubdev ]] && break; done + + # Retrieve root fs block device + # (get root mount) (get partition or logical volume) + rootfsdev=$(mount | grep "on / type" | awk '{print $1;}') # DigitalOcean doesn't seem to set USER while running user data export USER="root"