|
|
|
@ -234,7 +234,7 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
# self.data
|
|
|
|
|
self.progName = { 'cl-client':0,
|
|
|
|
|
'cl-createhome':1,
|
|
|
|
|
'cl-sync':2
|
|
|
|
|
'cl-sync':2,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Cвязь длинных опций помощи и выводимых разделов помощи с опциями
|
|
|
|
@ -346,6 +346,11 @@ WHEN may be 'never', 'always', or 'auto'")
|
|
|
|
|
'helpChapter':_("Common options"),
|
|
|
|
|
'help':_("always join the user profiles and preferences")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(0,),
|
|
|
|
|
'longOption':"install",
|
|
|
|
|
'helpChapter':_("Common options"),
|
|
|
|
|
'help':_("Adds use of scripts this package for window manager")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(0,),
|
|
|
|
|
'longOption':"mount",
|
|
|
|
|
'helpChapter':_("Common options"),
|
|
|
|
@ -613,6 +618,18 @@ conjunction with the 'login' or 'logout'")
|
|
|
|
|
else:
|
|
|
|
|
return dirsFiles
|
|
|
|
|
|
|
|
|
|
def applyProfilesFromSystem(self):
|
|
|
|
|
"""Применяем профили для cистемы"""
|
|
|
|
|
# Cоздаем объект профиль
|
|
|
|
|
clProf = cl_profile.profile(self.clVars)
|
|
|
|
|
# Объединяем профили
|
|
|
|
|
dirsFiles = clProf.applyProfiles()
|
|
|
|
|
if clProf.getError():
|
|
|
|
|
self.printERROR(clProf.getError())
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
return dirsFiles
|
|
|
|
|
|
|
|
|
|
def getUserPassword(self, pwDialog=False):
|
|
|
|
|
"""Получить пароль у пользователя
|
|
|
|
|
|
|
|
|
@ -709,6 +726,34 @@ conjunction with the 'login' or 'logout'")
|
|
|
|
|
alwProfilePath.append(prPath)
|
|
|
|
|
return alwProfilePath
|
|
|
|
|
|
|
|
|
|
def setDaemonAutostart(self, daemon):
|
|
|
|
|
"""Прописывает демона в автозагрузку"""
|
|
|
|
|
execStr = "rc-update add %s default" %daemon
|
|
|
|
|
textLine = self.execProg(execStr)
|
|
|
|
|
if "added to runlevel" in textLine or\
|
|
|
|
|
"already installed in runlevel" in textLine:
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("ERROR") + ": " + execStr)
|
|
|
|
|
self.printERROR(_("Can not add at default runlevel"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def delDaemonAutostart(self, daemon):
|
|
|
|
|
"""Удаляет демона из автозагрузки"""
|
|
|
|
|
execStr = "rc-update del %s default" %daemon
|
|
|
|
|
textLine = self.execProg(execStr)
|
|
|
|
|
if "removed from the following runlevels" in textLine or\
|
|
|
|
|
"not found in any of the specified runlevels" in textLine:
|
|
|
|
|
return True
|
|
|
|
|
#Для openrc
|
|
|
|
|
elif "removed from runlevel" in textLine or\
|
|
|
|
|
"is not in the runlevel" in textLine:
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("ERROR") + ": " + execStr)
|
|
|
|
|
self.printERROR(_("Not deleted from default runlevel"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def createHome(self, userName, applyAlways=False, progress=False):
|
|
|
|
|
"""Создание пользовательской директории с настройками для kde4"""
|
|
|
|
|
# Имя пользователя
|
|
|
|
@ -912,10 +957,58 @@ conjunction with the 'login' or 'logout'")
|
|
|
|
|
return False
|
|
|
|
|
self.clVars.Delete("cl_remote_host","local")
|
|
|
|
|
self.clVars.Delete("cl_remote_pw","local")
|
|
|
|
|
self.execProg("calculate -P install/6intranet")
|
|
|
|
|
self.clVars.Set("cl_remote_host","",True)
|
|
|
|
|
self.clVars.Set("cl_remote_pw","",True)
|
|
|
|
|
# Наложим профили install/domain
|
|
|
|
|
# Новые пути к профилям
|
|
|
|
|
profPaths=['/usr/lib/calculate/calculate-client/profile/install/domain',
|
|
|
|
|
'/var/calculate/remote/client-profile/install/domain',
|
|
|
|
|
'/var/calculate/client-profile/install/domain']
|
|
|
|
|
# Изменяем переменную хранения профилей
|
|
|
|
|
self.clVars.Set("cl_profile_path",profPaths,True)
|
|
|
|
|
# Наложим профили
|
|
|
|
|
dirsAndFiles = self.applyProfilesFromSystem()
|
|
|
|
|
if not dirsAndFiles:
|
|
|
|
|
self.printERROR(_("Not apply 'install/domain' profiles"))
|
|
|
|
|
return False
|
|
|
|
|
if not self.delDaemonAutostart("client"):
|
|
|
|
|
return False
|
|
|
|
|
self.printOK(_("Computer removed from domain %s")%domain + " ...")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def getProfilePath(self, profPaths):
|
|
|
|
|
"""список накладываемых профилей"""
|
|
|
|
|
profpath = []
|
|
|
|
|
for profPath in profPaths:
|
|
|
|
|
if os.path.exists(profPath):
|
|
|
|
|
profpath.append(profPath)
|
|
|
|
|
return profpath
|
|
|
|
|
|
|
|
|
|
def applyProfilesClient(self, clVars=False, printSuccess=True):
|
|
|
|
|
"""Наложение профиля клиента"""
|
|
|
|
|
if not clVars:
|
|
|
|
|
#Создаем объект переменных
|
|
|
|
|
self.createClVars()
|
|
|
|
|
clVars = self.clVars
|
|
|
|
|
# Изменяем базовую директорию наложения профилей
|
|
|
|
|
clVars.Set("cl_root_path","/",True)
|
|
|
|
|
# Новые пути к профилям
|
|
|
|
|
profPaths=['/usr/lib/calculate/calculate-client/profile/install/client',
|
|
|
|
|
'/var/calculate/remote/client-profile/install/client',
|
|
|
|
|
'/var/calculate/client-profile/install/client']
|
|
|
|
|
# Изменяем переменную хранения профилей
|
|
|
|
|
clVars.Set("cl_profile_path",profPaths,True)
|
|
|
|
|
# Наложим профили
|
|
|
|
|
dirsAndFiles = self.applyProfilesFromSystem()
|
|
|
|
|
if not dirsAndFiles:
|
|
|
|
|
self.printERROR(_("Not apply 'install/client' profiles"))
|
|
|
|
|
return False
|
|
|
|
|
if printSuccess:
|
|
|
|
|
self.printOK(_("Added use of scripts this package for window \
|
|
|
|
|
manager") + " ...")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def addDomain(self, domainName):
|
|
|
|
|
"""Вводим в домен"""
|
|
|
|
|
# Проверяем на root
|
|
|
|
@ -1016,16 +1109,30 @@ conjunction with the 'login' or 'logout'")
|
|
|
|
|
self.printERROR("ld_services_dn or ld_unix_dn \
|
|
|
|
|
or ld_bind_dn or ld_bind_pw")
|
|
|
|
|
return False
|
|
|
|
|
execStr = "calculate --set-server_url=%s --set-ldap_base=%s \
|
|
|
|
|
--set-ldap_root=%s --set-ldap_bind=%s --set-ldap_bindpw=%s -P \
|
|
|
|
|
install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
|
|
|
|
|
self.execProg(execStr)
|
|
|
|
|
# Наложим профили install/client
|
|
|
|
|
if not self.applyProfilesClient(self.clVars, False):
|
|
|
|
|
return False
|
|
|
|
|
# Наложим профили install/domain
|
|
|
|
|
# Новые пути к профилям
|
|
|
|
|
profPaths=['/usr/lib/calculate/calculate-client/profile/install/domain',
|
|
|
|
|
'/var/calculate/remote/client-profile/install/domain',
|
|
|
|
|
'/var/calculate/client-profile/install/domain']
|
|
|
|
|
# Изменяем переменную хранения профилей
|
|
|
|
|
self.clVars.Set("cl_profile_path",profPaths,True)
|
|
|
|
|
# Наложим профили
|
|
|
|
|
dirsAndFiles = self.applyProfilesFromSystem()
|
|
|
|
|
if not dirsAndFiles:
|
|
|
|
|
self.printERROR(_("Not apply 'install/domain' profiles"))
|
|
|
|
|
return False
|
|
|
|
|
# Рестартуем dbus
|
|
|
|
|
if os.path.exists('/etc/init.d/dbus'):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/dbus restart", False, False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printWARNING(_("Error restarting /etc/init.d/dbus")+ " ...")
|
|
|
|
|
return False
|
|
|
|
|
if not self.setDaemonAutostart("client"):
|
|
|
|
|
return False
|
|
|
|
|
self.printOK(_("Computer added to domain %s")%domain + " ...")
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|