On Fri, May 27, 2011 at 11:10:14AM +0200, Santiago Vila wrote:
> El 27/05/11 10:59, Roger Leigh escribió:
> >On Fri, May 27, 2011 at 10:49:52AM +0200, Santiago Vila wrote:
> >>(In particular, I'm thinking about creating /var/run and /var/lock
> >>symlinks even if they are provided as directories inside the .deb.
> >>As far as they are never dropped, I think that would be cleaner than
> >>letting dpkg remove them and restoring afterwards).
> >
> >I was thinking about this while waking up this morning.  I've attached
> >a patch to do this.
> >We retain /var/run and /var/lock as directories.  This means all
> >upgrades will be reliable--there's no gap where they might not
> >exist.  In the initial install we convert them to symlinks in
> >the postinst.  I've created a shell function to do this, which
> >also takes care to move the contents (if any).  At this point it's
> >extremely unlikely anything will be present (there isn't testing
> >with debootstrap), but it doesn't hurt.
> 
> No "moving things", please. You told me this was for bootstrapping
> only, so I'll skip that part.
> 
> If base-files is going to be officially in charge of creating those
> symlinks in the initial install, I hope that nobody else is fiddling
> with them (in the initial install).

Patch attached with the moving removed.  Tested with debootstrap.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
diff -urN base-files-6.3.original/debian/changelog base-files-6.4/debian/changelog
--- base-files-6.3.original/debian/changelog	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.4/debian/changelog	2011-05-27 10:29:51.094294861 +0100
@@ -1,3 +1,23 @@
+base-files (6.4) unstable; urgency=low
+
+  * Provide /run directory.  Closes: #620157.
+  * For new installations:
+    - /run/lock is created if not present (note that debian-installer
+      will remove it after installation is complete so that it does not
+      leave mess in /run; it will persist in chroot environments).
+      This ensures that the /var/lock symlink will always be valid.
+    - /var/run is symlinked to /run.
+    - /var/lock is symlinked to /run/lock.
+  * For upgrades, initscripts will handle the /var/run and /var/lock
+    migration to /run.
+  * Break initscripts << 2.88dsf-13.3 to ensure that once we provide
+    /run, it is guaranteed to be present and functional.  This is to
+    prevent udev breakage by preventing base-files from being
+    upgraded prior to initscripts on upgrade from squeeze.  This
+    ensures that initscripts must be upgraded first.
+
+ -- Roger Leigh <rle...@debian.org>  Fri, 27 May 2011 09:45:39 +0100
+
 base-files (6.3) unstable; urgency=low
 
   * Dropped /run until everything else is ready for it. In particular,
diff -urN base-files-6.3.original/debian/control base-files-6.4/debian/control
--- base-files-6.3.original/debian/control	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.4/debian/control	2011-05-26 15:16:37.342127868 +0100
@@ -11,6 +11,7 @@
 Essential: yes
 Priority: required
 Replaces: base, miscutils, dpkg (<= 1.15.0)
+Breaks: initscripts (<< 2.88dsf-13.3)
 Description: Debian base system miscellaneous files
  This package contains the basic filesystem hierarchy of a Debian system, and
  several important miscellaneous files, such as /etc/debian_version,
diff -urN base-files-6.3.original/debian/directory-list base-files-6.4/debian/directory-list
--- base-files-6.3.original/debian/directory-list	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.4/debian/directory-list	2011-05-27 08:49:16.486529468 +0100
@@ -10,6 +10,7 @@
 mnt
 proc
 root
+run
 sbin
 tmp
 usr
diff -urN base-files-6.3.original/debian/postinst.in base-files-6.4/debian/postinst.in
--- base-files-6.3.original/debian/postinst.in	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.4/debian/postinst.in	2011-05-27 10:30:18.894631742 +0100
@@ -23,6 +23,13 @@
   fi
 }
 
+migrate_directory() {
+  if [ ! -L $1 ]; then
+    rmdir $1
+    ln -s $2 $1
+  fi
+}
+
 if [ ! -e /etc/dpkg/origins/default ]; then
   if [ -e /etc/dpkg/origins/#VENDORFILE# ]; then
     ln -sf #VENDORFILE# /etc/dpkg/origins/default
@@ -41,10 +48,17 @@
   install_directory var/opt   755 root
   install_directory media     755 root
   install_directory var/mail 2775 mail
+  # Note that /run/lock will be later removed by debian-installer on
+  # completion of the install (a tmpfs will be mounted on /run at
+  # reboot).  It will persist in debootstrapped chroots.
+  install_directory run/lock 1777 root
   if [ ! -L /var/spool/mail ]; then
     ln -s ../mail /var/spool/mail
   fi
 
+  migrate_directory /var/run /run
+  migrate_directory /var/lock /run/lock
+
   install_local_dir /usr/local
   install_local_dir /usr/local/share
   install_local_dir /usr/local/share/man

Attachment: signature.asc
Description: Digital signature

Reply via email to