[79443] trunk/base/src/registry2.0/portimage.tcl

jmr at macports.org jmr at macports.org
Mon Jun 13 07:33:27 PDT 2011


Revision: 79443
          http://trac.macports.org/changeset/79443
Author:   jmr at macports.org
Date:     2011-06-13 07:33:27 -0700 (Mon, 13 Jun 2011)
Log Message:
-----------
don't delete empty /Library/Launch{Agents,Daemons} when deactivating files in them (#27920)

Modified Paths:
--------------
    trunk/base/src/registry2.0/portimage.tcl

Modified: trunk/base/src/registry2.0/portimage.tcl
===================================================================
--- trunk/base/src/registry2.0/portimage.tcl	2011-06-13 13:55:44 UTC (rev 79442)
+++ trunk/base/src/registry2.0/portimage.tcl	2011-06-13 14:33:27 UTC (rev 79443)
@@ -558,6 +558,11 @@
     file delete -force $extracted_dir
 }
 
+# These directories should not be removed during deactivation even if they are empty.
+# TODO: look into what other dirs should go here
+variable precious_dirs
+array set precious_dirs { /Library/LaunchDaemons 1 /Library/LaunchAgents 1 }
+
 proc _deactivate_file {dstfile} {
     if { [file type $dstfile] == "link" } {
         ui_debug "deactivating link: $dstfile"
@@ -565,8 +570,13 @@
     } elseif { [file isdirectory $dstfile] } {
         # 0 item means empty.
         if { [llength [readdir $dstfile]] == 0 } {
-            ui_debug "deactivating directory: $dstfile"
-            file delete -- $dstfile
+            variable precious_dirs
+            if {![info exists precious_dirs($dstfile)]} {
+                ui_debug "deactivating directory: $dstfile"
+                file delete -- $dstfile
+            } else {
+                ui_debug "directory $dstfile does not belong to us"
+            }
         } else {
             ui_debug "$dstfile is not empty"
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110613/1969638a/attachment.html>


More information about the macports-changes mailing list