def script(self): for ap in sys.path: if conda.installSubDir in ap: self.bauk( "Cannot compile ROOT because you have already inserted anaconda onto your python path. Please " "touch ~/.nokaveEnv, begin a new shell, and try again") #if not test: arch_url = li.fromKPMGrepo("root_" + self.options["Version"] + "_" + linuxVersion.lower() + ".tar.gz") noarch_url = li.fromKPMGrepo("root_" + self.options["Version"] + "_noarch.tar.gz", arch="noarch") if self.options["Strategy"] == "Default" or self.options["Strategy"] == "Copy": if arch_url: self.options["Strategy"] = "Copy" else: print "The version you have requested is not available precompiled for this OS, I will try to compile " \ "" \ "from source" self.options["Strategy"] = "Compile" if self.options["Strategy"] == "Copy": self.src_from = arch_url elif self.options["Strategy"] == "Compile" and noarch_url: self.src_from = noarch_url elif self.options["Strategy"] == "Compile": self.src_from = self.src_from + "root_" + self.options["Version"] + ".source.tar.gz" else: self.bauk( "Strategy can either be Default, Compile OR Copy only. Compile takes the source from the root " "website, Copy takes the precompiled version from our deployment area, default first tries the copy, " "then the compile") dest = "root.tar.gz" #copy to tmp for unpacking self.copy(self.src_from, dest) #untar, move to correct location and clean self.run("tar xvzf " + dest) os.system("mkdir -p " + os.sep.join(self.installDir.split(os.sep)[:-1])) os.system("mv root " + self.installDir) os.chdir(self.installDir) if self.options["Strategy"] == "Compile": self.compile() os.chdir(self.tmpdir) if self.options["UpdateSoftlink"]: linkat = self.topdir + os.sep + 'root' + os.sep + "pro" if os.path.exists(linkat): os.system("rm " + linkat) os.system("ln -s " + self.installDir + " " + linkat) os.chdir(self.tmpdir) for package in self.options["pip"]: self.run( "bash -c 'source " + self.toolbox.envscript() + "; source " + self.installDir + "/bin/thisroot.sh; " "pip install " + package + "'") return
def script(self): #don't include the .git directory if ".git" in self.installfrom(): raise NameError( "Sorry, I cannot be installed from a directory which includes '.git' in the name! Can you please " "download/copy to a different directory and try again") self.run( "rsync -rv --exclude=.git --exclude=.project --exclude=.pydevproject --exclude=.pyc " + self.installfrom( ) + "/ " + self.todir()) #self.run("mv ./"+self.installfrom().rstrip('/').split('/')[-1]+" "+self.installDir) f = open(self.installfrom() + os.sep + "scripts" + os.sep + "autoKaveEnv.sh") l = f.read() f.close() l = l.replace("%ENVSCRIPT%", self.envscript()) #overwrite if it exists if not os.access("/etc/profile.d", os.W_OK): self.bauk( "cannot write into /etc/profile.d, this means you are not running with root privilages. Run again as " "root, or turn off the explicit toolbox.doInstall in Configuration.py") f = open("/etc/profile.d/kave.sh", "w") f.write(l) f.close() #add to bash.bashrc for non-interactive&non-login shells l = "#!/bin/bash\n" if os.path.exists("/etc/bash.bashrc"): f = open("/etc/bash.bashrc") l = f.read() f.close() if "/etc/profile.d/kave.sh" not in l: f = open("/etc/bash.bashrc", "w") if not len(l.strip()): l = "#!/bin/bash" f.write(l) f.write(""" if [ -e /etc/profile.d/kave.sh ]; then source /etc/profile.d/kave.sh fi """) f.close() #set wallpaper on workstations if self.setwallpaper is True or (self.kind=='workstation' and self.setwallpaper in ['default','workstation']): if linuxVersion.lower().startswith("centos"): self.run('gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string ' +'--set /desktop/gnome/background/picture_filename '+self.todir()+'/figs/KAVE_wp'+str(self.wallpaperselect)+'.png') self.run('gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string ' +' --set /desktop/gnome/background/picture_options centered') return True