* Added mountall. This is an Ubuntu utility that mounts filesystems

as they become available (as determined by monitoring udev) and
  emits Upstart events to inform other jobs that the filesystems are
  mounted.  This is very useful for NixOS (which currently ignores
  filesystems in the job dependency chain - very bad).

  Unfortunately, mountall depends on Plymouth (a boot splash
  implementation).  The patch allows mountall to build without
  Plymouth.  Since Plymouth is also used to inform users about failing
  mounts and get responses, some more changes will be needed.
  Probably mountall should emit a "mount-failed" event to trigger a
  root shell on the console to allow the user to repair the problem.

svn path=/nixpkgs/trunk/; revision=22143
This commit is contained in:
Eelco Dolstra 2010-06-04 13:43:53 +00:00
parent 4772588553
commit 240305fab4
3 changed files with 227 additions and 0 deletions

View file

@ -0,0 +1,21 @@
{ stdenv, fetchurl, pkgconfig, libnih, dbus, udev, autoconf, automake, libtool }:
stdenv.mkDerivation {
name = "mountall-2.15";
src = fetchurl {
url = https://launchpad.net/ubuntu/+archive/primary/+files/mountall_2.15.tar.gz;
sha256 = "1ik9r1av0f17byfxr4l2w0qpaijxkfqvxws6gmc98liq6fyyzn4v";
};
patches = [ ./no-plymouth.patch ];
preConfigure = "autoreconf";
buildInputs = [ pkgconfig libnih dbus.libs udev autoconf automake libtool ];
meta = {
homepage = https://launchpad.net/ubuntu/+source/mountall;
description = "Utility to mount all filesystems and emit Upstart events";
};
}

View file

@ -0,0 +1,201 @@
diff -x '*~' -ru mountall-2.15-orig/configure.ac mountall-2.15/configure.ac
--- mountall-2.15-orig/configure.ac 2010-05-09 01:42:22.000000000 +0200
+++ mountall-2.15/configure.ac 2010-06-03 13:46:09.000000000 +0200
@@ -29,7 +29,7 @@
PKG_CHECK_MODULES([NIH_DBUS], [libnih-dbus >= 1.0.0])
PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2.16])
PKG_CHECK_MODULES([UDEV], [libudev >= 146])
-PKG_CHECK_MODULES([PLYMOUTH], [ply-boot-client >= 0.8.0])
+#PKG_CHECK_MODULES([PLYMOUTH], [ply-boot-client >= 0.8.0])
# Checks for header files.
diff -x '*~' -ru mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
--- mountall-2.15-orig/src/mountall.c 2010-05-09 01:42:24.000000000 +0200
+++ mountall-2.15/src/mountall.c 2010-06-03 17:39:23.000000000 +0200
@@ -64,8 +64,10 @@
#include <nih-dbus/dbus_proxy.h>
#include <nih-dbus/errors.h>
+#if 0
#include <ply-event-loop.h>
#include <ply-boot-client.h>
+#endif
#include "ioprio.h"
@@ -214,15 +216,19 @@
void boredom_timeout (void *data, NihTimer *timer);
int plymouth_connect (void);
+#if 0
void plymouth_disconnected (void *user_data, ply_boot_client_t *client);
+#endif
void plymouth_progress (Mount *mnt, int progress);
void plymouth_update (int only_clear);
+#if 0
void plymouth_response (void *user_data, ply_boot_client_t *client);
void plymouth_failed (void *user_data, ply_boot_client_t *client);
void plymouth_answer (void *user_data, const char *keys,
ply_boot_client_t *client);
+#endif
void usr1_handler (void *data, NihSignal *signal);
@@ -310,6 +316,7 @@
**/
static struct udev *udev = NULL;
+#if 0
/**
* ply_event_loop:
*
@@ -323,6 +330,7 @@
* Plymouth boot client.
**/
static ply_boot_client_t *ply_boot_client = NULL;
+#endif
/**
* plymouth_error:
@@ -2203,12 +2211,14 @@
if (no_events)
return;
+#if 0
/* Flush the Plymouth connection to ensure all updates are sent,
* since the event may kill plymouth.
*/
if (ply_boot_client)
ply_boot_client_flush (ply_boot_client);
-
+#endif
+
env = NIH_MUST (nih_str_array_new (NULL));
if (mnt) {
@@ -2787,6 +2797,7 @@
int
plymouth_connect (void)
{
+#if 0
/* If we were already connected, just re-use that connection */
if (ply_boot_client)
return TRUE;
@@ -2813,8 +2824,13 @@
nih_info (_("Connected to Plymouth"));
return TRUE;
+#else
+ return FALSE;
+#endif
}
+
+#if 0
void
plymouth_disconnected (void * user_data,
ply_boot_client_t *client)
@@ -2827,6 +2843,7 @@
ply_boot_client_free (ply_boot_client);
ply_boot_client = NULL;
}
+#endif
void
@@ -2837,6 +2854,7 @@
nih_assert (mnt != NULL);
+#if 0
/* No Plymouth => no progress information */
if (! plymouth_connect ())
return;
@@ -2866,6 +2884,7 @@
plymouth_response,
plymouth_failed,
NULL);
+#endif
}
void
@@ -2881,7 +2900,7 @@
NIH_LIST_FOREACH (mounts, iter) {
Mount *mnt = (Mount *)iter;
- if (mnt->error <= ERROR_BORED)
+ if (mnt->error <= ERROR_NONE)
continue;
nih_error (_("Skipping mounting %s since Plymouth is not available"),
@@ -2895,6 +2914,7 @@
return;
}
+#if 0
/* If we're already displaying messages, don't change them unless
* the message is no longer valid for that mount point; otherwise
* clear the message.
@@ -3005,8 +3025,10 @@
plymouth_answer,
plymouth_failed,
NULL);
+#endif
}
+#if 0
void
plymouth_response (void * user_data,
ply_boot_client_t *client)
@@ -3125,7 +3147,7 @@
break;
}
}
-
+#endif
/**
@@ -3211,6 +3233,7 @@
(NihIoWatcher)udev_monitor_watcher,
udev_monitor));
+#if 0
/* Initialise a Plymouth event loop; this is an epoll instance that
* we can poll within our own main loop and call out to when needs
* be.
@@ -3224,6 +3247,7 @@
/* Attempt an early connection to Plymouth */
plymouth_connect ();
+#endif
mounts = NIH_MUST (nih_list_new (NULL));
@@ -3236,7 +3260,9 @@
* from /etc/fstab and /proc/self/mountinfo to find out what else
* we need to do.
*/
+#if 0
parse_fstab (BUILTIN_FSTAB);
+#endif
parse_fstab (_PATH_MNTTAB);
parse_mountinfo ();
@@ -3338,10 +3364,12 @@
/* Flush the D-Bus connection to ensure all messages are sent */
dbus_connection_flush (connection);
+#if 0
/* Flush the Plymouth connection to ensure all updates are sent */
if (ply_boot_client)
ply_boot_client_flush (ply_boot_client);
-
+#endif
+
return ret;
}

View file

@ -6644,6 +6644,11 @@ let
inherit fetchurl stdenv;
};
mountall = import ../os-specific/linux/mountall {
inherit fetchurl stdenv pkgconfig libnih dbus udev autoconf libtool;
automake = automake111x;
};
aggregateModules = modules:
import ../os-specific/linux/module-init-tools/aggregator.nix {
inherit stdenv module_init_tools modules buildEnv;