|
|
|
@ -377,9 +377,8 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
def isDomain(self):
|
|
|
|
|
"""Находится ли компьютер в домене"""
|
|
|
|
|
foundMountRemote = isMount("/var/calculate/remote")
|
|
|
|
|
foundMountHome = self.isMountDomainHome()
|
|
|
|
|
remoteHost = self.clVars.Get("cl_remote_host")
|
|
|
|
|
if remoteHost and foundMountRemote and foundMountHome:
|
|
|
|
|
if remoteHost and foundMountRemote:
|
|
|
|
|
return True
|
|
|
|
|
self.printERROR(_("The computer is not in domain"))
|
|
|
|
|
return False
|
|
|
|
@ -531,17 +530,6 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
%x.replace('"',"").replace("'",""),
|
|
|
|
|
skipPaths + deletePaths))
|
|
|
|
|
if sync == "login":
|
|
|
|
|
# исключаемые пути при синхронизации
|
|
|
|
|
# /.local/share/akonadi/db_data
|
|
|
|
|
# хранит базу acanadi
|
|
|
|
|
# /.mozilla/firefox/calculate.default/urlclassifier3.sqlite
|
|
|
|
|
# хранит БД для firefox
|
|
|
|
|
# /.local/share/mime/mime.cache
|
|
|
|
|
# отключение ошибочного кэширования изображений
|
|
|
|
|
# /.kde4/share/apps/nepomuk/repository/main/data
|
|
|
|
|
# база nepomuk
|
|
|
|
|
# /.VirtualBox
|
|
|
|
|
# содержит данные о виртуальных машинах
|
|
|
|
|
if os.path.exists(userHome) and\
|
|
|
|
|
os.path.exists(homeTemplate):
|
|
|
|
|
filterPath = " ".join(map(lambda x: '--filter="P /%s"'\
|
|
|
|
@ -841,6 +829,23 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
if not hostAuth or not domain:
|
|
|
|
|
self.printSUCCESS(_("To be used local profile"))
|
|
|
|
|
return True
|
|
|
|
|
try:
|
|
|
|
|
passwdUsers = map(lambda x: x[0],
|
|
|
|
|
map(lambda x: x.split(':'),
|
|
|
|
|
map(lambda x: x.strip(),
|
|
|
|
|
open("/etc/passwd").readlines())))
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(_("Can not open /etc/passwd"))
|
|
|
|
|
return False
|
|
|
|
|
if userName in passwdUsers:
|
|
|
|
|
try:
|
|
|
|
|
pwd.getpwnam(userName)
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(_("Can not found user %s")%userName)
|
|
|
|
|
self.umountUserRes()
|
|
|
|
|
return False
|
|
|
|
|
self.printWARNING(_("We use user information from /etc/passwd"))
|
|
|
|
|
return True
|
|
|
|
|
# Проверим что компьютер в домене и смонтирован [remote]
|
|
|
|
|
connectDomain = self.isDomain()
|
|
|
|
|
if not connectDomain:
|
|
|
|
@ -854,7 +859,7 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
gid = int(userLdapInfo['gid'])
|
|
|
|
|
homeDir = userLdapInfo['home']
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Can not found user %s in LDAP")%userName)
|
|
|
|
|
self.printERROR(_("Can not found user %s in LDAP") %userName)
|
|
|
|
|
self.umountUserRes()
|
|
|
|
|
return False
|
|
|
|
|
rootPath = self.clVars.Get('cl_root_path')
|
|
|
|
@ -1389,6 +1394,23 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
if not hostAuth or not domain:
|
|
|
|
|
self.printSUCCESS(_("To be used local profile"))
|
|
|
|
|
return True
|
|
|
|
|
try:
|
|
|
|
|
passwdUsers = map(lambda x: x[0],
|
|
|
|
|
map(lambda x: x.split(':'),
|
|
|
|
|
map(lambda x: x.strip(),
|
|
|
|
|
open("/etc/passwd").readlines())))
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(_("Can not open /etc/passwd"))
|
|
|
|
|
return False
|
|
|
|
|
if userName in passwdUsers:
|
|
|
|
|
try:
|
|
|
|
|
pwd.getpwnam(userName)
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(_("Can not found user %s")%userName)
|
|
|
|
|
self.umountUserRes()
|
|
|
|
|
return False
|
|
|
|
|
self.printWARNING(_("We use user information from /etc/passwd"))
|
|
|
|
|
return True
|
|
|
|
|
connectDomain = self.isDomain()
|
|
|
|
|
if not connectDomain:
|
|
|
|
|
# Отмонтируем пользовательские ресурсы в случае ошибки
|
|
|
|
@ -1545,7 +1567,7 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
break
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
def installClient(self):
|
|
|
|
|
def installProg(self):
|
|
|
|
|
"""Наложение шаблонов на систему при инсталяции"""
|
|
|
|
|
# Действие выход из домена
|
|
|
|
|
self.clVars.Set("cl_action", "install", True)
|
|
|
|
@ -1583,7 +1605,7 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
splLines = map(lambda x: x[0].strip(), splLines)
|
|
|
|
|
return splLines
|
|
|
|
|
|
|
|
|
|
def uninstallClient(self):
|
|
|
|
|
def uninstallProg(self):
|
|
|
|
|
"""Наложение шаблонов на систему при деинсталяции"""
|
|
|
|
|
# Проверяем на root
|
|
|
|
|
if not self.isRoot():
|
|
|
|
@ -1627,18 +1649,12 @@ class client(share, commandServer, encrypt):
|
|
|
|
|
if not self.isRoot():
|
|
|
|
|
return False
|
|
|
|
|
pathRemote = "/var/calculate/remote"
|
|
|
|
|
pathHome = "/home"
|
|
|
|
|
foundMountRemote = isMount(pathRemote)
|
|
|
|
|
foundMountHome = isMount(pathHome)
|
|
|
|
|
domain = self.clVars.Get("cl_remote_host")
|
|
|
|
|
if foundMountRemote:
|
|
|
|
|
textLineUmount = self.umountSleepPath(pathRemote)
|
|
|
|
|
if not textLineUmount:
|
|
|
|
|
return False
|
|
|
|
|
if foundMountHome:
|
|
|
|
|
textLineUmount = self.umountSleepPath(pathHome)
|
|
|
|
|
if not textLineUmount:
|
|
|
|
|
return False
|
|
|
|
|
if not domain:
|
|
|
|
|
self.printWARNING(_("The computer is not in domain"))
|
|
|
|
|
return True
|
|
|
|
@ -1768,7 +1784,6 @@ you need to remove it from the previous domain"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
foundMountRemote = isMount("/var/calculate/remote")
|
|
|
|
|
foundMountHome = self.isMountDomainHome()
|
|
|
|
|
if foundMountRemote:
|
|
|
|
|
self.printERROR(_("Samba resource [%s] is mount")%\
|
|
|
|
|
"remote" + " ...")
|
|
|
|
@ -1792,21 +1807,6 @@ you need to remove it from the previous domain"))
|
|
|
|
|
" ...")
|
|
|
|
|
self.clVars.Write("cl_remote_host", domain, True, "local")
|
|
|
|
|
self.clVars.Write("cl_remote_pw", userPwd, True, "local")
|
|
|
|
|
pathHome = "/var/calculate/client-home"
|
|
|
|
|
if foundMountHome:
|
|
|
|
|
self.printWARNING(str(pathHome)+ " " +_("is mount")+
|
|
|
|
|
" ...")
|
|
|
|
|
else:
|
|
|
|
|
if not os.path.exists(pathHome):
|
|
|
|
|
os.makedirs(pathHome)
|
|
|
|
|
mountStr = "mount -o bind %s /home" %pathHome
|
|
|
|
|
textLine = self.execProg(mountStr)
|
|
|
|
|
if not (textLine is None):
|
|
|
|
|
self.printERROR(_("Can not mount") + " " + str(pathHome) +\
|
|
|
|
|
" ...")
|
|
|
|
|
return False
|
|
|
|
|
self.printSUCCESS(_("Mount") + " " + str(pathHome) + " " +\
|
|
|
|
|
" ...")
|
|
|
|
|
servDn = self.getInfoService("ldap", "services_dn")
|
|
|
|
|
unixDn = self.getInfoService("unix", "dn")
|
|
|
|
|
bindDn = self.getInfoService("unix", "bind_dn")
|
|
|
|
@ -1891,12 +1891,8 @@ you need to remove it from the previous domain"))
|
|
|
|
|
self.clVars.Delete("os_remote_client")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def isMountDomainHome(self):
|
|
|
|
|
"""Примонтирована ли директория /home для ввода в домен"""
|
|
|
|
|
return isMount("/home") == "/var/calculate/client-home"
|
|
|
|
|
|
|
|
|
|
def mountRemote(self):
|
|
|
|
|
"""Монтирование remote и домашней директории если компьютер в домене
|
|
|
|
|
"""Монтирование remote если компьютер в домене
|
|
|
|
|
|
|
|
|
|
а так-же ввод в домен если найдено имя хоста и пароль для подключения
|
|
|
|
|
"""
|
|
|
|
@ -1906,29 +1902,22 @@ you need to remove it from the previous domain"))
|
|
|
|
|
domain = self.clVars.Get("cl_remote_host")
|
|
|
|
|
if domain:
|
|
|
|
|
foundMountRemote = isMount("/var/calculate/remote")
|
|
|
|
|
foundMountHome = self.isMountDomainHome()
|
|
|
|
|
else:
|
|
|
|
|
self.printWARNING(_("This computer is not in domain"))
|
|
|
|
|
# Если шаблоны не актуальны накладываем новую версию шаблонов
|
|
|
|
|
if not self.applyRelevanceTemplates():
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
pathHome = "/var/calculate/client-home"
|
|
|
|
|
if foundMountRemote:
|
|
|
|
|
self.printWARNING(_("Samba resource [%s] is mount")%"remote" + \
|
|
|
|
|
" ...")
|
|
|
|
|
if foundMountHome:
|
|
|
|
|
self.printWARNING(str(pathHome) + " " +_("is mount")+
|
|
|
|
|
" ...")
|
|
|
|
|
if foundMountHome and foundMountRemote:
|
|
|
|
|
" ...")
|
|
|
|
|
# Накладываем сетевые шаблоны
|
|
|
|
|
if domain:
|
|
|
|
|
self.clVars.flIniFile()
|
|
|
|
|
if not self.applyRelevanceTemplates(domain):
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
flagLocalTemplate = False
|
|
|
|
|
if not foundMountRemote:
|
|
|
|
|
else:
|
|
|
|
|
pathRemote = "/var/calculate/remote"
|
|
|
|
|
pwdRemote = self.clVars.Get("cl_remote_pw")
|
|
|
|
|
if not (domain and pwdRemote):
|
|
|
|
@ -1943,33 +1932,15 @@ you need to remove it from the previous domain"))
|
|
|
|
|
if not (textLine is None):
|
|
|
|
|
self.printWARNING(_("Can not mount Samba resource [%s]")%\
|
|
|
|
|
"remote" + " ...")
|
|
|
|
|
flagLocalTemplate = True
|
|
|
|
|
beforeRemoteAuth = self.clVars.Get('os_remote_auth')
|
|
|
|
|
# Если шаблоны не актуальны накладываем новую версию шаблонов
|
|
|
|
|
if not self.applyRelevanceTemplates():
|
|
|
|
|
return False
|
|
|
|
|
if foundMountHome:
|
|
|
|
|
umountStr = "umount /home"
|
|
|
|
|
textLine = self.execProg(umountStr)
|
|
|
|
|
if not (textLine is None):
|
|
|
|
|
self.printERROR(_("Can not unmount") + " /home")
|
|
|
|
|
return False
|
|
|
|
|
if beforeRemoteAuth != self.clVars.Get('os_remote_auth'):
|
|
|
|
|
self.restartDBus()
|
|
|
|
|
return True
|
|
|
|
|
self.printSUCCESS(_("Mount Samba resource [%s]") % "remote" +\
|
|
|
|
|
" ...")
|
|
|
|
|
if not foundMountHome and not flagLocalTemplate:
|
|
|
|
|
if not os.path.exists(pathHome):
|
|
|
|
|
os.makedirs(pathHome)
|
|
|
|
|
mountStr = "mount -o bind %s /home" %pathHome
|
|
|
|
|
textLine = self.execProg(mountStr)
|
|
|
|
|
if not (textLine is None):
|
|
|
|
|
self.printERROR(_("Can not mount") + " " + str(pathHome) +\
|
|
|
|
|
" ...")
|
|
|
|
|
return False
|
|
|
|
|
self.printSUCCESS(_("Mount") + " " + str(pathHome) + " " +\
|
|
|
|
|
" ...")
|
|
|
|
|
# Накладываем сетевые шаблоны
|
|
|
|
|
if domain:
|
|
|
|
|
self.clVars.flIniFile()
|
|
|
|
|