예제 #1
0
def main():

    GITHUB = "$HOME/github"
    SETUP_COMMON = GITHUB + "/setup/common"

    # Parsing arguments
    parser = argparse.ArgumentParser(description="")
    args = parser.parse_args()

    ####################################
    # User PATH checking for correctness
    ####################################
    result = cmdexec.runcmd_comment(
        "echo $PATH | grep "+GITHUB+"/bin",
        "Checking that github/bin is in the PATH")

    if result == "":
        print("-E- Add the following command to your .cshrc file:" +
              " setenv PATH \$HOME/github/bin:\$PATH")
    else:
        print("OK")

    ####################################
    # Python PATH checking for correctness
    ####################################
    result = cmdexec.runcmd_comment(
        "echo $PYTHONPATH | grep "+GITHUB+"/pylib",
        "Checking that github/pylib is in the PYTHONPATH")

    if result == "":
        print("-E- Add the following command to your .cshrc file:" +
              " setenv PYTHONPATH \$HOME/github/pylib")
    else:
        print("OK")

    ######################
    # Python version check
    ######################
    pyver = "P:python 3.2.2"
    result = cmdexec.runcmd_comment(
        "grep '" + pyver + "' $HOME/.itools",
        "Checking that correct Python version is used")

    if result != pyver:
        print("-E- Add the following command to your .itools file: " + pyver)
    else:
        print("OK")

    ##########################
    # Setup Nedit for the user
    ##########################
    fname = "nedit.rc"
    dirname = "$HOME/.nedit"
    cmdexec.confirm_run("mkdir -p %s; ln -f -s %s/%s %s" %
                        (dirname, SETUP_COMMON, fname, dirname),
                        "Setting up nedit.rc file")
예제 #2
0
def main():

    GITHUB = "$HOME/github"
    SETUP_COMMON = GITHUB + "/setup/common"
    SETUP_SERVER = GITHUB + "/setup/server"

    ###############################
    # Setup for the user/root shell
    ###############################
    cmd = "ln -f -s " + SETUP_SERVER + "/.cshrc $HOME;" +\
        "sudo /usr/sbin/usermod -s /bin/tcsh $USER"
    cmdexec.confirm_run(cmd, "Setting up user shell")

    cmd = "sudo ln -f -s " + SETUP_SERVER + "/.cshrc /root;" +\
        "sudo /usr/sbin/usermod -s /bin/tcsh root"
    cmdexec.confirm_run(cmd, "Setting up root shell")

    cmd = "sudo ln -f -s $HOME/github /root"
    cmdexec.confirm_run(cmd, "Setting up github repo link for root")

    ######################
    # Setup GIT
    ######################
    cmd = "ln -f -s " + SETUP_SERVER + "/.gitconfig $HOME"
    cmdexec.confirm_run(cmd, "Setting up GIT config")

    # Making git push working
    login = input("Enter your user login for github: ")
    passwd = input("Enter your user password for github: ")
    cmd = "echo machine github.com login %s password %s > $HOME/.netrc" %\
        (login, passwd)
    cmd += "; chmod og-rwx $HOME/.netrc"
    cmdexec.confirm_run(cmd, "Making git push working with Github")

    #############
    # Setup Nedit
    #############
    dirname = "$HOME/.nedit"
    cmd = "mkdir -p %s; ln -f -s %s/%s %s" %\
        (dirname, SETUP_COMMON, "nedit.rc", dirname)
    cmdexec.confirm_run(cmd, "Setting up user's nedit.rc")

    dirname = "/root/.nedit"
    cmd = "sudo mkdir -p %s; sudo ln -f -s %s/%s %s" %\
        (dirname, SETUP_COMMON, "nedit.rc", dirname)
    cmdexec.confirm_run(cmd, "Setting up root's nedit.rc")

    cmd = "sudo cp %s/nedit.bz2 /bin" % (SETUP_SERVER)
    cmd += "; sudo bunzip2 -f /bin/nedit.bz2"
    cmd += "; sudo chown root /bin/nedit"
    cmd += "; sudo chgrp root /bin/nedit"
    cmd += "; sudo chmod uog+rx-w /bin/nedit"
    cmdexec.confirm_run(cmd, "Extracting Nedit")

    ############
    # Setup Cron
    ############
    cmd = "crontab %s/%s" % (SETUP_SERVER, "crontasks")
    cmdexec.confirm_run(cmd, "Setting up Cron")