def enable_service(install_executable): if Recipe.cleaning: sh("sudo systemctl stop x1e2-custodian").interactive().sync() sh("sudo systemctl disable x1e2-custodian").interactive().sync() else: sh("sudo systemctl enable x1e2-custodian").interactive().sync() sh("sudo systemctl start x1e2-custodian").interactive().sync()
async def _clean(self): if not self.output().exists(): return if (not sh("sudo rm {dst}", dst=self.dst).interactive().no_echo().sync().succeeded()): raise BuildError("Failed to delete installed file.")
async def _resolve(self): flags = ["-Dm{chmod}"] if self.user is not None: flags.append("-o{user}") if self.group is not None: flags.append("-g{group}") if (not sh( ["sudo", "install", *flags, "{src}", "{dst}"], chmod=self.chmod, user=self.user, group=self.group, src=self.src, dst=self.dst, ).interactive().sync().succeeded()): raise BuildError("Failed to install file.")
def interactive_shell(self, cmd=None): return sh(cmd or '$SHELL', cwd=self.location).interactive().no_echo().sync().report()
def sh(self, *args, **kwargs) -> ShellReport: return sh(*args, **{ **kwargs, 'cwd': self.location }).no_echo().sync().report()