def install_lein(): with settings(warn_only=True): run("mkdir $HOME/bin") with cd("$HOME/bin"): run("wget %s -O lein" % LEIN_URL) util.chmod("$HOME/bin/lein", "+x")
def nopasswd_sudo(user, tmp_dir="/tmp"): tmp_file = tmp_dir + "/" + util.string_md5(user) sudo("echo '%s ALL=(ALL) NOPASSWD: ALL' > %s" % (user, tmp_file)) util.chmod(tmp_file, "440", use_sudo=True) util.mv(tmp_file, "/etc/sudoers.d/%s" % user + "_fabric", use_sudo=True)