Fix for 3.1

master3.3
Хирецкий Михаил 12 years ago committed by root
parent 4b8dce78c5
commit 095e8f908c

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
#-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -15,12 +15,12 @@
# limitations under the License.
import os, sys, time
from cl_utils import getModeFile
from cl_print import color_print
from cl_ldap import ldapUser
from calculate.lib.utils.files import getModeFile
from calculate.lib.cl_print import color_print
from calculate.lib.cl_ldap import ldapUser
from cl_lang import lang
lang().setLanguage(sys.modules[__name__])
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])
class _shareData(color_print):
"""Share class"""
@ -36,13 +36,13 @@ class _shareData(color_print):
if os.access(self.fileName, os.R_OK):
return True
else:
self.printERROR(_("Can not read to file")+": "+self.fileName)
self.printERROR(_("Failed to read the file")+": "+self.fileName)
return False
elif perm == "WRITE":
if os.access(self.fileName, os.W_OK):
return True
else:
self.printERROR(_("Can not write to file")+": "+self.fileName)
self.printERROR(_("Failed to write to file")+": "+self.fileName)
return False
def getData(self):
@ -258,13 +258,13 @@ class _shareCache():
try:
os.makedirs(path)
except:
self.printERROR(_("Can not create directory %s")%path)
self.printERROR(_("Failed to create directory %s")%path)
return False
if not os.path.exists(self.fileName):
try:
open(self.fileName, "w")
except:
self.printERROR(_("Can not create file %s")%self.fileName)
self.printERROR(_("Failed to create file %s")%self.fileName)
return False
if self.getFileAccess(perm="WRITE"):
modeFile = 0600
@ -320,7 +320,7 @@ class userCache(color_print):
'''Add LDAP user to cache'''
ldapData = self.ldapObj.getUserLdapInfo(userName, shadowAttr=True)
if not ldapData:
self.printERROR(_("Can not found user %s in LDAP")%userName)
self.printERROR(_("Failed to found user %s in LDAP")%userName)
return False
groupName = ldapData['group']
# Add user
@ -637,7 +637,7 @@ class userCache(color_print):
Deleting a user from the cache when the differences'''
if not self.isConnectToLdap():
self.printERROR(_("Can not conected to LDAP server"))
self.printERROR(_("Failed to connect to the LDAP server"))
return False
cachePasswdObj = cachePasswd()
cacheListPasswdData = cachePasswdObj.getData()

@ -26,25 +26,25 @@ lang().setLanguage(sys.modules[__name__])
USAGE = _("%prog [options] domain")
# Коментарии к использованию программы
COMMENT_EXAMPLES = _("Adds settings for connecting to domain "
"server.calculate.ru")
COMMENT_EXAMPLES = _("Add settings for connecting to "
"domain server.calculate.ru")
# Пример использования программы
EXAMPLES = _("%prog server.calculate.ru")
# Описание программы (что делает программа)
DESCRIPTION = _("Changes settings for connecting to domain")
DESCRIPTION = _("Changes settings for connecting to the domain")
# Опции командной строки
CMD_OPTIONS = [{'shortOption':"r",
'help':_("remove the settings for connecting to a domain")},
'help':_("remove the settings for connecting to the domain")},
{'longOption':"mount",
'help':_("mount [remote] resource for domain")},
'help':_("mount the [remote] domain resource")},
{'longOption':"set"},
{'longOption':"install",
'help':_("install package")},
'help':_("install the package")},
{'longOption':"uninstall",
'help':_("uninstall package")}]
'help':_("uninstall the package")}]
class client_cmd(share_cmd):
def __init__(self):
@ -117,12 +117,12 @@ class client_cmd(share_cmd):
if not optObj.v:
if optObj.filter:
errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
if optObj.xml:
errMsg = _("incorrect option") + ":" + " %s" %"--xml" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
return optObj, args
@ -132,7 +132,7 @@ class client_cmd(share_cmd):
if domainName:
return self.logicObj.addDomain(domainName)
else:
self.printERROR(_('Not found argument domain name'))
self.printERROR(_("No domain name found as argument"))
return False
def delDomain(self):

@ -28,10 +28,10 @@ lang().setLanguage(sys.modules[__name__])
USAGE = _("%prog [options]")
# Описание программы (что делает программа)
DESCRIPTION = _("Change user password")
DESCRIPTION = _("Change the user password")
# Коментарии к использованию программы
COMMENT_EXAMPLES = _("change password of user for Samba and Unix services")
COMMENT_EXAMPLES = _("change the user password for Samba and Unix services")
# Пример использования программы
EXAMPLES = _("%prog")
@ -62,12 +62,12 @@ class passwd_cmd(share_cmd):
if not optObj.v:
if optObj.filter:
errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
if optObj.xml:
errMsg = _("incorrect option") + ":" + " %s" %"--xml" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
return optObj, args
@ -78,10 +78,10 @@ class passwd_cmd(share_cmd):
res = self.logicObj.setUserPasswordToServer()
except KeyboardInterrupt:
sys.stdout.write("\b\b\n")
color_print().printERROR(_("Manually interrupt"))
color_print().printERROR(_("Manually interrupted"))
return False
except EOFError:
sys.stdout.write("\n")
color_print().printERROR(_("Manually interrupt"))
color_print().printERROR(_("Manually interrupted"))
return False
return res

@ -26,27 +26,27 @@ lang().setLanguage(sys.modules[__name__])
USAGE = _("%prog [options] user")
# Коментарии к использованию программы
COMMENT_EXAMPLES = _("Mount resources and synchronize user profile")
COMMENT_EXAMPLES = _("Mount resources and synchronize the user profile")
# Пример использования программы
EXAMPLES = _("%prog user_name")
# Описание программы (что делает программа)
DESCRIPTION = _("Mounting resources and synchronize the user profile")
DESCRIPTION = _("Mounts resources and synchronizes the user profile")
# Опции командной строки
CMD_OPTIONS = [{'longOption':"login",
'help':_("mount user resource and synchronize the user "
"profile")},
'help':_("mount user resources and synchronize the "
"user profile")},
{'longOption':"logout",
'help':_("synchronize the user profile and umount user "
"resource")},
'help':_("synchronize the user profile and unmount "
"the user resource")},
{'longOption':"nosync",
'help':_("not synchronize the user preferences, is used "
"in conjunction with the 'login' or 'logout'")},
'help':_("do not synchronize user preferences, used "
"in conjunction with 'login' or 'logout'")},
{'longOption':"set"},
{'longOption':"progress",
'help':_("show progress bar for xdm startup")}]
'help':_("show the progress bar at xdm startup")}]
class sync_cmd(share_cmd):
def __init__(self):
@ -121,12 +121,12 @@ class sync_cmd(share_cmd):
if not optObj.v:
if optObj.filter:
errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
if optObj.xml:
errMsg = _("incorrect option") + ":" + " %s" %"--xml" +\
": " + _("use with option '-v'")
": " + _("used with option '-v'")
self.optobj.error(errMsg)
return False
return optObj, args

@ -0,0 +1,209 @@
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import soaplib, sys, time, os
import threading
from soaplib.serializers.primitive import String, Integer, Any, Boolean
from soaplib.serializers.clazz import Array, ClassSerializer
from soaplib.service import rpc, DefinitionBase
from calculate.core.server.api_types import ReturnedMessage
from calculate.core.server.api_types import ChoiceValue, Table, Option, Field, \
GroupField, ViewInfo, ViewParams
from calculate.lib.datavars import VariableError,DataVarsError
from calculate.client.cl_client import ClientError
from cl_client import Client,DataVarsClient
import cl_client
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
from calculate.core.server.decorators import Dec
from calculate.core.server.func import catchExcept
core_method = Dec.core_method
setLocalTranslate('cl_client3',sys.modules[__name__])
import traceback
from functools import wraps,WRAPPER_ASSIGNMENTS
__ = getLazyLocalTranslate(_)
class ClientInfo(ClassSerializer):
"""Parameters for method install"""
cl_localhost_set = Boolean
cl_remote_host_new = String
cl_remote_pw = String
cl_client_mount_set = Boolean
Default = Array(String)
CheckOnly = Boolean
CheckAll = Boolean
class SyncInfo(ClassSerializer):
"""Parameters for method install"""
ur_login = String
cl_client_sync = Boolean
Default = Array(String)
CheckOnly = Boolean
CheckAll = Boolean
clientCatchExcept = catchExcept(VariableError,DataVarsError,
ClientError)
class Wsdl:
"""
cl-client
"""
@rpc(Integer, ClientInfo, _returns = Array(ReturnedMessage))
@core_method(category=__('Client'),title=__('Domain'),
image='applications-other',
gui=True,command='cl-client',
rights=['domain'])
def client(self, sid, info):
return self.callMethod(sid,info,method_name="client",
logicClass=Client,
method="domain")
def client_vars(self,dv=None):
if not dv:
dv = DataVarsClient()
dv.importClient()
dv.flIniFile()
dv.Set('cl_action','domain',True)
dv.addGroup(None,
normal=('cl_localhost_set','cl_remote_host_new',
'cl_remote_pw'),
expert=('cl_client_mount_set',),
next_label=_("Configure"))
return dv
@rpc(Integer, ViewParams,_returns = ViewInfo)
def client_view (self, sid, params):
dv = self.get_cache(sid,"client","vars")
if not dv:
dv = self.client_vars()
#if hasattr(params,"clienttype") and params.clienttype == "gui":
# if dv.Get('cl_remote_host') == '':
# dv.Set('cl_localhost_set',"on")
# else:
# dv.Set('cl_localhost_set',"off")
else:
dv.processRefresh()
view = ViewInfo(dv,viewparams=params)
self.set_cache(sid, 'client', "vars",dv,smart=False)
return view
"""
cl-client-sync-login
"""
@rpc(Integer, ClientInfo, _returns = Array(ReturnedMessage))
@core_method(category=__('Client'),title=__('Domain user login'),
image='applications-other',
gui=True,command='cl-client-sync-login',
rights=['domainuser'])
def client_sync_login(self, sid, info):
return self.callMethod(sid,info,method_name="client_sync_login",
logicClass=Client,
method="mountUserResAndSync")
def client_sync_login_vars(self,dv=None):
if not dv:
dv = DataVarsClient()
dv.importClient()
dv.flIniFile()
dv.Set('cl_action','login',True)
dv.addGroup(None,
normal=('ur_login','cl_client_sync'),
next_label=_("Configure"))
return dv
@rpc(Integer, ViewParams,_returns = ViewInfo)
def client_sync_login_view (self, sid, params):
dv = self.get_cache(sid,"client_sync_login","vars")
if not dv:
dv = self.client_sync_login_vars()
else:
dv.processRefresh()
view = ViewInfo(dv,viewparams=params)
self.set_cache(sid, 'client_sync_login', "vars",dv,smart=False)
return view
"""
cl-client-sync-logout
"""
@rpc(Integer, ClientInfo, _returns = Array(ReturnedMessage))
@core_method(category=__('Client'),title=__('Domain user logout'),
image='applications-other',
gui=True,command='cl-client-sync-logout',
rights=['domainuser'])
def client_sync_logout(self, sid, info):
return self.callMethod(sid,info,method_name="client_sync_logout",
logicClass=Client,
method="umountUserResAndSync")
def client_sync_logout_vars(self,dv=None):
if not dv:
dv = DataVarsClient()
dv.importClient()
dv.flIniFile()
dv.Set('cl_action','logout',True)
dv.addGroup(None,
normal=('ur_login','cl_client_sync'),
next_label=_("Configure"))
return dv
@rpc(Integer, ViewParams,_returns = ViewInfo)
def client_sync_logout_view (self, sid, params):
dv = self.get_cache(sid,"client_sync_logout","vars")
if not dv:
dv = self.client_sync_logout_vars()
else:
dv.processRefresh()
view = ViewInfo(dv,viewparams=params)
self.set_cache(sid, 'client_sync_logout', "vars",dv,smart=False)
return view
"""
cl-client-sync-test
"""
@rpc(Integer, ClientInfo, _returns = Array(ReturnedMessage))
@core_method(category=__('Client'),title=__('Test'),
image='applications-other',
gui=True,command='cl-client-sync-test',
rights=['domainuser'])
def clienttest(self, sid, info):
return self.callMethod(sid,info,method_name="clienttest",
logicClass=Client,
method="clienttest")
def clienttest_vars(self,dv=None):
if not dv:
dv = DataVarsClient()
dv.importClient()
dv.flIniFile()
dv.Set('cl_action','logout',True)
dv.addGroup(None,
normal=('ur_login','cl_client_sync'),
next_label=_("Configure"))
return dv
@rpc(Integer, ViewParams,_returns = ViewInfo)
def clienttest_view (self, sid, params):
dv = self.get_cache(sid,"clienttest","vars")
if not dv:
dv = self.clienttest_vars()
else:
dv.processRefresh()
view = ViewInfo(dv,viewparams=params)
self.set_cache(sid, 'clienttest', "vars",dv,smart=False)
return view

@ -0,0 +1,34 @@
#-*- coding: utf-8 -*-
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__app__ = 'calculate-client'
__version__ = '3.1.0'
import os
import sys
from calculate.lib.datavars import DataVars
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])
class DataVarsClient(DataVars):
"""Variable class for client package"""
def importClient(self, **args):
"""Import client variables"""
self.importData()
self.importData('calculate.client.variables')
self.defaultModule = "client"

@ -0,0 +1,20 @@
#-*- coding: utf-8 -*-
# Copyright 2008-2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import action
import client
section = "client"

@ -1,6 +1,6 @@
#-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2008-2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -14,12 +14,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
class fillVars():
"""Методы определения значений переменных шаблона"""
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])
def get_ac_client_domain(self):
"""переключатель для шаблонов входа и выхода из домена"""
class VariableAcClientMerge(ReadonlyVariable):
"""
Action variable which has value "up" for package install and
install this package
"""
def get(self):
ret = ""
action = self.Get("cl_action")
remoteHost = self.Get("cl_remote_host")
remoteAuth = self.Get("os_remote_auth")
if action in ("merge","install","domain","undomain"):
ret = "up"
return ret
class VariableAcClientDomain(ReadonlyVariable):
"""
Action variable which has value "up" for domain action
and "down" for undomain action
"""
def get(self):
ret = ""
action = self.Get("cl_action")
remoteHost = self.Get("cl_remote_host")
@ -34,13 +56,3 @@ class fillVars():
else:
ret = "down"
return ret
def get_ac_client_merge(self):
"""переключатель для шаблонов merge"""
ret = ""
action = self.Get("cl_action")
remoteHost = self.Get("cl_remote_host")
remoteAuth = self.Get("os_remote_auth")
if action in ("merge","install","domain","undomain"):
ret = "up"
return ret

@ -0,0 +1,165 @@
import os
import sys
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.utils.files import readLinesFile
from calculate.lib.utils.common import getValueFromCmdLine
from calculate.lib.utils.ip import isOpenPort
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])
class VariableClRemoteHost(Variable):
"""
IP or domain name of CDS
"""
value = ""
class VariableClRemoteHostNew(Variable):
"""
IP or domain name of CDS
"""
opt = ["cl_remote_host_new"]
metavalue = "DOMAIN"
type = "choiceedit"
value = ""
untrusted = True
def init(self):
self.label = _("Domain IP")
self.help = _("domain")
def check(self,value):
if self.Get('cl_client_mount_set') == 'off':
if self.Get('cl_localhost_set') == 'off':
if self.Get('cl_remote_host') == '':
if not value:
raise VariableError(_("Need to specify domain"))
elif not isOpenPort(value,445):
raise VariableError(
_("Specified address is not available"))
class VariableClRemoteHostLive(ReadonlyVariable):
"""
Remote host from /proc/cmdline param domain
"""
def get(self):
return getValueFromCmdLine("calculate","domain") or ""
class VariableOsRemoteAuth(Variable):
"""
Client work mode (local or hostname)
"""
class VariableOsRemoteClient(Variable):
"""
Version which apply templates
"""
pass
class VariableClRemotePw(Variable):
"""
Client password
"""
type = "password"
opt = ["--domain-password"]
def init(self):
self.label = _("Domain password")
self.help = _("specify domain password")
def get(self):
return getValueFromCmdLine("calculate","domain_pw") or ""
class VariableClMovedSkipPath(Variable):
"""
Skip "Moved" path
"""
type = "list"
value = ['Disks','Home','Moved','FTP','Desktop', 'Share']
class VariableClSyncSkipPath(Variable):
"""
Skip sync path
"""
type = "list"
value = [".googleearth", "Home", "Disks", "FTP",
'Share', ".local/share/akonadi/db_data", ".VirtualBox",
".mozilla/firefox/calculate.default/urlclassifier3.sqlite",
".local/share/mime/mime.cache", ".gvfs",
".kde4/share/apps/nepomuk/repository/main/data", ".logout",
".Xauthority", ".thumbnails", ".mozilla/firefox/*/Cache",
".kde4/socket-*", ".cache/", ".local/share/Trash"]
class VariableClSyncDelPath(Variable):
"""
Removed path on sync
"""
type = "list"
value = [".kde4/share/config/phonondevicesrc",
".kde4/cache-*", ".kde4/tmp-*"]
class VariableClProfileAllSet(Variable):
type = "bool"
value = "off"
class VariableClClientSync(Variable):
type = "bool"
value = "on"
metavalue = "ON/OFF"
opt = ["--sync"]
def init(self):
self.label = _("Synchronize user profile")
self.help = _("synchronize user preferences, used in "
"conjunction with 'login' or 'logout'")
class VariableClLocalhostSet(Variable):
"""
Using autopartition
"""
type = "bool"
element = "radio"
value = "off"
opt = ["-r"]
metavalue = "ON/OFF"
def init(self):
self.label = _("Computer role")
self.help = _("remove the settings for connecting to the domain")
def choice(self):
return [("off",_("Domain workstation")),
("on",_("Local workstation"))]
def check(self,value):
if self.Get('cl_remote_host') == '' and value == "on":
raise VariableError(_("The computer is not in the domain already"))
if self.Get('cl_remote_host') != '' and value == "off":
raise VariableError(_("The computer is already in the domain %s")
%self.Get('cl_remote_host') + "\n" +
_("Before joining the domain, "
"you need to remove it from the previous domain"))
#def get(self):
# if self.Get('cl_remote_host') == '':
# return "on"
# else:
# return "off"
class VariableClClientMountSet(Variable):
"""
Mount remote by configured domain information
"""
type = "bool"
value = "off"
metavalue = "ON/OFF"
opt = ["--mount"]
def init(self):
self.label = _("Only mount the domain resource")
self.help = _("only mount the [remote] domain resource")

@ -22,21 +22,40 @@ depend() {
after acpid consolekit hald xfs
}
variable_value()
{
local varname=$1
cl-client -vv --filter $varname |
sed -rn "s/^$varname\s+\[[rw]\]\s+(.*)$/\1/p"
}
start() {
# Mount remote Samba filesystems.
ebegin "Mounting domain resources"
# Identifing domain server by env file
local env_file=/var/calculate/calculate2.env
if [[ -f $env_file ]]
# Identifing domain server by cl-client variables
local SERVER=`variable_value cl_remote_host`
local SERVERLIVE=`variable_value cl_remote_host_live`
local SERVERPW=`variable_value cl_remote_pw`
[[ -z $SERVERLIVE ]] && SERVERLIVE=$SERVER
if [[ -n $SERVERLIVE ]]
then
local SERVER=$( sed -rn 's/^cl_remote_host\s*=\s*(\S+)\s*$/\1/p' $env_file )
for COUNT in $( seq 0 20 )
ebegin "Mounting domain resources"
for COUNT in $( seq 0 24 )
do
ping -w4 -i0.5 -c3 $SERVER &>/dev/null && break || sleep 0.5
ping -w4 -i0.5 -c3 $SERVERLIVE &>/dev/null && break || sleep 0.5
done
if [[ -z $SERVER ]]
then
cl-client $SERVERLIVE && cl-setup-system -l remote &>/dev/null
else
cl-client --mount
fi
res=$?
eend $res "Some samba remote resources to mount"
else
true
fi
cl-client --mount
eend $? "Some samba remote resources to mount"
}
stop(){

@ -17,16 +17,15 @@ env-update
source /etc/profile
source /usr/share/calculate/xdm/functions
if [ -e '/usr/bin/cl-sync' ];
if [ -e '/usr/sbin/cl-client-sync-login' ];
then
if [[ "${DOMAIN_USER}" == "on" ]]
then
ERRORLOG=`/usr/bin/cl-sync --progress --color=never --login $USER 2>&1`
# при неудачном выполнении, сгенерируем ошибку
ERRORLOG=`/usr/sbin/cl-client-sync-login --gui-progress --gui-warning $USER 2>&1`
# log error
if [ "$?" -gt "0" ];
then
echo "$ERRORLOG" >> $FILE_LOG
xmes cl-sync "$ERRORLOG"
exit 1
fi
fi

@ -17,16 +17,15 @@ env-update
source /etc/profile
source /usr/share/calculate/xdm/functions
if [ -e '/usr/bin/cl-sync' ];
if [ -e '/usr/sbin/cl-client-sync-logout' ];
then
if [[ "${DOMAIN_USER}" == "on" ]]
then
ERRORLOG=`/usr/bin/cl-sync --color=never --logout $USER 2>&1`
# при неудачном выполнении, сгенерируем ошибку
ERRORLOG=`/usr/sbin/cl-client-sync-logout $USER 2>&1`
# log errors
if [ "$?" -gt "0" ];
then
echo "$ERRORLOG" >> $FILE_LOG
xmes cl-sync "$ERRORLOG"
exit 1
fi
fi

File diff suppressed because it is too large Load Diff

@ -1,80 +0,0 @@
#-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from cl_print import color_print
from cl_utils import _error
# Перевод сообщений для программы
from cl_lang import lang
lang().setLanguage(sys.modules[__name__])
class share_cmd(color_print, _error):
"""Класс общих методов обработки опций командной строки"""
def printVars(self, optObj):
"""Печать переменных"""
if optObj.v:
varsFilter = None
varsNames = []
format = "default"
# Фильтрование переменных
if optObj.filter:
optCmd = optObj.filter
if ',' in optCmd:
varsNames = optCmd.split(",")
else:
varsFilter = optCmd
if optObj.xml:
format = "xml"
try:
v = int(optObj.v)
except:
v = 1
self.logicObj.printVars(varsFilter, varsNames, outFormat=format,
verbose=v)
def setVars(self, optObj):
"""Установка переменных"""
if optObj.set:
for val in optObj.set:
k,o,v = val.partition('=')
if self.logicObj.clVars.exists(k):
if self.logicObj.clVars.SetWriteVar(k,v) == False:
return False
else:
self.printERROR(_('variable %s not found')%k)
return False
return True
def writeVars(self, optObj):
"""Запись переменных"""
if optObj.set:
if not self.logicObj.clVars.WriteVars():
errMsg = self.getError()
if errMsg:
self.printERROR(errMsg.strip())
self.printERROR(_('Can not write template variables'))
return False
return True
def setPrintNoColor(self, optObj):
"""Установка печати сообщений без цвета"""
if optObj.color and optObj.color=="never":
color_print.colorPrint = lambda *arg : sys.stdout.write(arg[-1]) or\
sys.stdout.flush()

@ -1,101 +0,0 @@
#-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#Допустимые ключи
# mode - режим переменной r-не переназначается из командной строки,
# w-переназначается из командной строки
# type - тип переменной состоит из двух элементов(что это и для чего
# это)
# value - значение переменной по умолчанию
# hide - флаг того, что данная переменная служебная и не отображается
# при печати списка значений переменных
from cl_client import __version__
from cl_client import __app__
class Data:
# имя программы
cl_name = {'value':__app__}
# версия программы
cl_ver = {'value':__version__}
# variable for calculate-client and calculate-desktop packages
# ip or domain name of CDS
cl_remote_host = {'mode':'r'}
#Логин пользователя
ur_login = {'mode':"r"}
#Название группы пользователя
ur_group = {'mode':"r"}
#Полное имя пользователя
ur_fullname = {'mode':"r"}
# Jabber ID пользователя
ur_jid = {'mode':"r"}
# Почтовый адрес пользователя
ur_mail = {'mode':"r"}
# Домашняя директория пользователя
ur_home_path = {'mode':"r"}
# Режим работы клиента
# (local или имя хоста клиента)
os_remote_auth = {'mode':'w'}
# Версия программы которой были наложены шаблоны
os_remote_client = {'mode':'w'}
#Пароль пользователя client
cl_remote_pw = {'mode':'w'}
# Директории которые не переносятся в ~/Moved
cl_moved_skip_path = {'value':['Disks','Home','Moved','FTP','Desktop',
'Share']}
# Директории или файлы которые не переносятся
# при синхронизации профиля пользователя
cl_sync_skip_path = {'value':[".googleearth", "Home", "Disks", "FTP",
'Share', ".local/share/akonadi/db_data", ".VirtualBox",
".mozilla/firefox/calculate.default/urlclassifier3.sqlite",
".local/share/mime/mime.cache", ".gvfs",
".kde4/share/apps/nepomuk/repository/main/data", ".logout",
".Xauthority", ".thumbnails", ".mozilla/firefox/*/Cache",
".kde4/socket-*", ".cache/", ".local/share/Trash"]}
# Директории или файлы которые удаляются
# при синхронизации профиля пользователя
cl_sync_del_path = {'value':[".kde4/share/config/phonondevicesrc",
".kde4/cache-*", ".kde4/tmp-*"]}
# переключатель для шаблонов merge
ac_client_merge = {}
# переключатель для шаблонов входа и выхода из домена
ac_client_domain = {}
# One profile for all OS
cl_profile_all_set = {'mode':'w', 'value':'off'}
# lib vars
cl_env_path = {}
cl_env_server_path = {}
os_linux_shortname = {}
os_net_domain = {'mode':"w"}

@ -1,5 +0,0 @@
[install]
install-scripts=/usr/bin
install-purelib=/usr/lib/calculate-2.2
install-platlib=/usr/lib/calculate-2.2
#install-data=/usr/share/calculate/templates

@ -1,9 +1,9 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# setup.py --- Setup script for calculate-client
# setup.py --- Setup script for calculate-desktop
#Copyright 2010 Calculate Pack, http://www.calculate-linux.org
# Copyright 2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,20 +17,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__app__ = "calculate-client"
__version__ = "3.1.0"
import os
import stat
from distutils.core import setup, Extension
from distutils.command.install_data import install_data
__version__ = "2.2.24"
__app__ = "calculate-client"
import distutils.command.build
import distutils.command.install
from os import system,path
import glob
import sys
data_files = []
var_data_files = []
#data_dirs_template = ['templates']
data_files += [('/etc/init.d', ['data/client'])]
data_files += [('/usr/share/calculate/xdm/login.d',
['data/login.d/10client'])] +\
[('/usr/share/calculate/xdm/logout.d',
['data/logout.d/10client'])] +\
[('/usr/share/calculate/xdm/',['data/wait_domain'])]
def __scanDir(scanDir, prefix, replace_dirname, dirData, flagDir=False):
"""Scan directory"""
@ -52,7 +59,7 @@ def __scanDir(scanDir, prefix, replace_dirname, dirData, flagDir=False):
scanDir = os.path.join(prefix,scanDir)
dirData.append((scanDir, files))
for sDir in dirs:
__scanDir(sDir, prefix, replace_dirname, dirData, True)
__scanDir(sDir, prefix, replace_dirname,dirData, True)
return dirData
def create_data_files(data_dirs, prefix="", replace_dirname=""):
@ -63,24 +70,14 @@ def create_data_files(data_dirs, prefix="", replace_dirname=""):
data_files += __scanDir(data_dir, prefix, replace_dirname, data)
return data_files
#data_files += create_data_files (data_dirs_template, template_calculate_dir,
# template_replace_dirname)
data_files += [('/etc/init.d', ['data/client'])]
data_files += [('/usr/share/calculate/xdm/login.d',
['data/login.d/10client'])] +\
[('/usr/share/calculate/xdm/logout.d',
['data/logout.d/10client'])] +\
[('/usr/share/calculate/xdm/',['data/wait_domain'])]
# [('/var/calculate/templates', [])]
class cl_install_data(install_data):
def run (self):
install_data.run(self)
data_file = [("/etc/init.d/client",0755),
("/usr/share/calculate/xdm/wait_domain",0755)]
fileNames = map(lambda x: os.path.split(x[0])[1], data_file)
listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),data_file)
listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),
data_file)
data_find = {}
for i in range(len(fileNames)):
listNames[i].reverse()
@ -110,15 +107,11 @@ setup(
author_email = "support@calculate.ru",
url = "http://calculate-linux.org",
license = "http://www.apache.org/licenses/LICENSE-2.0",
package_dir = {'calculate-client': "."},
packages = ['calculate-client.pym'],
package_dir = {'calculate.client': "client"},
packages = ['calculate.client','calculate.client.variables'],
data_files = data_files,
scripts=["./scripts/cl-sync",
"./scripts/cl-client",
"./scripts/cl-passwd"],
ext_modules = [Extension('calculate-client.pym._cl_keys',
ext_modules = [Extension('calculate.client._cl_keys',
library_dirs = ['/usr/lib'],
libraries = ['keyutils'],
sources = ['./lib/cl_keys.i', './lib/cl_keys.c'])],
cmdclass={'install_data': cl_install_data},
)
cmdclass={'install_data': cl_install_data})

Loading…
Cancel
Save