def bootstrap(self, python='pypy'): # Create the user only if it does not already exist if fails('/usr/bin/id {}'.format(self.serviceUser)): if not hasSudoCapabilities(): abort("User {} doesn't exist and we can't create it.".format( self.serviceUser)) sudo( '/usr/sbin/useradd --base-dir {} --groups service --user-group ' '--create-home --system --shell /bin/bash ' '{}'.format(self.baseServicesDirectory, self.serviceUser)) with settings(user=self.serviceUser): # Install twisted pip.install('twisted') # Create base directory setup run('/bin/mkdir -p {} {} {}'.format(self.runDir, self.logDir, self.binDir)) # Create stop script stopFile = FilePath(__file__).sibling('stop') put(stopFile.path, '{}/stop'.format(self.binDir), mode=0755) readme = self._generateReadme() put(StringIO(readme), 'README')
def bootstrap(self, python='pypy'): # Create the user only if it does not already exist if fails('/usr/bin/id {}'.format(self.serviceUser)): if not hasSudoCapabilities(): abort("User {} doesn't exist and we can't create it." .format(self.serviceUser)) sudo('/usr/sbin/useradd --base-dir {} --groups service --user-group ' '--create-home --system --shell /bin/bash ' '{}'.format(self.baseServicesDirectory, self.serviceUser)) with settings(user=self.serviceUser): # Install twisted pip.install('twisted') # Create base directory setup run('/bin/mkdir -p {} {} {}'.format( self.runDir, self.logDir, self.binDir)) # Create stop script stopFile = FilePath(__file__).sibling('stop') put(stopFile.path, '{}/stop'.format(self.binDir), mode=0755) readme = self._generateReadme() put(StringIO(readme), 'README')
def branch(branch, location): if fails('/usr/bin/test -d {}/.bzr'.format(location)): run('/bin/mkdir -p {}'.format(os.path.dirname(location))) run('/usr/bin/bzr branch {} {}'.format(branch, location)) else: run('/usr/bin/bzr pull --verbose --overwrite -d {} {}'.format( location, branch), pty=False)
def branch(url, destination): if fails('/usr/bin/test -d {}/.git'.format(destination)): run('/usr/bin/git clone {} {}'.format(url, destination)) else: # FIXME: We currently don't check that this the correct branch # https://github.com/twisted-infra/braid/issues/5 with cd(destination): run('/usr/bin/git fetch origin') run('/usr/bin/git reset --hard origin')
def branch(branch, location): if fails('/usr/bin/test -d {}/.git'.format(location)): run('/usr/bin/git clone {} {}'.format(branch, location)) else: # FIXME: We currently don't check that this the correct branch # https://github.com/twisted-infra/braid/issues/5 with cd(location): run('/usr/bin/git fetch origin') run('/usr/bin/git reset --hard origin')
def install(): sudo('/bin/mkdir -p /opt') if fails('/usr/bin/id {}'.format('pypy')): sudo('/usr/sbin/useradd --home-dir {} --gid bin ' '-M --system --shell /bin/false ' 'pypy'.format(pypyDir)) else: sudo('/usr/sbin/usermod --home {} pypy'.format(pypyDir)) with cd('/opt'): for url in pypyURL, setuptoolsURL, pipURL: sudo('/usr/bin/wget -nc {}'.format(url)) sudo('/bin/tar xf {}'.format(path.basename(pypyURL))) for url in setuptoolsURL, pipURL: sudo('~pypy/bin/pypy {}'.format(path.basename(url))) sudo('~pypy/bin/pip install twisted pyopenssl')
def branch(url, destination, branch=None): """ Clone a git repo at `destination` from `url`. """ if fails('/usr/bin/test -d {}/.git'.format(destination)): run('/usr/bin/git clone {} {}'.format(url, destination)) else: # FIXME: We currently don't check that this the correct branch # https://github.com/twisted-infra/braid/issues/5 with cd(destination): run('/usr/bin/git fetch origin') if branch: reset_branch = 'origin/%s' % (branch, ) else: reset_branch = 'origin' run('/usr/bin/git reset --hard %s' % (reset_branch, ))
def branch(url, destination, branch=None): """ Clone a git repo at `destination` from `url`. """ if fails('/usr/bin/test -d {}/.git'.format(destination)): run('/usr/bin/git clone {} {}'.format(url, destination)) else: # FIXME: We currently don't check that this the correct branch # https://github.com/twisted-infra/braid/issues/5 with cd(destination): run('/usr/bin/git fetch origin') if branch: reset_branch = 'origin/%s' % (branch,) else: reset_branch = 'origin' run('/usr/bin/git reset --hard %s' % (reset_branch,))
def branch(branch, location): if fails('/usr/bin/test -d {}/.bzr'.format(location)): run('/bin/mkdir -p {}'.format(os.path.dirname(location))) run('/usr/bin/bzr branch {} {}'.format(branch, location)) else: run('/usr/bin/bzr pull --verbose --overwrite -d {} {}'.format(location, branch), pty=False)