[CalendarServer-changes] [10709] CalendarServer/trunk/contrib/migration/calendarpromotion.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 12 17:56:19 PST 2013
Revision: 10709
http://trac.calendarserver.org//changeset/10709
Author: sagen at apple.com
Date: 2013-02-12 17:56:19 -0800 (Tue, 12 Feb 2013)
Log Message:
-----------
Promotion extra now creates Data root and /var/run/caldavd directories
Modified Paths:
--------------
CalendarServer/trunk/contrib/migration/calendarpromotion.py
Modified: CalendarServer/trunk/contrib/migration/calendarpromotion.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarpromotion.py 2013-02-13 00:44:02 UTC (rev 10708)
+++ CalendarServer/trunk/contrib/migration/calendarpromotion.py 2013-02-13 01:56:19 UTC (rev 10709)
@@ -19,10 +19,12 @@
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,)
+DEST_DATA_DIR = "%s/Data" % (CALENDAR_SERVER_ROOT,)
CALDAVD_PLIST = "caldavd.plist"
USER_NAME = "calendar"
GROUP_NAME = "calendar"
LOG_DIR = "/var/log/caldavd"
+RUN_DIR = "/var/run/caldavd"
def updatePlist(plistData):
@@ -57,20 +59,27 @@
def main():
- try:
- # Create calendar ServerRoot
- os.mkdir(CALENDAR_SERVER_ROOT)
- except OSError:
- # Already exists
- pass
+ for dirName in (
+ CALENDAR_SERVER_ROOT,
+ DEST_CONFIG_DIR,
+ DEST_DATA_DIR,
+ LOG_DIR,
+ RUN_DIR
+ ):
+ try:
+ os.mkdir(dirName)
+ except OSError:
+ # Already exists
+ pass
- try:
- # Create calendar ConfigRoot
- os.mkdir(DEST_CONFIG_DIR)
- except OSError:
- # Already exists
- pass
+ try:
+ uid = getpwnam(USER_NAME).pw_uid
+ gid = getgrnam(GROUP_NAME).gr_gid
+ os.chown(dirName, uid, gid)
+ except Exception, e:
+ print "Unable to chown %s: %s" % (dirName, e)
+
plistPath = os.path.join(DEST_CONFIG_DIR, CALDAVD_PLIST)
if os.path.exists(plistPath):
@@ -87,20 +96,6 @@
srcPlistPath = os.path.join(SRC_CONFIG_DIR, CALDAVD_PLIST)
shutil.copy(srcPlistPath, DEST_CONFIG_DIR)
- # 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/20130212/93473cfd/attachment.html>
More information about the calendarserver-changes
mailing list