On Thu, May 26, 2011 at 08:16:20PM +0100, Roger Leigh wrote:
> On Thu, May 26, 2011 at 08:04:50PM +0200, Santiago Vila wrote:
> > [ Note: Thanks a lot for the patch and sorry for not answering before ].
> > 
> > El 26/05/11 16:37, Roger Leigh escribió:
> > >@@ -32,8 +33,6 @@
> > >  var/lib/dpkg
> > >  var/lib/misc
> > >  var/local
> > > -var/lock
> > >  var/log
> > > -var/run
> > >  var/spool
> > >  var/tmp
> > 
> > So, you propose that base-files des not contain var/lock or var/run anymore.
> > 
> > I think that will not work: If we make var/run and var/lock to be
> > symlinks, and then we upgrade base-files to a version which does not
> > contain var/lock and var/run anymore, the symlinks will disappear,
> > as dpkg will remove them.
> 
> To work around that, we can move the symlink creation out of the part
> of the postinst with the version check to do it unconditionally, so
> if the directories do not exist (for any reason--either initial
> bootstrap or loss on upgrade) we will create a symlink.

Patch attached to do this (create symlinks if missing).

Note that on new installs, the symlinks will always be created.
This scenario only exists on upgrade, and due to the Breaks on
initscripts this implies that on upgrade it will also always be
a symlink as well.  If it does get removed, it will be
recreated in the postinst.


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/1777-dirs base-files-6.3/debian/1777-dirs
--- base-files-6.3.original/debian/1777-dirs	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.3/debian/1777-dirs	2011-05-25 19:37:07.471912770 +0100
@@ -1,3 +1,2 @@
 tmp
-var/lock
 var/tmp
diff -urN base-files-6.3.original/debian/changelog base-files-6.3/debian/changelog
--- base-files-6.3.original/debian/changelog	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.3/debian/changelog	2011-05-26 15:25:05.676769129 +0100
@@ -1,3 +1,24 @@
+base-files (6.4) unstable; urgency=low
+
+  * Provide /run directory.  Closes: #620157.
+  * Do not provide /var/run or /var/lock directories.
+  * 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>  Thu, 26 May 2011 15:16:46 +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.3/debian/control
--- base-files-6.3.original/debian/control	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.3/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.3/debian/directory-list
--- base-files-6.3.original/debian/directory-list	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.3/debian/directory-list	2011-05-25 18:47:49.797635835 +0100
@@ -10,6 +10,7 @@
 mnt
 proc
 root
+run
 sbin
 tmp
 usr
@@ -32,8 +33,6 @@
 var/lib/dpkg
 var/lib/misc
 var/local
-var/lock
 var/log
-var/run
 var/spool
 var/tmp
diff -urN base-files-6.3.original/debian/postinst.in base-files-6.3/debian/postinst.in
--- base-files-6.3.original/debian/postinst.in	2011-05-25 18:46:08.276544484 +0100
+++ base-files-6.3/debian/postinst.in	2011-05-26 20:45:30.520624985 +0100
@@ -41,9 +41,19 @@
   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
+  if [ ! -e /var/run ]; then
+    ln -s /run /var/run
+  fi
+  if [ ! -e /var/lock ]; then
+    ln -s /run/lock /var/lock
+  fi
 
   install_local_dir /usr/local
   install_local_dir /usr/local/share
@@ -105,4 +115,13 @@
       fi
     fi
   fi
+
+  # If /var/run or /var/lock were empty and removed on upgrade, create
+  # symlinks for them.
+  if [ ! -e /var/run ]; then
+    ln -s /run /var/run
+  fi
+  if [ ! -e /var/lock ]; then
+    ln -s /run/lock /var/lock
+  fi
 fi

Attachment: signature.asc
Description: Digital signature

Reply via email to