Esempio n. 1
0
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()
Esempio n. 2
0
    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.")
Esempio n. 3
0
    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.")
Esempio n. 4
0
 def interactive_shell(self, cmd=None):
     return sh(cmd or '$SHELL',
               cwd=self.location).interactive().no_echo().sync().report()
Esempio n. 5
0
 def sh(self, *args, **kwargs) -> ShellReport:
     return sh(*args, **{
         **kwargs, 'cwd': self.location
     }).no_echo().sync().report()