[CalendarServer-changes] [8499] CalendarServer/trunk/contrib/migration/calendarpromotion.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jan 10 09:53:38 PST 2012
Revision: 8499
http://trac.macosforge.org/projects/calendarserver/changeset/8499
Author: sagen at apple.com
Date: 2012-01-10 09:53:38 -0800 (Tue, 10 Jan 2012)
Log Message:
-----------
Create /var/log/caldavd at promotion time.
Modified Paths:
--------------
CalendarServer/trunk/contrib/migration/calendarpromotion.py
Modified: CalendarServer/trunk/contrib/migration/calendarpromotion.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarpromotion.py 2012-01-09 22:51:27 UTC (rev 8498)
+++ CalendarServer/trunk/contrib/migration/calendarpromotion.py 2012-01-10 17:53:38 UTC (rev 8499)
@@ -12,17 +12,42 @@
import os
import shutil
+from pwd import getpwnam
+from grp import getgrnam
SRC_CONFIG_DIR = "/Applications/Server.app/Contents/ServerRoot/private/etc/caldavd"
CALENDAR_SERVER_ROOT = "/Library/Server/Calendar and Contacts"
DEST_CONFIG_DIR = "%s/Config" % (CALENDAR_SERVER_ROOT,)
+USER_NAME = "calendar"
+GROUP_NAME = "calendar"
+LOG_DIR = "/var/log/caldavd"
def main():
- # Create calendar ServerRoot
- os.mkdir(CALENDAR_SERVER_ROOT)
- # Copy configuration
- shutil.copytree(SRC_CONFIG_DIR, DEST_CONFIG_DIR)
+ try:
+ # Create calendar ServerRoot
+ os.mkdir(CALENDAR_SERVER_ROOT)
+ # Copy configuration
+ shutil.copytree(SRC_CONFIG_DIR, DEST_CONFIG_DIR)
+ except OSError:
+ # Already exists
+ pass
+
+ # Create log directory
+ try:
+ os.mkdir(LOG_DIR, 0755)
+ except OSError:
+ # Already exists
+ pass
+
+ # Set ownership on log directory
+ try:
+ uid = getpwnam(USER_NAME).pw_uid
+ gid = getgrnam(GROUP_NAME).gr_gid
+ os.chown(LOG_DIR, uid, gid)
+ except Exception, e:
+ print "Unable to chown %s: %s" % (LOG_DIR, e)
+
if __name__ == '__main__':
main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120110/549cada0/attachment.html>
More information about the calendarserver-changes
mailing list