Univention Bugzilla – Attachment 7197 Details for
Bug 39403
Update logon scripts listener module for newer MacOSX versions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for listener module
ucs-school-user-logonscript.py.patch (text/plain), 2.82 KB, created by
Sönke Schwardt-Krummrich
on 2015-10-01 22:25:49 CEST
(
hide
)
Description:
Patch for listener module
Filename:
MIME Type:
Creator:
Sönke Schwardt-Krummrich
Created:
2015-10-01 22:25:49 CEST
Size:
2.82 KB
patch
obsolete
>--- ucs-school-user-logonscript.py.orig 2015-02-13 15:50:31.849053603 +0100 >+++ ucs-school-user-logonscript.py 2015-02-17 14:36:33.465588908 +0100 >@@ -46,6 +46,7 @@ > > scriptpath = [] > desktopFolderName = "Eigene Shares" >+desktopFolderNameMac = listener.configRegistry.get('ucsschool/userlogon/mac/foldername', desktopFolderName) > globalLinks = {} > > strTeacher = listener.baseConfig.get('ucsschool/ldap/default/container/teachers', 'lehrer') >@@ -132,13 +133,11 @@ > > > def generateMacScript(uid, name, host): >- return '''#!/bin/sh # generated script for accessing a samba share >-/usr/bin/osascript <<EOF >+ return '''#!/usr/bin/osascript > tell application "Finder" > open location "smb://%s@%s/%s" > activate > end tell >-EOF > ''' % (uid, host, name) > > def writeMacLinkScripts(uid, homepath, links): >@@ -154,31 +153,37 @@ > except: > pass > >- if not os.path.exists(os.path.join(homepath, "Desktop", desktopFolderName)): >+ if not os.path.exists(os.path.join(homepath, "Desktop", desktopFolderNameMac)): > if not os.path.exists(homepath): > os.mkdir(homepath, 0700) > os.chown(homepath, uidnumber, gidnumber) > >- for path in [os.path.join(homepath, "Desktop"), os.path.join(homepath, "Desktop", desktopFolderName)]: >+ for path in [os.path.join(homepath, "Desktop"), os.path.join(homepath, "Desktop", desktopFolderNameMac)]: > if not os.path.exists(path): > os.mkdir(path) > os.chown(path, uidnumber, gidnumber) > > # remove old scripts >- for file in os.listdir(os.path.join(homepath, "Desktop", desktopFolderName)): >+ for file in os.listdir(os.path.join(homepath, "Desktop", desktopFolderNameMac)): > try: >- os.remove(os.path.join(homepath, "Desktop", desktopFolderName,file)) >+ if os.path.isdir(os.path.join(homepath, "Desktop", desktopFolderNameMac,file)): >+ shutil.rmtree(os.path.join(homepath, "Desktop", desktopFolderNameMac,file)) >+ else: >+ os.remove(os.path.join(homepath, "Desktop", desktopFolderNameMac,file)) > except: > univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, "ucsschool-user-logonscripts: failed to remove %s" % file) > raise > > for name in links: >- macscriptpath = os.path.join(homepath, "Desktop", desktopFolderName, "%s.app" % name) >- fp = open(macscriptpath ,'w') >- fp.write(generateMacScript(uid, name, links[name]).replace('\n','\r\n')) >- fp.close() >- os.chmod(macscriptpath, 0500) >+ macscriptpath = os.path.join(homepath, "Desktop", desktopFolderNameMac, "%s.app" % name) >+ os.mkdir(macscriptpath) > os.chown(macscriptpath, uidnumber, gidnumber) >+ macscriptfile = os.path.join(macscriptpath, name) >+ fp = open(macscriptfile ,'w') >+ fp.write(generateMacScript(uid, name, links[name])) >+ fp.close() >+ os.chmod(macscriptfile, 0700) >+ os.chown(macscriptfile, uidnumber, gidnumber) > finally: > listener.unsetuid() >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39403
: 7197