コード例 #1
0
def postInstallCmds():
  with _cd(conf['INSTALL_DIR']):
    if not _fe(conf['INSTALL_DIR']+conf['WORKER_DIR']+"/run_glass"):
      _w("svn checkout https://svn.physik.uzh.ch/repos/itp/glass ."+conf['WORKER_DIR'])
      _w("echo backend : Agg > matplotlibrc")
      _w("echo 'backend : Agg' > %(INSTALL_DIR)s%(WORKER_DIR)s/matplotlibrc" % conf)
    with _v('.'+conf['WORKER_DIR']):
      _s("make")
      _s("python setup.py build")
    with _cd('.'+conf['WORKER_DIR']):
      _s("chown -R %(SYS_USER)s:%(SYS_GROUP)s %(INSTALL_DIR)s" % conf)
      _s("chmod -R u+rwx %(INSTALL_DIR)s" % conf)
コード例 #2
0
def setup():
  file = _generateConfigFile()
  puts("--- nginx temp config file: ")
  print file.getvalue()
  
  _p(file, "/etc/nginx/sites-available/lmt.conf", use_sudo=True)  
  _s("ln -f -s /etc/nginx/sites-available/lmt.conf /etc/nginx/sites-enabled")
  _s("/etc/init.d/nginx reload") 
  


  # copy html files
  _s("cp -f -R %(REPRO_DIR)s/static_html %(INSTALL_DIR)s%(HTML_DIR)s" % conf)
  file = _generateHTMLSettings()
  _p(file, "%(INSTALL_DIR)s%(HTML_DIR)s/js/lmt.settings.js" % conf, use_sudo=True)  #local
  _s("chown -R %(SYS_USER)s:%(SYS_GROUP)s %(INSTALL_DIR)s/*" % conf)
  _s("chmod -R 774 %(INSTALL_DIR)s%(HTML_DIR)s/*" % conf)  

  # merge php
  with _cd("%(INSTALL_DIR)s%(HTML_DIR)s"%conf):
    _s("echo '<!DOCTYPE html>' > lmt.html")
    _s("echo '<html lang='en'>' >> lmt.html")
    _s("cat head.html >> lmt.html")
    _s("cat body.php >> lmt.html")
    _s("echo '</html>' >> lmt.html")
コード例 #3
0
def test():
  from fabric.contrib.files import exists as fe
  from fabric.contrib.files import cd

  from fabric.api import env as e
  from install.utils import _cd, _fe, _s
  
  conf = {}
  conf['INSTALL_DIR'] =  '/srv/lmt'
  conf['WORKER_DIR'] = '/worker'
  
  with _cd(conf['INSTALL_DIR']):
    print conf['INSTALL_DIR']
    print conf['WORKER_DIR']+"/run_glass"
    print _fe(conf['INSTALL_DIR']+conf['WORKER_DIR']+"/run_glass")