adding sudocheck to other functions

This commit is contained in:
staticsafe 2012-01-05 15:02:05 -05:00
parent 78e4291917
commit 02bba521c9
1 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
#Personal environment setup script #Personal environment setup script
#Dependencies - Supported distros, sudo #Dependencies - Supported distros, sudo, python2
import os import os
from subprocess import call from subprocess import call
@ -24,7 +24,7 @@ def sudocheck():
print 'Sudo check: PASSED!' print 'Sudo check: PASSED!'
def urldownload(confurl = ""): def urldownload(confurl = ""):
#Thanks PabloG from StackExchange for this little snippet - http://stackoverflow.com/a/22776 #Thanks PabloG from StackOverflow for this little snippet - http://stackoverflow.com/a/22776
url = confurl url = confurl
file_name = url.split('/')[-1] file_name = url.split('/')[-1]
@ -53,29 +53,39 @@ def confdownload():
urldownload(confurl = zshrcurl) urldownload(confurl = zshrcurl)
urldownload(confurl = tmuxurl) urldownload(confurl = tmuxurl)
urldownload(confurl = vimdirurl) urldownload(confurl = vimdirurl)
untar = call("tar xvf vimdir.tar.bz2", shell = True) untar = call("tar xvf vimdir.tar.bz2", shell = True)
def defaultshell():
print "Setting default shell for this user to zsh! Log out and log back in to see changes."
setzsh = call("chsh -s $(which zsh)", shell = True)
def envArch(): def envArch():
sudocheck()
#Install relevant packagtes #Install relevant packagtes
installpackages = call("sudo pacman --noconfirm -S vim zsh tmux git subversion", shell=True) installpackages = call("sudo pacman --noconfirm -S vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles #Get relevant dotfiles
confdownload() confdownload()
defaultshell()
def envFedora(): def envFedora():
sudocheck()
#Install relevant packages #Install relevant packages
installpackages = call ("sudo yum install -y vim zsh tmux git subversion", shell=True) installpackages = call ("sudo yum install -y vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles #Get relevant dotfiles
confdownload() confdownload()
defaultshell()
def envDebian(): def envDebian():
sudocheck()
#Install relevant packages #Install relevant packages
installpackages = call ("sudo apt-get install --assume-yes vim zsh tmux git subversion", shell=True) installpackages = call ("sudo apt-get install --assume-yes vim zsh tmux git subversion", shell=True)
#Get relevant dotfiles #Get relevant dotfiles
confdownload() confdownload()
defaultshell()
def main(): def main():
#homedircheck #homedircheck
@ -83,6 +93,7 @@ def main():
currentdir = os.getcwd() currentdir = os.getcwd()
if currentdir != homedir: if currentdir != homedir:
print "Changing cwd to homedir!"
os.chdir(homedir) os.chdir(homedir)
else: else:
print "Home directory check : PASSED!" print "Home directory check : PASSED!"