Skip to content

Commit

Permalink
Fix sudo for travis
Browse files Browse the repository at this point in the history
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
  • Loading branch information
gsemet committed Apr 2, 2015
1 parent 892773c commit 68d24e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ install:
- "pip install virtualenv"

script:
- "install/install.py"
- "sudo install/install.py"
7 changes: 5 additions & 2 deletions install/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ def run(cmd, cwd=None, shell=False):


def runAsRoot(cmd, cwd=None, shell=False):
cmd = ['sudo'] + cmd
printRootCmd("{0}".format(" ".join(cmd)))
if os.geteuid() != 0:
cmd = ['sudo'] + cmd
printRootCmd("{0}".format(" ".join(cmd)))
else:
printCmd("(already root) {0}".format(" ".join(cmd)))
subprocess.check_call(cmd, shell=shell, cwd=cwd)


Expand Down

0 comments on commit 68d24e2

Please sign in to comment.