[29445] trunk/base/src/package1.0/portpkg.tcl

source_changes at macosforge.org source_changes at macosforge.org
Sun Sep 23 13:58:40 PDT 2007


Revision: 29445
          http://trac.macosforge.org/projects/macports/changeset/29445
Author:   afb at macports.org
Date:     2007-09-23 13:58:39 -0700 (Sun, 23 Sep 2007)

Log Message:
-----------
* If you created a PKG package from a destroot containing /etc,
  it would render your system unbootable. (Installer.app feature)
  Of course that's outside of the mtree, but might as well try to
  make pax happy and move it to /private/etc. Or just use RPM. :)

Modified Paths:
--------------
    trunk/base/src/package1.0/portpkg.tcl

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2007-09-23 20:21:39 UTC (rev 29444)
+++ trunk/base/src/package1.0/portpkg.tcl	2007-09-23 20:58:39 UTC (rev 29445)
@@ -84,8 +84,20 @@
     }
     write_welcome_html ${pkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
     file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
+    foreach dir {etc var tmp} {
+	if ([file exists "${destpath}/$dir"]) {
+	    # certain toplevel directories really are symlinks. leaving them as directories make pax lose the symlinks. that's bad.
+	    system "mkdir -p ${destpath}/private/$dir; mv ${destpath}/$dir/* ${destpath}/private/$dir; rm -r \"${destpath}/$dir\""
+	}
+    }
     system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
     system "cd ${destpath} && pax -x cpio -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
+    foreach dir {etc var tmp} {
+	if ([file exists "${destpath}/private/$dir"]) {
+	    # restore any directories that were moved, to avoid confusing the rest of the ports system.
+	    system "mv ${destpath}/private/$dir ${destpath}/$dir; rmdir ${destpath}/private 2>/dev/null"
+	}
+    }
 
     write_sizes_file ${pkgpath}/Contents/Resources/Archive.sizes ${portname} ${portversion} ${pkgpath} ${destpath}
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070923/d0a20d05/attachment.html


More information about the macports-changes mailing list