autosign.py 1005 B

12345678910111213141516171819202122
  1. from .autosign_orig import *
  2. class overlay_fake_Autosign:
  3. def init_fixup(self):
  4. if pfx := self.cfg.test_suite_root_pfx:
  5. subdir = pfx + '/' + ('online' if self.cfg.online else 'offline')
  6. for k in ('mountpoint', 'shm_dir', 'wallet_dir'):
  7. orig_path = str(getattr(self, k))
  8. setattr(self, k, Path(subdir + orig_path.removeprefix(subdir)))
  9. # mount --type=fuse-ext2 --options=rw+ ### current fuse-ext2 (0.4 29) is buggy - can’t use
  10. import sys
  11. if sys.platform == 'linux':
  12. self.dev_label = 'MMGEN_TS_ONLINE' if self.cfg.online else 'MMGEN_TS_OFFLINE'
  13. self.mount_cmd = f'sudo mount LABEL={self.dev_label} {self.mountpoint}'
  14. self.umount_cmd = f'sudo umount {self.mountpoint}'
  15. self.linux_blkid_cmd = 'sudo blkid -s LABEL -o value'
  16. Autosign.dev_label = 'MMGEN_TS_TX' # autosign_live only (Linux)
  17. Autosign.linux_mount_subdir = 'mmgen_ts_autosign'
  18. Autosign.macOS_ramdisk_name = 'TestAutosignRamDisk'
  19. Autosign.init_fixup = overlay_fake_Autosign.init_fixup