def nspawn_exec_stop(self) -> Command: """ Container stop command """ program = system_command('true') return Command([program])
def file_create(self, path) -> Command: touch = system_command('touch') return Command([touch, '-a', path])
def nspawn_exec_start(self) -> Command: """ Container start command """ program = SYSTEMD_NSPAWN.binary return Command([program])
def folder_create(self, path) -> Command: mkdir = system_command('mkdir') return Command([mkdir, '-p', path])
def folder_delete(self, path) -> Command: rm = system_command('rm') return Command([rm, '-r', '-f', path])
def mount_point_desure(self) -> Command: # TODO shell = system_command('sh') test = " ".join(self.mount_point_test()) delete = " ".join(self.mount_point_delete()) return Command([shell, '-c', f"while {test} ; do {delete} ; sleep {self.delay} ; done" ])
def mount_point_ensure(self) -> Command: # TODO shell = system_command('sh') test = " ".join(self.mount_point_test()) create = " ".join(self.mount_point_create()) return Command([shell, '-c', f"until {test} ; do {create} ; sleep {self.delay} ; done" ])
def mount_point_delete(self) -> Command: umount = system_command('umount') point = self.machine_store.mount_point() return Command([umount, point])
def mount_point_create(self) -> Command: mount = system_command('mount') point = self.machine_store.mount_point() options = self.mount_options() return Command([mount, '-t', 'overlay', '-o', options, 'overlay', point])
def mount_point_test(self) -> Command: test = system_command('mountpoint') point = self.machine_store.mount_point() return Command([test, point])