Skip to content

Commit

Permalink
Add fixup_root_partition() function
Browse files Browse the repository at this point in the history
This adds some consistency with fixup_boot_partition, making code easier
to read, and removes duplication of the list of files to update
(currently only fstab).
  • Loading branch information
matthijskooijman committed Jul 28, 2022
1 parent a26aaff commit 94b2bcc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions rpi-clone
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,15 @@ fixup_cmdline_txt()
fi
}

fixup_root_partition()
{
partition=$1
src_mount=$2
dst_mount=$3

fixup_device_references_in_file "${partition}" "${dst_mount}" /etc/fstab
}

fixup_device_references_in_file() {
partition=$1
dst_mount=$2
Expand Down Expand Up @@ -1828,7 +1837,7 @@ do

# This partition *might* be a boot or root partition, so try fixups for both
fixup_boot_partition "partition $p " "${clone_src}" "${clone}"
fixup_device_references_in_file "partition $p " "${clone}" /etc/fstab
fixup_root_partition "partition $p " "${clone_src}" "${clone}"

unmount_list "$unmount_list"
fi
Expand Down Expand Up @@ -1870,7 +1879,7 @@ done
qecho ""

fixup_boot_partition /boot /boot "${clone}/boot"
fixup_device_references_in_file "" "${clone}" /etc/fstab
fixup_root_partition "" / "${clone}"

rm -f $clone/etc/udev/rules.d/70-persistent-net.rules

Expand Down

0 comments on commit 94b2bcc

Please sign in to comment.