|
|
|
@ -28,7 +28,7 @@ import types
|
|
|
|
|
import getpass
|
|
|
|
|
import _cl_keys
|
|
|
|
|
|
|
|
|
|
Version = "calculate-client 0.0.6"
|
|
|
|
|
Version = "calculate-client 0.0.5"
|
|
|
|
|
|
|
|
|
|
tr = cl_base.lang()
|
|
|
|
|
tr.setLanguage(sys.modules[__name__])
|
|
|
|
@ -547,8 +547,8 @@ conjunction with the 'login' or 'logout'")
|
|
|
|
|
self.createClVars(self.clVars)
|
|
|
|
|
foundMountRemote =self.isMount("/var/calculate/remote" ,"cifs")
|
|
|
|
|
foundMountHome =self.isMount("/var/calculate/home" ,"none", False)
|
|
|
|
|
if not self.clVars.Get("cl_remote_host") and not foundMountRemote and\
|
|
|
|
|
not foundMountHome:
|
|
|
|
|
if not (self.clVars.Get("cl_remote_host") and foundMountRemote and\
|
|
|
|
|
foundMountHome):
|
|
|
|
|
self.printERROR("The computer is not in domain")
|
|
|
|
|
return False
|
|
|
|
|
return (foundMountRemote,foundMountHome)
|
|
|
|
@ -773,6 +773,8 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
|
|
|
|
|
pathRemote.append((os.path.join(homeDir,"Home"), "homes"))
|
|
|
|
|
# Удаленный ресурс share
|
|
|
|
|
pathRemote.append((os.path.join(homeDir,"Disks"), "share"))
|
|
|
|
|
self.moveHomeDir(homeDir)
|
|
|
|
|
# Синхронизируем настройки
|
|
|
|
|
if not self.syncUser(userName, homeDir, "logout"):
|
|
|
|
|
return False
|
|
|
|
|
flagError = False
|
|
|
|
@ -936,6 +938,54 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
|
|
|
|
|
self.printOK(_("Get a user profile in the domain") + " ...")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def copyFilesToMovie(self, userHome):
|
|
|
|
|
"""Переносим файлы пользователя в Home/Moved"""
|
|
|
|
|
# Находим директории и файлы в домащней директории
|
|
|
|
|
pathProg = os.getcwd()
|
|
|
|
|
os.chdir(userHome)
|
|
|
|
|
dirs = []
|
|
|
|
|
files = []
|
|
|
|
|
movedLink = os.path.join('Moved')
|
|
|
|
|
movedPath = os.path.join('Home',"Moved")
|
|
|
|
|
filesDir = filter(lambda x: not ('.' in x[0] or x in\
|
|
|
|
|
['Disks','Home','Moved'] or os.path.islink(x)), os.listdir('.'))
|
|
|
|
|
if not filesDir or not os.path.exists("Home"):
|
|
|
|
|
if os.path.islink(movedLink) and not os.path.exists(movedPath):
|
|
|
|
|
os.unlink(movedLink)
|
|
|
|
|
return True
|
|
|
|
|
if not os.path.exists(movedPath):
|
|
|
|
|
os.mkdir(movedPath)
|
|
|
|
|
directFile = os.path.join(movedPath,".directory")
|
|
|
|
|
if not os.path.exists(directFile):
|
|
|
|
|
txt = "[Desktop Entry]\nIcon=folder-development"
|
|
|
|
|
fd = os.open(directFile, os.O_CREAT)
|
|
|
|
|
os.close(fd)
|
|
|
|
|
FD = open (directFile, "r+")
|
|
|
|
|
FD.write(txt)
|
|
|
|
|
FD.close()
|
|
|
|
|
if not os.path.exists(movedLink):
|
|
|
|
|
os.symlink(movedPath, movedLink)
|
|
|
|
|
for fd in filesDir:
|
|
|
|
|
execStr = "cp -r '%s' '%s'" %(fd, movedPath)
|
|
|
|
|
textLine = self.execProg(execStr)
|
|
|
|
|
if not (textLine == None):
|
|
|
|
|
self.printERROR(_("Can not exec ") + " " + str(execStr) +\
|
|
|
|
|
" ...")
|
|
|
|
|
return False
|
|
|
|
|
execStr = "rm -rf '%s'" %fd
|
|
|
|
|
textLine = self.execProg(execStr)
|
|
|
|
|
if not (textLine == None):
|
|
|
|
|
self.printERROR(_("Can not exec ") + " " + str(execStr) +\
|
|
|
|
|
" ...")
|
|
|
|
|
return False
|
|
|
|
|
os.chdir(pathProg)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def moveHomeDir(self, userHome):
|
|
|
|
|
"""Переносим файлы пользователя в директорию Home/Moved если в домене"""
|
|
|
|
|
if self.isDomain():
|
|
|
|
|
return self.copyFilesToMovie(userHome)
|
|
|
|
|
|
|
|
|
|
def syncUser(self, userName, userHome, sync):
|
|
|
|
|
"""Синхронизация пользовательских настроек"""
|
|
|
|
|
home = os.path.split(userHome)[0]
|
|
|
|
|