In [24]:
from pprint import pprint
from partitions import PartitionTable
from edit import rsync, edit_files, grub_install

In [25]:
partition_table = PartitionTable()
print(partition_table)


Partition Table:
  H /dev/sda1 vfat B0E0-D39 /boot/efi
  H /dev/sda2 ext4 64a6e752 /
  H /dev/sda3 zfs_ 14080253 None
  H /dev/sdb1 swap ccf03a1b None
  H /dev/sdb2 zfs_ 14080253 None
  H /dev/sdc1 vfat 75C9-087 /mnt/sdc2/boot/efi
  H /dev/sdc2 ext4 029eb40a /mnt/sdc2

In [26]:
partition_table.find_source_disk()
print('sources')
pprint(partition_table.sources)
partition_table.find_dest_disk()
print('\ndests')
pprint(partition_table.dests)


sources
{'/': <partitions.DiskPart object at 0x7f06380da5f8>,
 '/boot/efi': <partitions.DiskPart object at 0x7f06380466d8>}

dests
OrderedDict([('/mnt/sdc2', <partitions.DiskPart object at 0x7f06380da7b8>),
             ('/mnt/sdc2/boot/efi',
              <partitions.DiskPart object at 0x7f06380da9b0>)])

In [27]:
partition_table.mount_dest_disk()
print(partition_table)


Partition Table:
  H /dev/sda1 vfat B0E0-D39 /boot/efi
  H /dev/sda2 ext4 64a6e752 /
  H /dev/sda3 zfs_ 14080253 None
  H /dev/sdb1 swap ccf03a1b None
  H /dev/sdb2 zfs_ 14080253 None
  H /dev/sdc1 vfat 75C9-087 /mnt/sdc2/boot/efi
  H /dev/sdc2 ext4 029eb40a /mnt/sdc2

In [28]:
rsync(partition_table)
edit_files(partition_table)


rsync: cmd = rsync -a --one-file-system --delete --exclude EFI/tools /boot/efi/ /mnt/sdc2/boot/efi/
[b'']
rsync: cmd = rsync -a --one-file-system --delete --exclude tmp/* --exclude var/log/* / /mnt/sdc2/
[b'']

In [29]:
print()




In [31]:
print(grub_install(partition_table))


None

In [ ]: