forked from calculate/calculate-overlay
parent
07ea6b9e35
commit
774bce133d
@ -0,0 +1,40 @@
|
|||||||
|
# Copyright 1999-2012 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Header: $
|
||||||
|
|
||||||
|
EAPI="3"
|
||||||
|
SUPPORT_PYTHON_ABIS="1"
|
||||||
|
PYTHON_DEPEND="2:2.7"
|
||||||
|
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
|
||||||
|
|
||||||
|
inherit distutils eutils
|
||||||
|
|
||||||
|
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||||
|
|
||||||
|
DESCRIPTION="The program of setting and storing the user account in the domain"
|
||||||
|
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="3"
|
||||||
|
KEYWORDS="amd64 x86"
|
||||||
|
|
||||||
|
DEPEND="~sys-apps/calculate-desktop-3.1.8
|
||||||
|
!<sys-apps/calculate-client-3.1.0
|
||||||
|
>=dev-python/python-ldap-2.0[ssl]
|
||||||
|
>=sys-auth/pam_ldap-180[ssl]
|
||||||
|
>=sys-auth/nss_ldap-239
|
||||||
|
>=sys-apps/keyexec-0.1.2
|
||||||
|
dev-qt/qtdbus
|
||||||
|
sys-apps/keyutils
|
||||||
|
sys-auth/pam_keystore
|
||||||
|
sys-auth/pam_client
|
||||||
|
dev-lang/swig"
|
||||||
|
|
||||||
|
RDEPEND="${DEPEND}"
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
unpack "${A}"
|
||||||
|
cd "${S}"
|
||||||
|
|
||||||
|
# apply revision changes
|
||||||
|
epatch "${FILESDIR}/calculate-client-3.1.8-r3.patch"
|
||||||
|
}
|
@ -0,0 +1,280 @@
|
|||||||
|
diff --git client/client.py client/client.py
|
||||||
|
index a7d6118..9f3f8dd 100644
|
||||||
|
--- client/client.py
|
||||||
|
+++ client/client.py
|
||||||
|
@@ -271,13 +271,13 @@ class Client(commandServer, encrypt, Desktop):
|
||||||
|
p = process(mountCmd,"-t","cifs","-o",
|
||||||
|
"cache=loose,user=%s,uid=%d,gid=%d,noperm"%(userName,uid,gid),
|
||||||
|
"//%s/%s"%(host,res),rpath,
|
||||||
|
- envdict={"PASSWD":userPwd})
|
||||||
|
+ envdict={"PASSWD":userPwd},stderr=STDOUT)
|
||||||
|
return p.success()
|
||||||
|
else:
|
||||||
|
p = process(mountCmd,"-t","cifs","-o",
|
||||||
|
"cache=loose,user=%s"%userName,
|
||||||
|
"//%s/%s"%(host,res),rpath,
|
||||||
|
- envdict={"PASSWD":userPwd})
|
||||||
|
+ envdict={"PASSWD":userPwd},stderr=STDOUT)
|
||||||
|
return p.success()
|
||||||
|
|
||||||
|
def mountSleepRes(self,host,userName,userPwd,res,rpath,uid=None,gid=None):
|
||||||
|
@@ -1059,7 +1059,7 @@ class Client(commandServer, encrypt, Desktop):
|
||||||
|
if remotePw:
|
||||||
|
self.printERROR(_("Wrong password"))
|
||||||
|
# не запрашвать пароль при загрузке системы
|
||||||
|
- if not path.exists('/prc/self/fd/0') or \
|
||||||
|
+ if not path.exists('/proc/self/fd/0') or \
|
||||||
|
os.readlink('/proc/self/fd/0') != '/dev/console':
|
||||||
|
yield self.askPassword(\
|
||||||
|
_("Domain password for the desktop"),False)
|
||||||
|
diff --git client/variables/action.py client/variables/action.py
|
||||||
|
index 30ca950..dd1b241 100644
|
||||||
|
--- client/variables/action.py
|
||||||
|
+++ client/variables/action.py
|
||||||
|
@@ -46,8 +46,9 @@ class VariableAcClientDomain(ActionVariable):
|
||||||
|
remoteAuth = self.Get("os_remote_auth")
|
||||||
|
if cl_action == "domain":
|
||||||
|
return "on"
|
||||||
|
- elif cl_action == "merge" and \
|
||||||
|
- remoteHost and remoteAuth:
|
||||||
|
+ elif ((cl_action in "merge" or
|
||||||
|
+ cl_action == 'sync' and self.Get('cl_merge_pkg'))
|
||||||
|
+ and remoteHost and remoteAuth):
|
||||||
|
return "on"
|
||||||
|
return "off"
|
||||||
|
|
||||||
|
diff --git data/cl-client-resume-remount data/cl-client-resume-remount
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..254e9a5
|
||||||
|
--- /dev/null
|
||||||
|
+++ data/cl-client-resume-remount
|
||||||
|
@@ -0,0 +1,141 @@
|
||||||
|
+#!/usr/bin/env python
|
||||||
|
+#-*- coding: utf-8 -*-
|
||||||
|
+
|
||||||
|
+# Copyright 2013 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
|
||||||
|
+import __future__
|
||||||
|
+
|
||||||
|
+import gobject
|
||||||
|
+
|
||||||
|
+import dbus
|
||||||
|
+import dbus.mainloop.glib
|
||||||
|
+from calculate.lib.datavars import DataVars, VariableError
|
||||||
|
+from calculate.lib.utils.files import isMount, getRunCommands
|
||||||
|
+from calculate.client.client import Client
|
||||||
|
+from argparse import ArgumentParser
|
||||||
|
+from time import sleep
|
||||||
|
+
|
||||||
|
+class ResourceRemounter:
|
||||||
|
+ """
|
||||||
|
+ Object contains one method for handle 'Resuming' dbus signal.
|
||||||
|
+
|
||||||
|
+ 'handle_resuming' method checks and remounts user remote resources.
|
||||||
|
+ Also the object refreshes NSS-cache.
|
||||||
|
+ """
|
||||||
|
+ def __init__(self,dv):
|
||||||
|
+ self.dv = dv
|
||||||
|
+ self.dv.defaultModule = 'client'
|
||||||
|
+ self.client = Client()
|
||||||
|
+ self.client.clVars = dv
|
||||||
|
+ self.check_server(True)
|
||||||
|
+
|
||||||
|
+ def check_server(self,refresh_nscd=False):
|
||||||
|
+ """
|
||||||
|
+ Check the available of domain server and refresh nscd cache
|
||||||
|
+ """
|
||||||
|
+ if self.client.checkDomainServer(
|
||||||
|
+ self.dv.Get('cl_remote_host'),
|
||||||
|
+ self.dv.Get('os_net_domain')):
|
||||||
|
+ try:
|
||||||
|
+ if refresh_nscd and path.exists(self.nscd_refresh):
|
||||||
|
+ os.system(self.nscd_refresh)
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
+ return True
|
||||||
|
+ return False
|
||||||
|
+
|
||||||
|
+ nscd_refresh = "/usr/sbin/nscd-refresh"
|
||||||
|
+
|
||||||
|
+ def remount_remote(self):
|
||||||
|
+ """
|
||||||
|
+ Remount remote resource of the domain
|
||||||
|
+ """
|
||||||
|
+ try:
|
||||||
|
+ self.client.mountRemoteRes(self.dv.Get('cl_remote_pw'),
|
||||||
|
+ self.dv.Get('cl_client_remote_path'),
|
||||||
|
+ self.dv.Get('cl_remote_host'))
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
+
|
||||||
|
+ def remount_user_resources(self):
|
||||||
|
+ """
|
||||||
|
+ Remount user resource of the domain
|
||||||
|
+ """
|
||||||
|
+ try:
|
||||||
|
+ self.client.mountUserDomainRes(self.dv.Get('ur_login'),
|
||||||
|
+ self.dv.Get('desktop.ur_password'),
|
||||||
|
+ int(self.dv.Get('ur_uid')),
|
||||||
|
+ int(self.dv.Get('ur_gid')),
|
||||||
|
+ "unix","share","homes","ftp")
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
+
|
||||||
|
+ def handle_resuming(self,statename):
|
||||||
|
+ print("Restoring remote mounts for user %s"%self.dv.Get('ur_login'))
|
||||||
|
+ # waiting for the domain
|
||||||
|
+ for wait in [1,2,5,10]:
|
||||||
|
+ if self.check_server(True):
|
||||||
|
+ break
|
||||||
|
+ sleep(wait)
|
||||||
|
+ # check and remount remote resources
|
||||||
|
+ self.remount_remote()
|
||||||
|
+ self.remount_user_resources()
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ def unlock_screensaver(status):
|
||||||
|
+ """
|
||||||
|
+ Handle screensaver unlock
|
||||||
|
+ """
|
||||||
|
+ if status == 0:
|
||||||
|
+ self.check_server(True)
|
||||||
|
+
|
||||||
|
+def main(argv):
|
||||||
|
+ # processing the user argument
|
||||||
|
+ argp = ArgumentParser(add_help=True)
|
||||||
|
+ argp.add_argument("user",help="tracked user",metavar="USER")
|
||||||
|
+ namespace = argp.parse_args(argv[1:])
|
||||||
|
+
|
||||||
|
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||||
|
+
|
||||||
|
+ bus = dbus.SystemBus()
|
||||||
|
+ sessionbus = dbus.SessionBus()
|
||||||
|
+ # initialization calculate datavars and quitting on an error
|
||||||
|
+ try:
|
||||||
|
+ dv = DataVars()
|
||||||
|
+ dv.importData()
|
||||||
|
+ dv.flIniFile()
|
||||||
|
+ dv.Set('ur_login',namespace.user)
|
||||||
|
+ if dv.Get('desktop.ur_domain_set') == 'off':
|
||||||
|
+ print("%s isn't a domain user"%namespace.user)
|
||||||
|
+ sys.exit(0)
|
||||||
|
+ except VariableError as e:
|
||||||
|
+ sys.stderr.write(str(e)+'\n')
|
||||||
|
+ sys.exit(1)
|
||||||
|
+
|
||||||
|
+ rm = ResourceRemounter(dv)
|
||||||
|
+ bus.add_signal_receiver(rm.handle_resuming,dbus_interface="org.freedesktop.UPower",
|
||||||
|
+ signal_name = "NotifyResume")
|
||||||
|
+ sessionbus.add_signal_receiver(rm.unlock_screensaver,dbus_interface="org.gnome.ScreenSaver",
|
||||||
|
+ signal_name = "ActiveChanged")
|
||||||
|
+ loop = gobject.MainLoop()
|
||||||
|
+ context = loop.get_context()
|
||||||
|
+ while True:
|
||||||
|
+ # need for dbus processing
|
||||||
|
+ context.iteration(1)
|
||||||
|
+ sleep(1)
|
||||||
|
+
|
||||||
|
+if __name__ == '__main__':
|
||||||
|
+ main(sys.argv)
|
||||||
|
diff --git data/login.d/15resume_remount data/login.d/15resume_remount
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..ff93653
|
||||||
|
--- /dev/null
|
||||||
|
+++ data/login.d/15resume_remount
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+#! /bin/sh
|
||||||
|
+# Copyright 2013 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.
|
||||||
|
+
|
||||||
|
+env-update
|
||||||
|
+source /etc/profile
|
||||||
|
+source /usr/share/calculate/xdm/functions
|
||||||
|
+
|
||||||
|
+if [[ "${DOMAIN_USER}" == "on" ]]
|
||||||
|
+then
|
||||||
|
+ /usr/sbin/cl-client-resume-remount ${USER} &
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+exit 0
|
||||||
|
diff --git data/logout.d/15resume_remount data/logout.d/15resume_remount
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..802a28b
|
||||||
|
--- /dev/null
|
||||||
|
+++ data/logout.d/15resume_remount
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+#! /bin/sh
|
||||||
|
+# Copyright 2013 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.
|
||||||
|
+
|
||||||
|
+env-update
|
||||||
|
+source /etc/profile
|
||||||
|
+source /usr/share/calculate/xdm/functions
|
||||||
|
+
|
||||||
|
+if [[ "${DOMAIN_USER}" == "on" ]]
|
||||||
|
+then
|
||||||
|
+ pkill -f "cl-client-resume-remount ${USER}"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+exit 0
|
||||||
|
diff --git setup.py setup.py
|
||||||
|
index 768905f..7a4b9e0 100755
|
||||||
|
--- setup.py
|
||||||
|
+++ setup.py
|
||||||
|
@@ -29,8 +29,13 @@ data_files = []
|
||||||
|
|
||||||
|
data_files += [('/etc/init.d', ['data/client'])]
|
||||||
|
data_files += [('/usr/sbin', ['data/logout'])]
|
||||||
|
+data_files += [('/usr/sbin', ['data/cl-client-resume-remount'])]
|
||||||
|
data_files += [('/usr/share/calculate/xdm/login.d',
|
||||||
|
['data/login.d/10client'])] +\
|
||||||
|
+ [('/usr/share/calculate/xdm/login.d',
|
||||||
|
+ ['data/login.d/15resume_remount'])] +\
|
||||||
|
+ [('/usr/share/calculate/xdm/logout.d',
|
||||||
|
+ ['data/logout.d/15resume_remount'])] +\
|
||||||
|
[('/usr/share/calculate/xdm/logout.d',
|
||||||
|
['data/logout.d/10client'])] +\
|
||||||
|
[('/usr/share/calculate/xdm/',['data/wait_domain'])]
|
||||||
|
@@ -73,6 +78,7 @@ class cl_install_data(install_data):
|
||||||
|
install_data.run(self)
|
||||||
|
data_file = [("/etc/init.d/client",0755),
|
||||||
|
("/usr/sbin/logout",0755),
|
||||||
|
+ ("/usr/sbin/cl-client-resume-remount",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("/")),
|
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 1999-2012 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Header: $
|
||||||
|
|
||||||
|
EAPI="3"
|
||||||
|
SUPPORT_PYTHON_ABIS="1"
|
||||||
|
PYTHON_DEPEND="2:2.7"
|
||||||
|
RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
|
||||||
|
|
||||||
|
inherit distutils eutils
|
||||||
|
|
||||||
|
SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
|
||||||
|
|
||||||
|
DESCRIPTION="The library for Calculate 3"
|
||||||
|
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="3"
|
||||||
|
KEYWORDS="amd64 x86"
|
||||||
|
IUSE="minimal"
|
||||||
|
DEPEND="!minimal? ( dev-python/py-smbpasswd )
|
||||||
|
>=dev-python/pyxml-0.8
|
||||||
|
sys-apps/iproute2
|
||||||
|
sys-apps/pciutils
|
||||||
|
sys-fs/lvm2
|
||||||
|
sys-fs/mdadm
|
||||||
|
dev-python/pyinotify
|
||||||
|
sys-apps/file[python]"
|
||||||
|
RDEPEND="${DEPEND}"
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
unpack "${A}"
|
||||||
|
cd "${S}"
|
||||||
|
|
||||||
|
# apply revision changes
|
||||||
|
epatch "${FILESDIR}/calculate-lib-3.1.8-r3.patch"
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright 1999-2011 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Header: $
|
||||||
|
|
||||||
|
EAPI=4
|
||||||
|
|
||||||
|
DESCRIPTION="Calculate Utilities meta package"
|
||||||
|
HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
|
||||||
|
SRC_URI=""
|
||||||
|
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="3"
|
||||||
|
KEYWORDS="amd64 x86"
|
||||||
|
IUSE="cl_consolegui cl_client cl_desktop cl_console"
|
||||||
|
|
||||||
|
RDEPEND="${RDEPEND}
|
||||||
|
=sys-apps/calculate-install-3.1.8-r9
|
||||||
|
=sys-apps/calculate-i18n-3.1.8
|
||||||
|
=sys-apps/calculate-lib-3.1.8-r3
|
||||||
|
=sys-apps/calculate-core-3.1.8-r2
|
||||||
|
=sys-apps/calculate-update-3.1.8
|
||||||
|
cl_client? ( =sys-apps/calculate-client-3.1.8-r3 )
|
||||||
|
cl_desktop? ( =sys-apps/calculate-desktop-3.1.8-r2 )
|
||||||
|
cl_consolegui? ( =sys-apps/calculate-console-gui-3.1.8 )
|
||||||
|
cl_console? ( =sys-apps/calculate-console-3.1.8 )
|
||||||
|
"
|
Loading…
Reference in new issue