[CalendarServer-changes] [4237] CalendarServer/trunk/contrib/migration/59_calendarmigrator.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 12 14:23:45 PDT 2009


Revision: 4237
          http://trac.macosforge.org/projects/calendarserver/changeset/4237
Author:   sagen at apple.com
Date:     2009-05-12 14:23:44 -0700 (Tue, 12 May 2009)
Log Message:
-----------
During upgrade/migration, /Previous System does not have the /etc/ symlink to private/etc

Modified Paths:
--------------
    CalendarServer/trunk/contrib/migration/59_calendarmigrator.py

Modified: CalendarServer/trunk/contrib/migration/59_calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/59_calendarmigrator.py	2009-05-12 20:56:14 UTC (rev 4236)
+++ CalendarServer/trunk/contrib/migration/59_calendarmigrator.py	2009-05-12 21:23:44 UTC (rev 4237)
@@ -33,7 +33,7 @@
 SERVICE_NAME = "calendar"
 LAUNCHD_OVERRIDES = "var/db/launchd.db/com.apple.launchd/overrides.plist"
 LAUNCHD_PREFS_DIR = "System/Library/LaunchDaemons"
-CALDAVD_CONFIG_DIR = "etc/caldavd"
+CALDAVD_CONFIG_DIR = "private/etc/caldavd"
 SERVERADMIN = "/usr/sbin/serveradmin"
 
 def main():
@@ -125,6 +125,7 @@
 
     oldConfigDir = os.path.join(options.sourceRoot, CALDAVD_CONFIG_DIR)
     newConfigDir = os.path.join(options.targetRoot, CALDAVD_CONFIG_DIR)
+    log("Copying configuration files from %s to %s" % (oldConfigDir, newConfigDir))
 
     for name in os.listdir(oldConfigDir):
 
@@ -136,14 +137,17 @@
             if os.path.islink(oldPath) and not os.path.exists(newPath):
                 # Recreate the symlink if it won't overwrite an existing file
                 link = os.readlink(oldPath)
+                log("Symlinking %s to %s" % (newPath, link))
                 os.symlink(link, newPath)
 
             elif os.path.isfile(oldPath):
                 # Copy the file over, overwriting copy in newConfigDir
+                log("Copying file %s to %s" % (oldPath, newConfigDir))
                 shutil.copy2(oldPath, newConfigDir)
 
             elif os.path.isdir(oldPath) and not os.path.exists(newPath):
                 # Copy the dir over, but only if new one doesn't exist
+                log("Copying directory %s to %s" % (oldPath, newPath))
                 shutil.copytree(oldPath, newPath, symlinks=True)
 
 
@@ -185,7 +189,7 @@
 
 def log(msg):
     try:
-        with open(LOG, 'w') as output:
+        with open(LOG, 'a') as output:
             timestamp = datetime.datetime.now().strftime("%b %d %H:%M:%S")
             output.write("%s %s\n" % (timestamp, msg))
     except IOError:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090512/b2676b6c/attachment.html>


More information about the calendarserver-changes mailing list