================================
gnome-volume-manager:source=1.5.15-0.2 (previous: 1.5.15-0.1)
cvc rdiff gnome-volume-manager -1 /[EMAIL PROTECTED]:devel//[EMAIL
PROTECTED]:desktop/1.5.15-0.2
================================
1.5.15-0.2 Ken VanDine ([EMAIL PROTECTED]) Thu Jun 22 13:59:43 2006
Updated patches fix automount problems
91_ubuntu-remove_default_audio_dev.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-05-09
14:07:25.000000000 +0200
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-05-09 14:08:40.000000000
+0200
@@ -85,6 +85,14 @@
/* Timeout for the callback to do statfs () on mounted volumes */
static guint statfs_id = 0;
+struct ALSADevice {
+ const char* udi;
+ int card;
+ const char *id;
+};
+
+/** List of known ALSADevices */
+static GSList *audio_devices = NULL;
typedef struct {
gboolean notified;
@@ -2497,6 +2505,22 @@
}
static gboolean
+alsa_device_added (const char *udi, const char *capability
__attribute__((__unused__)))
+{
+ if (!strcmp (libhal_device_get_property_string (hal_ctx, udi, "alsa.type",
+ NULL), "playback")) {
+ /* Remember that this is an audio device */
+ struct ALSADevice* c = (struct ALSADevice*) g_malloc (sizeof (struct
ALSADevice));
+ c->udi = g_strdup(udi);
+ c->card = libhal_device_get_property_int (hal_ctx, udi, "alsa.card",
NULL);
+ c->id = libhal_device_get_property_string (hal_ctx, udi,
"alsa.card_id", NULL);
+ audio_devices = g_slist_append (audio_devices, c);
+ }
+
+ return TRUE;
+}
+
+static gboolean
printer_device_added (const char *udi, const char *capability
__attribute__((__unused__)))
{
if (config.autoprinter)
@@ -2510,6 +2534,7 @@
const char *capability;
DeviceAddedHandler handler;
} devices[] = {
+ { "alsa", alsa_device_added },
{ "block", block_device_added },
{ "camera", camera_device_added },
/*{ "input", input_device_added },*/ /* we don't
handle generic input devices (yet?) */
@@ -2562,6 +2587,67 @@
libhal_free_string_array (capabilities);
}
+/* Return the default ALSA device configured in ~/.asoundrc, or NULL if it
+ * cannot be determined. The returned string has to be free'd.
+ *
+ */
+static const char*
+alsa_default_device() {
+ gint exit_status;
+ char* card = NULL;
+ char* argv[] = {"asoundconf", "get", "defaults.pcm.card", NULL};
+ int i;
+ gboolean result;
+
+ result = g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
+ &card, NULL, &exit_status, NULL);
+ if (!result || !WIFEXITED(exit_status) || WEXITSTATUS(exit_status) ||
!card || !*card) {
+ dbg("alsa_default_device: asoundconf failed, returning NULL\n");
+ g_free(card);
+ return NULL;
+ }
+
+ /* strip off whitespace */
+ for (i = strlen (card)-1; i >= 0; --i) {
+ if (isspace (card[i]))
+ card[i] = 0;
+ else
+ break;
+ }
+
+ dbg("alsa_default_device: default card '%s'\n", card);
+ return card;
+}
+
+/** Invoked when an audio device is removed.
+ *
+ */
+static void
+gvm_delete_alsa_playback (struct ALSADevice *c)
+{
+ char cardstr[20];
+ gboolean is_default;
+
+ dbg ("removing ALSA playback card %i (%s)\n", c->card, c->id);
+ snprintf(cardstr, sizeof (cardstr), "%i", c->card);
+
+ const char* def = alsa_default_device();
+ is_default = def && (!strcmp (def, c->id) || !strcmp (def, cardstr));
+ g_free (def);
+ if (is_default) {
+ dbg ("gvm_delete_alsa_playback: Current default device has been
removed, adapting ALSA configuration\n");
+ char* argv[] = {"/usr/bin/asoundconf", "reset-default-card", NULL};
+ gint exit_status;
+ if (!g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL,
+ &exit_status, NULL) || !WIFEXITED(exit_status)) {
+ warn ("Error executing asoundconf\n");
+ return;
+ }
+ if (WEXITSTATUS(exit_status))
+ dbg ("asoundconf failed\n");
+ }
+}
+
/** Invoked when a device is removed from the Global Device List.
*
* @param ctx LibHal context
@@ -2575,6 +2661,19 @@
dbg ("Device removed: %s\n", udi);
+ /* Check whether we removed the current default audio device */
+ GSList* i = audio_devices;
+ for (; i; i = g_slist_next(i)) {
+ struct ALSADevice* d = i->data;
+ if (!strcmp(d->udi, udi)) {
+ gvm_delete_alsa_playback (d);
+ audio_devices = g_slist_delete_link (audio_devices, i);
+ g_free (d->udi);
+ g_free (d);
+ break;
+ }
+ }
+
if ((dialog = g_hash_table_lookup (dialogs, udi)))
gtk_dialog_response (dialog, GTK_RESPONSE_CANCEL);
}
08_low_disk_space_no_readonly.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-03-14
13:57:47.000000000 +0100
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-03-14 13:57:53.000000000
+0100
@@ -33,7 +33,7 @@
#endif
#ifdef ENABLE_NOTIFY
-#include <sys/vfs.h>
+#include <sys/statvfs.h>
#include <libnotify/notify.h>
#endif
@@ -2975,7 +2975,7 @@
{
char *mount_point = NULL;
NotifyNotification *n;
- struct statfs buf;
+ struct statvfs buf;
if (!(mount_point = libhal_device_get_property_string (hal_ctx, udi,
"volume.mount_point", NULL)))
return TRUE;
@@ -2984,8 +2984,12 @@
if (g_str_has_prefix (mount_point, "/media"))
return TRUE;
- if (statfs (mount_point, &buf) != -1) {
+ if (statvfs (mount_point, &buf) != -1) {
double free_space;
+
+ /* Ignore read-only mounts */
+ if (buf.f_flag & ST_RDONLY)
+ return TRUE;
free_space = (double) buf.f_bavail / (double) buf.f_blocks;
90_ubuntu-multiseat.patch: new
diff -ruN gnome-volume-manager-1.5.7-old/src/manager.c
gnome-volume-manager-1.5.7/src/manager.c
--- gnome-volume-manager-1.5.7-old/src/manager.c 2006-01-04
14:12:53.000000000 +0100
+++ gnome-volume-manager-1.5.7/src/manager.c 2006-01-04 14:12:58.000000000
+0100
@@ -552,6 +552,120 @@
}
/*
+ * multihead support
+ */
+
+#include <regex.h>
+
+static regex_t* usb_restrict_re = NULL;
+
+static void init_usb_restriction()
+{
+ regex_t re;
+ FILE *f;
+ regmatch_t m[3];
+ char restr[1024];
+ char line[4096];
+ char *busre, *portre;
+
+ /* get workstation */
+ char* display = getenv ("DISPLAY");
+ int workstation;
+
+ if (!display) {
+ dbg ("DISPLAY not set, not restricting USB ports\n");
+ return;
+ }
+ if (sscanf (display, ":%i.", &workstation) < 1 &&
+ sscanf (display, "%*[a-zA-Z0-9.-]:%i.", &workstation) < 1) {
+ dbg ("invalid DISPLAY variable, exiting\n");
+ exit (EXIT_SUCCESS);
+ }
+
+ f = fopen ("/etc/multiseat.conf", "r");
+ if (!f)
+ return;
+
+ /* generate key[index] = value regex */
+ snprintf (restr, sizeof(restr),
+
"^[[:space:]]*storage[[:space:]]*\\[[[:space:]]*%i[[:space:]]*\\][[:space:]]*=[[:space:]]*\"usb-([^-]*)-(.*)\"[[:space:]]*$",
+ workstation);
+ if (regcomp (&re, restr, REG_EXTENDED)) {
+ dbg ("init_usb_restriction: invalid regular expression\n");
+ exit (-99);
+ }
+
+ while (fgets (line, sizeof(line), f)) {
+ if (!regexec (&re, line, 3, m, 0)) {
+ line[m[2].rm_eo] = 0;
+ portre = (char*) malloc (m[2].rm_eo - m[2].rm_so + 1);
+ strcpy (portre, line+m[2].rm_so);
+ line[m[1].rm_eo] = 0;
+ busre = (char*) malloc (m[1].rm_eo - m[1].rm_so + 1);
+ strcpy (busre, line+m[1].rm_so);
+
+ snprintf (restr, sizeof (restr), "^/sys/.*/%s/.*-%s$", busre,
portre);
+ dbg ("/etc/multiseat.conf: restricting to USB devices to bus /%s/
and port /%s/ -> sysfs path /%s/\n",
+ busre, portre, restr );
+
+ usb_restrict_re = (regex_t*) malloc (sizeof (regex_t));
+ if (regcomp (usb_restrict_re, restr, REG_EXTENDED)) {
+ dbg ("init_usb_restriction: invalid regular expression in
/etc/multiseat.conf\n");
+ exit (-99);
+ }
+
+ free (busre);
+ free (portre);
+ break;
+ }
+ }
+
+ if (!usb_restrict_re) {
+ dbg ("init_usb_restriction: no matching storage configuration in
/etc/multiseat.conf, exiting\n");
+ exit (EXIT_SUCCESS);
+ }
+
+ fclose (f);
+}
+
+static int
+pass_usb_restriction (const char* udi)
+{
+ char *dev, *parent, *value;
+ int match = 0;
+
+ if (!usb_restrict_re)
+ return 1;
+
+ dev = g_strdup (udi);
+
+ while (dev) {
+ if (libhal_device_property_exists (hal_ctx, dev,
"usb_device.linux.sysfs_path", NULL)) {
+ value = libhal_device_get_property_string (hal_ctx, dev,
"usb_device.linux.sysfs_path", NULL);
+ if (!value)
+ return 0;
+
+ dbg("Checking whether kernel device name %s matches USB
restriction\n",
+ value);
+
+ match = !regexec (usb_restrict_re, value, 0, NULL, 0);
+ libhal_free_string (value);
+ break;
+ }
+ if (libhal_device_property_exists (hal_ctx, dev, "info.parent", NULL))
{
+ parent = libhal_device_get_property_string (hal_ctx, dev,
"info.parent", NULL);
+ libhal_free_string (dev);
+ dev = parent;
+ } else
+ dev = NULL;
+ }
+
+ if (dev)
+ libhal_free_string (dev);
+ return match;
+}
+
+/*
* gvm_load_config - synchronize gconf => config structure
*/
static void
@@ -1784,6 +1898,12 @@
}
if (mountable) {
+ /* Check multiseat configuration */
+ if (!pass_usb_restriction (udi)) {
+ dbg ("%s is restricted by /etc/multiseat.conf, not
mounting\n", udi);
+ goto out;
+ }
+
/* only mount if the block device has a sensible filesystem */
fsusage = libhal_device_get_property_string (hal_ctx, udi,
"volume.fsusage", &error);
if (fsusage && !g_strcasecmp(fsusage, "crypto")) {
@@ -2461,6 +2581,8 @@
return 1;
}
+
+ init_usb_restriction();
g_signal_connect (client, "die", G_CALLBACK (gvm_die), NULL);
gnome-volume-manager.recipe: changed
Index: gnome-volume-manager.recipe
====================================================================
contents(size sha1)
inode(mtime)
--- gnome-volume-manager.recipe /[EMAIL PROTECTED]:devel//[EMAIL
PROTECTED]:desktop/1.5.15-0.1
+++ gnome-volume-manager.recipe /[EMAIL PROTECTED]:devel//[EMAIL
PROTECTED]:desktop/1.5.15-0.2
@@ -1,28 +1,37 @@
loadRecipe('gnomepackage.recipe')
class Gvm(GnomePackageRecipe):
- buildRequires = GnomePackageRecipe.buildRequires
- buildRequires.extend([ 'hal:devel', 'dbus:devel', 'GConf:devel',
- 'ORBit2:devel', 'atk:devel', 'glib:devel', 'glibc:devel',
- 'gnome-vfs:devel', 'libart_lgpl:devel', 'libbonobo:devel',
- 'libbonoboui:devel', 'libglade:devel', 'libgnome:devel',
- 'libgnomecanvas:devel', 'libgnomeui:devel', 'libxml2:devel',
- 'pango:devel', 'popt:devel', 'cairo:devel',
- 'dbus-glib:devellib', 'fontconfig:devel',
- 'freetype:devel', 'gnome-keyring:devel',
- 'libpng:devel', 'libnotify:devel' ])
+ buildRequires = [ 'hal:devel', 'dbus:devel', 'GConf:devel',
+ 'ORBit2:devel', 'atk:devel', 'glib:devel', 'glibc:devel',
+ 'gnome-vfs:devel', 'libart_lgpl:devel', 'libbonobo:devel',
+ 'libbonoboui:devel', 'libglade:devel', 'libgnome:devel',
+ 'libgnomecanvas:devel', 'libgnomeui:devel', 'libxml2:devel',
+ 'pango:devel', 'popt:devel', 'cairo:devel',
+ 'dbus-glib:devellib', 'fontconfig:devel',
+ 'freetype:devel', 'gnome-keyring:devel',
+ 'libpng:devel', 'libnotify:devel', 'GConf:runtime',
+ 'desktop-file-utils:runtime', 'gettext:runtime',
+ 'libgksuui1.0:devel', 'nautilus:runtime', 'perl:runtime' ]
name = 'gnome-volume-manager'
version = '1.5.15'
def unpack(r):
- GnomePackageRecipe.unpack(r)
- r.extraConfig += ' --with-mount-command="/usr/bin/pmount-hal %%h;
/usr/bin/pmount %%d" --with-unmount-command="/usr/bin/pumount %%d"'
+ GnomePackageRecipe.unpack(r)
+ r.extraConfig += ' --with-mount-command="/usr/bin/pmount-hal %%h;
/usr/bin/pmount %%d" --with-unmount-command="/usr/bin/pumount %%d"
--disable-multiuser'
r.macros.optflags = '-g -Os'
-
- r.addPatch('defaults.patch')
-
-
- def install(r):
- GnomePackageRecipe.install(r)
- #r.Requires('pmount:runtime','%(bindir)s/gnome-volume-manager')
+ r.addPatch('defaults.patch')
+ r.addPatch('02_pmount_crypt.patch')
+ r.addPatch('03_no_gnome_mount.patch')
+ r.addPatch('04_at_console.patch')
+ r.addPatch('06_no_policy_for_manual_mounts.patch')
+ r.addPatch('07_low_disk_space_no_media.patch')
+ r.addPatch('08_low_disk_space_no_readonly.patch')
+ r.addPatch('09_low_disk_space_always_show_mountpoint.patch')
+ r.addPatch('10_low_disk_space_gettext.patch')
+ #r.addPatch('90_ubuntu-multiseat.patch')
+ r.addPatch('91_ubuntu-remove_default_audio_dev.patch')
+ r.addPatch('92_ubuntu-new_audio_notification.patch')
+ #r.addPatch('93_ubuntu_foreground_user.patch')
+ #r.addPatch('93_ubuntu_foreground_user.patch.dbus')
+ r.addPatch('99_autotools.patch')
93_ubuntu_foreground_user.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-05-11
15:14:51.000000000 +0200
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-05-11 15:28:35.000000000
+0200
@@ -3376,8 +3376,19 @@
gvm_user_active_at_console (void)
{
#ifdef ENABLE_MULTIUSER
- /* FIXME: it is currently impossible to get this information */
- return TRUE;
+ gchar *argv[] = { "check-foreground-console", NULL };
+ int retcode;
+
+ if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
+ NULL, NULL, &retcode, NULL) || !WIFEXITED (retcode) ) {
+ /* if check-foreground-console could not be executed, assume active
console */
+ warn ("gvm_user_active_at_console: could not execute
check-foreground-console\n");
+ return TRUE;
+ }
+
+ dbg ("gvm_user_active_at_console: check-foreground-console returned
with %i\n", WEXITSTATUS (retcode));
+ return WEXITSTATUS (retcode) == 0;
+
#else
/* for the non-multiuser configuration, we assume we're always on the
active console */
return TRUE;
93_ubuntu_foreground_user.patch.dbus: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-03-29
16:41:02.000000000 +0200
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-03-29 16:41:06.000000000
+0200
@@ -3357,8 +3357,39 @@
gvm_user_active_at_console (void)
{
#ifdef ENABLE_MULTIUSER
- /* FIXME: it is currently impossible to get this information */
- return TRUE;
+ gboolean ret = TRUE;
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ DBusError error;
+
+ msg = dbus_message_new_method_call ("org.freedesktop.Hal", "/",
+ "org.freedesktop.Hal.Device.Volume", "Unmount");
+ if (msg == NULL) {
+ warn ("Could not create dbus message");
+ goto out;
+ }
+
+ dbus_error_init (&error);
+ reply = dbus_connection_send_with_reply_and_block (dbus_connection,
msg, -1, &error);
+
+ if (dbus_error_is_set (&error)) {
+ dbg("dbus error: %s\n", error.name);
+ if (!strcmp (error.name,
"org.freedesktop.DBus.Error.AccessDenied")) {
+ dbg ("Not at active console\n");
+ ret = FALSE;
+ } else
+ dbg ("at active console\n");
+ dbus_error_free (&error);
+ } else
+ warn ("dummy dbus call succeeded, which is not intended\n");
+
+out:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+ if (msg != NULL)
+ dbus_message_unref (msg);
+ return ret;
+
#else
/* for the non-multiuser configuration, we assume we're always on the
active console */
return TRUE;
06_no_policy_for_manual_mounts.patch: new
diff -ruN gnome-volume-manager-1.5.10-old/src/manager.c
gnome-volume-manager-1.5.10/src/manager.c
--- gnome-volume-manager-1.5.10-old/src/manager.c 2006-01-26
11:50:10.000000000 +0100
+++ gnome-volume-manager-1.5.10/src/manager.c 2006-01-26 11:50:26.000000000
+0100
@@ -2246,7 +2246,6 @@
g_free (policy);
} else if (gvm_user_active_at_console ()) {
dbg ("not in mount queue: %s\n", udi);
- gvm_device_mounted (udi);
}
} else {
dbg ("Unmounted: %s\n", udi);
09_low_disk_space_always_show_mountpoint.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-03-14
14:06:08.000000000 +0100
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-03-14 14:06:56.000000000
+0100
@@ -3006,10 +3006,10 @@
int free_pct;
label = libhal_device_get_property_string (hal_ctx,
udi, "volume.label", NULL);
- if (!label || label[0] == '\0')
+ if (!label || label[0] == '\0' || !strcmp (label,
mount_point))
disk = g_strdup (mount_point);
else
- disk = g_strdup (label);
+ disk = g_strdup_printf ("%s (%s)", label,
mount_point);
libhal_free_string (label);
free_pct = 100 - (free_space * 100);
10_low_disk_space_gettext.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-04-13
14:54:05.000000000 +0200
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-04-13 14:54:21.000000000
+0200
@@ -3027,7 +3027,7 @@
msg = g_strdup_printf (_("%d%% of the disk space on %s
is in use"), free_pct, disk);
g_free (disk);
- n = notify_notification_new ("Low Disk Space", msg,
"gnome-dev-harddisk", NULL);
+ n = notify_notification_new (_("Low Disk Space"), msg,
"gnome-dev-harddisk", NULL);
notify_notification_set_urgency (n,
NOTIFY_URGENCY_CRITICAL);
notify_notification_show (n, NULL);
g_object_unref (n);
defaults.patch: changed
Index: defaults.patch
====================================================================
contents(size sha1)
inode(mtime)
--- defaults.patch /[EMAIL PROTECTED]:devel//[EMAIL
PROTECTED]:desktop/1.5.15-0.1
+++ defaults.patch /[EMAIL PROTECTED]:devel//[EMAIL
PROTECTED]:desktop/1.5.15-0.2
@@ -6,7 +6,7 @@
<applyto>/desktop/gnome/volume_manager/autoplay_cda_command</applyto>
<type>string</type>
- <default>totem %d</default>
-+ <default>banshee %d</default>
++ <default>banshee --audio-cd %d</default>
<locale name="C">
<short>CD play command</short>
<long>Command to run when an audio CD is inserted.</long>
04_at_console.patch: new
diff -ruN gnome-volume-manager-1.5.14-old/src/manager.c
gnome-volume-manager-1.5.14/src/manager.c
--- gnome-volume-manager-1.5.14-old/src/manager.c 2006-02-28
11:56:52.000000000 +0100
+++ gnome-volume-manager-1.5.14/src/manager.c 2006-02-28 12:17:01.000000000
+0100
@@ -3105,9 +3105,20 @@
char *path;
if (!(exists & 0x2)) {
- path = g_build_filename (GVM_CONSOLE_AUTH_DIR, g_get_user_name
(), NULL);
- exists = (access (path, F_OK) == 0) ? 0x3 : 0x2;
- g_free (path);
+ path = g_strdup_printf ("%s:", g_get_user_name ());
+ GDir* consoledir;
+ const gchar* entry;
+
+ if ( (consoledir = g_dir_open (GVM_CONSOLE_AUTH_DIR, 0, NULL))
!= NULL) {
+ while ((entry = g_dir_read_name (consoledir)) != NULL) {
+ if (g_str_has_prefix (entry, path)) {
+ exists |= 0x1;
+ break;
+ }
+ }
+ g_dir_close (consoledir);
+ }
+ exists |= 0x2;
}
return (exists & 0x1);
03_no_gnome_mount.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-04-27
16:14:23.000000000 +0200
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-04-27 16:16:10.000000000
+0200
@@ -1717,10 +1717,7 @@
dbg ("mounting %s...\n", udi);
- if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
- g_free (gnome_mount);
- gnome_mount = g_find_program_in_path ("gnome-mount");
- }
+ gnome_mount = g_find_program_in_path ("pmount-hal");
if (gnome_mount != NULL) {
gboolean retval;
@@ -1732,16 +1729,14 @@
g_hash_table_insert (mount_table, policy->udi, policy);
- if (!interactive) {
- command = g_strdup_printf ("%s --no-ui --hal-udi=%%h",
gnome_mount);
- } else {
- command = g_strdup_printf ("%s --hal-udi=%%h",
gnome_mount);
- }
-
- retval = gvm_run_command (command, udi, NULL, NULL);
- g_free (command);
-
- if (!retval) {
+ char* argv[] = { gnome_mount, udi, NULL };
+ gint exit_status;
+
+ if (!g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL,
+ &exit_status, NULL) ||
+ !WIFEXITED(exit_status) || WEXITSTATUS (exit_status)) {
+ dbg ("executing %s %s failed with status %i\n",
+ gnome_mount, udi, exit_status);
g_hash_table_remove (mount_table, policy->udi);
g_free (policy->udi);
g_free (policy);
@@ -1878,14 +1873,21 @@
dbg ("unmounting %s...\n", udi);
- if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
- g_free (gnome_mount);
- gnome_mount = g_find_program_in_path ("gnome-mount");
- }
+ gnome_mount = g_find_program_in_path ("pumount");
if (gnome_mount != NULL) {
- command = g_strdup_printf ("%s --unmount --hal-udi=%%h",
gnome_mount);
- retval = gvm_run_command (command, udi, NULL, NULL);
+ command = g_strdup_printf ("%s %%d", gnome_mount);
+
+ const char* device = NULL;
+ dbus_error_init (&error);
+ if (!(device = libhal_device_get_property_string (hal_ctx,
udi, "block.device", &error))) {
+ warn ("cannot get block.device: %s\n", error.message);
+ if (dbus_error_is_set (&error))
+ dbus_error_free (&error);
+ return FALSE;
+ }
+
+ retval = gvm_run_command (command, udi, device, NULL);
g_free (command);
return retval;
@@ -2597,14 +2599,21 @@
dbg ("ejecting %s...\n", volume);
- if (!gnome_mount || access (gnome_mount, F_OK | R_OK | X_OK) != 0) {
- g_free (gnome_mount);
- gnome_mount = g_find_program_in_path ("gnome-mount");
- }
+ gnome_mount = g_find_program_in_path ("eject");
if (gnome_mount != NULL) {
- command = g_strdup_printf ("%s --eject --hal-udi=%%h",
gnome_mount);
- gvm_run_command (command, volume, NULL, NULL);
+ command = g_strdup_printf ("%s %%d", gnome_mount);
+
+ const char* device = NULL;
+ dbus_error_init (&error);
+ if (!(device = libhal_device_get_property_string (hal_ctx,
udi, "block.device", &error))) {
+ warn ("cannot get block.device: %s\n", error.message);
+ if (dbus_error_is_set (&error))
+ dbus_error_free (&error);
+ return FALSE;
+ }
+
+ gvm_run_command (command, volume, device, NULL);
g_free (command);
} else {
if (!(dmesg = dbus_message_new_method_call
("org.freedesktop.Hal", volume,
99_autotools.patch: new
diff -ruN gnome-volume-manager-1.5.14-old/configure
gnome-volume-manager-1.5.14/configure
--- gnome-volume-manager-1.5.14-old/configure 2006-02-27 16:49:02.000000000
+0100
+++ gnome-volume-manager-1.5.14/configure 2006-02-28 12:30:57.000000000
+0100
@@ -998,7 +998,7 @@
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd $ac_popdir
+ cd "$ac_popdir"
done
fi
@@ -2364,8 +2364,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2423,8 +2422,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2540,8 +2538,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2595,8 +2592,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2641,8 +2637,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2686,8 +2681,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3594,8 +3588,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3765,8 +3758,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3834,8 +3826,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3980,8 +3971,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4052,8 +4042,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4197,8 +4186,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4256,8 +4244,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4354,8 +4341,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4434,8 +4420,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4499,8 +4484,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4564,8 +4548,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4642,8 +4625,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4707,8 +4689,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4824,8 +4805,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4992,8 +4972,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5126,8 +5105,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5212,8 +5190,7 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s
conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5518,12 +5495,12 @@
pkg_cv_GVM_CFLAGS="$GVM_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors
\"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors
\"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0
libgksuui1.0 >= 1.0.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_GVM_CFLAGS=`$PKG_CONFIG --cflags "libgnomeui-2.0 dbus-glib-1 >= 0.31
hal >= 0.5.4 gtk+-2.0 >= 2.6.0" 2>/dev/null`
+ pkg_cv_GVM_CFLAGS=`$PKG_CONFIG --cflags "libgnomeui-2.0 dbus-glib-1 >= 0.31
hal >= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -5536,12 +5513,12 @@
pkg_cv_GVM_LIBS="$GVM_LIBS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors
\"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors
\"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0
libgksuui1.0 >= 1.0.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_GVM_LIBS=`$PKG_CONFIG --libs "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0" 2>/dev/null`
+ pkg_cv_GVM_LIBS=`$PKG_CONFIG --libs "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal
>= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -5560,14 +5537,14 @@
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- GVM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout
--print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >=
2.6.0"`
+ GVM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout
--print-errors "libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >=
2.6.0 libgksuui1.0 >= 1.0.0"`
else
- GVM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors
"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0"`
+ GVM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors
"libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0
>= 1.0.0"`
fi
# Put the nasty error message in config.log where it belongs
echo "$GVM_PKG_ERRORS" >&5
- { { echo "$as_me:$LINENO: error: Package requirements (libgnomeui-2.0
dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0) were not met:
+ { { echo "$as_me:$LINENO: error: Package requirements (libgnomeui-2.0
dbus-glib-1 >= 0.31 hal >= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0) were
not met:
$GVM_PKG_ERRORS
@@ -5578,7 +5555,7 @@
and GVM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-echo "$as_me: error: Package requirements (libgnomeui-2.0 dbus-glib-1 >= 0.31
hal >= 0.5.4 gtk+-2.0 >= 2.6.0) were not met:
+echo "$as_me: error: Package requirements (libgnomeui-2.0 dbus-glib-1 >= 0.31
hal >= 0.5.4 gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0) were not met:
$GVM_PKG_ERRORS
@@ -6831,11 +6808,6 @@
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -6874,6 +6846,12 @@
fi;;
esac
done` || { (exit 1); exit 1; }
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
92_ubuntu-new_audio_notification.patch: new
diff -ruN gnome-volume-manager-1.5.10-old/src/manager.c
gnome-volume-manager-1.5.10/src/manager.c
--- gnome-volume-manager-1.5.10-old/src/manager.c 2006-01-23
17:04:37.000000000 +0100
+++ gnome-volume-manager-1.5.10/src/manager.c 2006-01-23 17:05:56.000000000
+0100
@@ -2020,6 +2021,68 @@
return strcmp (*((const char **) strptr0), *((const char **) strptr1));
}
+/**
+ * Called if the user clicks on "Open audio preferences" notification action.
+ */
+static void
+gvm_new_alsa_playback_notify_callback(NotifyNotification *n, const char
*action){
+ g_return_if_fail( strcmp (action, "open") == 0 );
+
+ char* argv[] = {"gnome-sound-properties", NULL};
+ g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, NULL);
+}
+
+/* Called if a new ALSA playback device is added.
+ *
+ * @param udi Universal Device Id
+ */
+static void
+gvm_new_alsa_playback (const char *udi)
+{
+ const char* id;
+ char notification[1024];
+
+ id = libhal_device_get_property_string (hal_ctx, udi, "alsa.card_id",
+ NULL);
+ dbg ("New ALSA playback device: %s\n", id);
+
+ /* Check whether we have gnome-sound-properties */
+ if (!g_file_test ("/usr/bin/gnome-sound-properties",
G_FILE_TEST_IS_EXECUTABLE))
+ return;
+
+ /* Check whether we can change the sound card at all */
+ char* argv[] = {"/usr/bin/asoundconf", "is-active", NULL};
+ gint exit_status;
+ if (!g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL,
+ &exit_status, NULL) || !WIFEXITED(exit_status)) {
+ warn ("Error executing asoundconf\n");
+ return;
+ }
+ if (WEXITSTATUS (exit_status)) {
+ dbg ("~/.asoundrc was customized, cannot change default sound
card\n");
+ return;
+ }
+
+ /* Invoke notification */
+ if (!notify_is_initted())
+ if (!notify_init ("gnome-volume-manager"))
+ return;
+
+ snprintf (notification, sizeof (notification),
+ N_("To configure your new audio playback device %s and "
+ "possibly set it as default device, open "
+ "System -> Preferences -> Sound."), id);
+
+ NotifyNotification *n = notify_notification_new (N_("New audio playback
device detected"), notification, GTK_STOCK_DIALOG_INFO, NULL);
+ notify_notification_set_category (n, "device");
+ notify_notification_add_action (n, "open",
+ N_("Open audio preferences"),
+ gvm_new_alsa_playback_notify_callback,
NULL, NULL);
+ notify_notification_set_timeout (n, 10000);
+ notify_notification_show(n, NULL);
+}
+
typedef gboolean (* DeviceAddedHandler) (const char *udi, const char
*capability);
@@ -2235,6 +2298,9 @@
c->udi = g_strdup(udi);
c->card = libhal_device_get_property_int (hal_ctx, udi, "alsa.card",
NULL);
audio_devices = g_slist_append (audio_devices, c);
+
+ /* Do appropriate actions */
+ gvm_new_alsa_playback (udi);
}
return TRUE;
07_low_disk_space_no_media.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-03-14
13:35:42.000000000 +0100
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-03-14 13:39:16.000000000
+0100
@@ -2979,6 +2979,10 @@
if (!(mount_point = libhal_device_get_property_string (hal_ctx, udi,
"volume.mount_point", NULL)))
return TRUE;
+
+ /* Ignore volumes in /media */
+ if (g_str_has_prefix (mount_point, "/media"))
+ return TRUE;
if (statfs (mount_point, &buf) != -1) {
double free_space;
02_pmount_crypt.patch: new
diff -ruN gnome-volume-manager-1.5.15-old/configure.in
gnome-volume-manager-1.5.15/configure.in
--- gnome-volume-manager-1.5.15-old/configure.in 2006-03-10
19:54:48.000000000 +0100
+++ gnome-volume-manager-1.5.15/configure.in 2006-05-16 10:53:03.000000000
+0200
@@ -101,7 +101,7 @@
AC_SUBST(GVM_CONSOLE_AUTH_DIR)
AC_DEFINE_UNQUOTED(GVM_CONSOLE_AUTH_DIR, "$GVM_CONSOLE_AUTH_DIR", [Directory
to check for console ownership])
-PKG_CHECK_MODULES(GVM, libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4
gtk+-2.0 >= 2.6.0)
+PKG_CHECK_MODULES(GVM, libgnomeui-2.0 dbus-glib-1 >= 0.31 hal >= 0.5.4
gtk+-2.0 >= 2.6.0 libgksuui1.0 >= 1.0.0)
AC_SUBST(GVM_CFLAGS)
AC_SUBST(GVM_LIBS)
diff -ruN gnome-volume-manager-1.5.15-old/src/manager.c
gnome-volume-manager-1.5.15/src/manager.c
--- gnome-volume-manager-1.5.15-old/src/manager.c 2006-03-10
19:50:15.000000000 +0100
+++ gnome-volume-manager-1.5.15/src/manager.c 2006-05-16 10:53:24.000000000
+0200
@@ -25,6 +25,7 @@
#include <dirent.h>
#include <signal.h>
#include <unistd.h>
+#include <mntent.h>
#include <locale.h>
@@ -45,6 +46,8 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <libhal.h>
+#include <libgksuui1.0/gksuui.h>
+#include <sys/wait.h>
#include "gvm.h"
@@ -1551,6 +1554,157 @@
return iocharset;
}
+/*
+ * gvm_device_mount_finished - called back when mount finished.
+ *
+ * This needs to close the pid, remove the FIFO (if given, that applies to
+ * encrypted devices) and display an error message if the mount failed.
+ */
+void
+gvm_device_mount_finished (GPid pid, gint status, const char* fifoname)
+{
+ g_spawn_close_pid (pid);
+
+ dbg ("gvm_device_mount_finished: mount process %i returned with %i\n", pid,
+ status);
+
+ if (fifoname)
+ unlink (fifoname);
+
+ if (!WIFEXITED(status)) {
+ warn ("pmount did not exit normally\n");
+ return;
+ }
+
+ /* if we have an encryption secret, we display an error message
+ * if the mount failed. */
+ if (WEXITSTATUS(status) && fifoname) {
+ GtkMessageDialog *dialog;
+ dialog = gtk_message_dialog_new (NULL, 0,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Could not mount encrypted device. Did you supply a wrong
passphrase?"));
+ gtk_widget_show (GTK_WIDGET(dialog));
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+ }
+}
+
+/*
+ * gvm_device_mount_encrypted_pwd_callback - Called from
+ * gvm_device_mount_encrypted after the password dialog finished. Use pmount
+ * to mount an encrypted given device.
+ */
+static void
+gvm_device_mount_encrypted_pwd_callback (GksuuiDialog* dialog, gint response,
+ char *udi)
+{
+ char *argv[5] = {"/usr/bin/pmount-hal", udi, "--passphrase", NULL, NULL};
+ GError *error = NULL;
+ char* fifoname = NULL;
+ FILE* fifo = NULL;
+ GPid mount_pid;
+ char* passphrase = NULL;
+
+ if (!udi) {
+ warn ("gvm_device_mount_encrypted_pwd_callback: udi == NULL!\n");
+ return;
+ }
+ if (!dialog) {
+ warn ("gvm_device_mount_encrypted_pwd_callback: dialog == NULL!\n");
+ return;
+ }
+
+ /* Check whether we got a passphrase */
+ if (response == GTK_RESPONSE_OK)
+ passphrase = gksuui_dialog_get_password (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ if (!passphrase)
+ return;
+
+ /* Create a private temporary FIFO */
+ for (;;) {
+ fifoname = tmpnam(NULL);
+ if (!fifoname) {
+ warn ("gvm_device_mount_encrypted: cannot create a temporary
name\n");
+ return;
+ }
+
+ int result = mkfifo (fifoname, 0700);
+ if (result == 0)
+ break;
+ if (errno != EEXIST) {
+ warn ("gvm_device_mount_encrypted: cannot create fifo: %s\n",
+ strerror (errno));
+ return;
+ }
+ }
+ argv[3] = fifoname;
+
+ /* Call the mount process asynchronously */
+ if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL,
+ NULL, &mount_pid, &error)) {
+ warn ("gvm_device_mount_encrypted: could not execute pmount: %s\n",
+ error->message);
+ return;
+ }
+
+ /* When mounting finishes, call the clean up and error handling
+ * callback. */
+ g_child_watch_add (mount_pid, gvm_device_mount_finished, fifoname);
+
+ /* now the mount process runs, write the secret into the FIFO;
+ * this blocks until the pmount child opens the fifo */
+ fifo = fopen (fifoname, "w");
+ if (fifo)
+ fputs (passphrase, fifo);
+ else {
+ warn ("gvm_device_mount_encrypted: cannot open fifo: %s\n",
+ strerror (errno));
+ unlink (fifoname);
+ }
+ free (passphrase);
+ fclose (fifo);
+ free (udi);
+}
+
+/*
+ * gvm_device_mount_encrypted - create a passphrase dialog for an encrypted
+ * dialog and set up gvm_device_mount_encrypted_pwd_callback() as a callback.
+ *
+ * @return TRUE iff the mount was succesful
+ */
+static void
+gvm_device_mount_encrypted (const char *udi)
+{
+ GksuuiDialog *dialog = GKSUUI_DIALOG (gksuui_dialog_new());
+ gtk_window_set_title (GTK_WINDOW(dialog), _("Encrypted volume detected"));
+
+ /* if cryptsetup is not available, tell user about it */
+ if (access ("/sbin/cryptsetup", X_OK) < 0) {
+ GtkWidget* dialog = gtk_message_dialog_new_with_markup (NULL,
GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
+ _("This device contains an encrypted partition. Please install
the package <b>cryptsetup</b> to access it."));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ return;
+ }
+
+ const char* device = libhal_device_get_property_string (hal_ctx, udi,
"block.device", NULL);
+
+ if (device) {
+ char message[1000];
+ snprintf (message, sizeof(message), _("A passphrase is required to
decrypt volume %s"), device);
+ gksuui_dialog_set_message (dialog, message);
+ } else
+ gksuui_dialog_set_message (dialog, _("A passphrase is required to
decrypt this volume"));
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gvm_device_mount_encrypted_pwd_callback), g_strdup
(udi));
+
+ gtk_widget_show_all (GTK_WIDGET(dialog));
+}
+
/*
* gvm_device_mount - mount the given device.
@@ -2079,6 +2233,9 @@
if (config.automount_drives && (mountable || crypto)) {
if (!gvm_udi_is_subfs_mount (udi)) {
if (!libhal_device_get_property_bool (hal_ctx, udi,
"volume.ignore", NULL)) {
+ if (crypto)
+ gvm_device_mount_encrypted (udi);
+ else
gvm_device_mount (udi, TRUE);
} else {
dbg ("volume.ignore set to true on %s, not
mounting\n", udi);
@@ -2622,6 +2779,73 @@
return ctx;
}
+/*
+ * Check whether dev is an encrypted device handled by devmapper. If so, pass
+ * the underlying physical device major/minor and return TRUE.
+ * If not, or an error occurs, return FALSE.
+ * This uses the /usr/lib/eject/dmcrypt-get-device helper.
+ */
+gboolean hal_get_devmapper_device (const char* dev, int* major, int* minor)
+{
+ char cmd[1024];
+ char output[100];
+
+ const char* devmapper = "/dev/mapper/";
+ if (strncmp (dev, devmapper, strlen(devmapper)))
+ return FALSE;
+
+ if (strchr (dev, '\''))
+ return FALSE;
+ snprintf (cmd, sizeof(cmd), "/usr/lib/eject/dmcrypt-get-device '%s'", dev);
+ FILE* f = popen (cmd, "r");
+ fread (output, 1, sizeof(output), f);
+ if (pclose(f))
+ return FALSE;
+
+ return sscanf(output, "%i:%i", major, minor) == 2;
+}
+
+/** Check whether given UDI is a mounted encrypted device.
+ *
+ */
+static gboolean
+hal_is_encrypted_mounted_device (LibHalContext* ctx, const char* udi)
+{
+ const char* fsusage;
+ int major, minor, fsmajor, fsminor;
+ FILE* mounts;
+ struct mntent* m;
+ gboolean result = FALSE;
+
+ /* ensure we have a crypto block device and get major/minor */
+ fsusage = libhal_device_get_property_string (ctx, udi, "volume.fsusage",
NULL);
+ if (!fsusage || strcmp (fsusage, "crypto") != 0)
+ return FALSE;
+ if (!libhal_device_property_exists (ctx, udi, "block.major", NULL) ||
+ !libhal_device_property_exists (ctx, udi, "block.minor", NULL))
+ return FALSE;
+ major = libhal_device_get_property_int (ctx, udi, "block.major", NULL);
+ minor = libhal_device_get_property_int (ctx, udi, "block.minor", NULL);
+
+ /* walk through mounted devices, resolve devmapper devices, compare */
+ mounts = setmntent("/proc/mounts", "r");
+ if (!mounts) {
+ warn ("hal_is_encrypted_mounted_device(): Could not open /proc/mounts:
%s\n", strerror (errno));
+ return FALSE;
+ }
+ while ((m = getmntent (mounts)) != NULL) {
+ if (hal_get_devmapper_device (m->mnt_fsname, &fsmajor, &fsminor) &&
+ fsmajor == major && fsminor == minor) {
+ dbg ("hal_is_encrypted_mounted_device: UDI %s (device %s) is an
encrypted mounted file system\n",
+ udi, libhal_device_get_property_string (ctx, udi,
"block.device", NULL));
+ result = TRUE;
+ break;
+ }
+ }
+ endmntent (mounts);
+ return result;
+}
+
/** Attempt to mount all volumes; should be called on startup.
*
* @param ctx LibHal context
@@ -2662,7 +2886,8 @@
/* don't attempt to mount already mounted volumes */
if (!libhal_device_property_exists (ctx, udi,
"volume.is_mounted", NULL)
- || libhal_device_get_property_bool (ctx, udi,
"volume.is_mounted", NULL)) {
+ || libhal_device_get_property_bool (ctx, udi,
"volume.is_mounted", NULL)
+ || hal_is_encrypted_mounted_device (ctx, udi)) {
#ifdef ENABLE_NOTIFY
/* Add to the statfs_mounts list if not a cdrom */
if (!gvm_udi_is_cdrom (udi)) {
@@ -2681,6 +2906,7 @@
libhal_free_string (prop);
continue;
}
+ gboolean is_encrypted = (prop[0] == 'c');
libhal_free_string (prop);
/* check our mounting policy */
@@ -2704,7 +2930,10 @@
if ((dev = libhal_device_get_property_string (ctx, udi,
"block.device", &error))) {
dbg ("mount_all: mounting %s\n", dev);
/* don't make the mount program put up error dialogs */
- gvm_device_mount (udi, FALSE);
+ if (is_encrypted)
+ gvm_device_mount_encrypted (udi);
+ else
+ gvm_device_mount (udi, FALSE);
libhal_free_string (dev);
} else {
warn ("mount_all: no device for udi=%s: %s", udi,
error.message);
03_kernel_hint.patch: removed
99_autotools.patch: removed
05_mount_at_start.patch: removed
multiseat.patch: removed
gnome-volume-manager-0.9.10.add-to-base.patch: removed
00_set_defaults.patch: removed
Committed by: krv
_______________________________________________
Desktop-commits mailing list
[email protected]
http://lists.bizrace.com/mailman/listinfo/desktop-commits