diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2009-02-09 22:28:17 +0000 |
---|---|---|
committer | Gilles Dartiguelongue <eva@gentoo.org> | 2009-02-09 22:28:17 +0000 |
commit | 7d09e8286fe354f1ecbbdb55c80f37bcfd320cbc (patch) | |
tree | 1faf4418b65bf629ad5044894a0b3049c20bf886 /gnome-base/gnome-mount | |
parent | Add new patch for the http delays. Remove old cruft. (diff) | |
download | gentoo-2-7d09e8286fe354f1ecbbdb55c80f37bcfd320cbc.tar.gz gentoo-2-7d09e8286fe354f1ecbbdb55c80f37bcfd320cbc.tar.bz2 gentoo-2-7d09e8286fe354f1ecbbdb55c80f37bcfd320cbc.zip |
Bump to 0.8-r1. Better defaults for vfat, bug #257745. Fix HAL locking for devices in fstab, bug #257746. Fix automagic dependency, bug #257753. Many thanks to Pacho Ramos.
(Portage version: 2.2_rc23/cvs/Linux x86_64)
Diffstat (limited to 'gnome-base/gnome-mount')
7 files changed, 224 insertions, 696 deletions
diff --git a/gnome-base/gnome-mount/ChangeLog b/gnome-base/gnome-mount/ChangeLog index 94b660db2485..2b361ed5a4a2 100644 --- a/gnome-base/gnome-mount/ChangeLog +++ b/gnome-base/gnome-mount/ChangeLog @@ -1,6 +1,18 @@ # ChangeLog for gnome-base/gnome-mount # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-mount/ChangeLog,v 1.55 2009/02/02 15:54:06 ranger Exp $ +# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-mount/ChangeLog,v 1.56 2009/02/09 22:28:17 eva Exp $ + +*gnome-mount-0.8-r1 (09 Feb 2009) + + 09 Feb 2009; Gilles Dartiguelongue <eva@gentoo.org> + -files/gnome-mount-0.4-ntfs3g.patch, + +files/gnome-mount-0.8-fstablock.patch, + +files/gnome-mount-0.8-libnotify-automagic.patch, + +files/gnome-mount-0.8-vfat-defaults.patch, + -files/gnome-mount-hal-no-media-fstab.patch, +gnome-mount-0.8-r1.ebuild: + Bump to 0.8-r1. Better defaults for vfat, bug #257745. Fix HAL locking for + devices in fstab, bug #257746. Fix automagic dependency, bug #257753. Many + thanks to Pacho Ramos. 02 Feb 2009; Brent Baude <ranger@gentoo.org> gnome-mount-0.8.ebuild: stable ppc64, bug 256163 diff --git a/gnome-base/gnome-mount/files/gnome-mount-0.4-ntfs3g.patch b/gnome-base/gnome-mount/files/gnome-mount-0.4-ntfs3g.patch deleted file mode 100644 index e1c282319cf2..000000000000 --- a/gnome-base/gnome-mount/files/gnome-mount-0.4-ntfs3g.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -ur gnome-mount-0.4-orig/src/gnome-mount.c gnome-mount-0.4/src/gnome-mount.c ---- gnome-mount-0.4-orig/src/gnome-mount.c 2006-02-24 00:14:23.000000000 -0500 -+++ gnome-mount-0.4/src/gnome-mount.c 2006-08-25 13:56:00.000000000 -0400 -@@ -651,6 +651,13 @@ - snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); - g_ptr_array_add (options, uidbuf); - } -+ } else if (strcmp (fstype, "ntfs-3g") == 0) { -+ /* needed for FUSE to mount */ -+ g_ptr_array_add (options, "nonempty"); -+ if (opts & MOUNT_UID) { -+ snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); -+ g_ptr_array_add (options, uidbuf); -+ } - } else if (strcmp (fstype, "iso9660") == 0) { - if (opts & MOUNT_UID) { - snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); diff --git a/gnome-base/gnome-mount/files/gnome-mount-0.8-fstablock.patch b/gnome-base/gnome-mount/files/gnome-mount-0.8-fstablock.patch new file mode 100644 index 000000000000..4e01f55248a1 --- /dev/null +++ b/gnome-base/gnome-mount/files/gnome-mount-0.8-fstablock.patch @@ -0,0 +1,61 @@ +# Patch for fixing hal locking when device is in fstab +# https://bugs.gentoo.org/show_bug.cgi?id=257746 +diff -p -up a/src/gnome-mount.c b/src/gnome-mount.c +--- a/src/gnome-mount.c 2008-09-15 14:39:28.000000000 +0200 ++++ b/src/gnome-mount.c 2008-09-15 14:42:54.000000000 +0200 +@@ -1166,6 +1166,18 @@ volume_mount (const char *udi, LibHalVol + char *args[3] = {MOUNT, NULL, NULL}; + char **envp = {NULL}; + ++ /* don't mount if device is locked ++ */ ++ if (libhal_device_is_locked_by_others (hal_ctx, ++ udi, ++ "org.freedesktop.Hal.Device.Storage", ++ NULL)) { ++ if (opt_verbose) ++ g_message (_("Device %s is locked, aborting"), ++ udi); ++ goto out; ++ } ++ + if (opt_verbose) + g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), + device_file, mount_point_fstab); +@@ -1738,6 +1750,17 @@ volume_unmount (const char *udi, LibHalV + char *args[3] = {UMOUNT, NULL, NULL}; + char **envp = {NULL}; + ++ /* don't unmount if device is locked ++ */ ++ if (libhal_device_is_locked_by_others (hal_ctx, ++ udi, ++ "org.freedesktop.Hal.Device.Storage", ++ NULL)) { ++ if (opt_verbose) ++ g_message (_("Device %s is locked, aborting"), ++ udi); ++ goto out; ++ } + if (opt_verbose) + g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), + device_file, mount_point); +@@ -1958,6 +1981,18 @@ volume_eject (const char *udi, LibHalVol + char *args[3] = {"eject", NULL, NULL}; + char **envp = {NULL}; + ++ /* don't mount if device is locked ++ */ ++ if (libhal_device_is_locked_by_others (hal_ctx, ++ udi, ++ "org.freedesktop.Hal.Device.Storage", ++ NULL)) { ++ if (opt_verbose) ++ g_message (_("Device %s is locked, aborting"), ++ udi); ++ goto out; ++ } ++ + if (opt_verbose) + g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), + device_file, mount_point); diff --git a/gnome-base/gnome-mount/files/gnome-mount-0.8-libnotify-automagic.patch b/gnome-base/gnome-mount/files/gnome-mount-0.8-libnotify-automagic.patch new file mode 100644 index 000000000000..2521b05263ad --- /dev/null +++ b/gnome-base/gnome-mount/files/gnome-mount-0.8-libnotify-automagic.patch @@ -0,0 +1,80 @@ +# fix libnotify automagic dep +# https://bugs.gentoo.org/show_bug.cgi?id=257753 +diff -ur gnome-mount@181/ChangeLog gnome-mount@182/ChangeLog +--- gnome-mount@181/src/gnome-mount.c 2009-02-05 10:04:54.000000000 +0100 ++++ gnome-mount@182/src/gnome-mount.c 2009-02-05 10:08:36.000000000 +0100 +@@ -41,7 +41,11 @@ + #include <gdk/gdkx.h> + #include "copy-paste/gnome-password-dialog.h" + #include <gnome-keyring.h> ++#include <gtk/gtk.h> ++ ++#ifdef ENABLE_NOTIFY + #include <libnotify/notify.h> ++#endif + + #if !defined(NOTIFY_EXPIRES_NEVER) + #define NOTIFY_EXPIRES_NEVER 0 +@@ -1549,17 +1553,21 @@ + + static guint unmount_cache_timeout_id = -1; + ++#ifdef ENABLE_NOTIFY + static NotifyNotification *unmount_note = NULL; ++#endif + + static gboolean unmount_note_is_eject = FALSE; + static char *unmount_note_drive_name = NULL; + ++#ifdef ENABLE_NOTIFY + static void + unmount_note_close_func (NotifyNotification *note, gpointer user_data) + { + g_debug ("in unmount_note_close_func()"); + unmount_note = NULL; + } ++#endif + + static gboolean + unmount_cache_timeout_func (gpointer data) +@@ -1602,13 +1610,16 @@ + g_strchug (unmount_note_drive_name); + g_debug ("Setting up 750ms timer for Flushing Cache dialog"); + unmount_cache_timeout_id = g_timeout_add (750, unmount_cache_timeout_func, NULL); ++#ifdef ENABLE_NOTIFY + unmount_note = NULL; ++#endif + } + + static void + unmount_cache_timeout_cancel (gboolean was_success) + { + g_source_remove (unmount_cache_timeout_id); ++#ifdef ENABLE_NOTIFY + if (unmount_note != NULL) { + if (was_success) { + char *summary; +@@ -1628,6 +1639,7 @@ + notify_notification_show (unmount_note, NULL); + } + } ++#endif + } + + static gboolean unmount_still_in_progress = FALSE; +--- gnome-mount@181/configure.in 2008-02-25 22:54:20.000000000 +0100 ++++ gnome-mount@182/configure.in 2009-02-05 10:25:25.000000000 +0100 +@@ -100,8 +100,11 @@ + AC_SUBST(NAUTILUS_LIBS) + fi + +-PKG_CHECK_MODULES([NOTIFY], [libnotify >= 0.3.0], [enable_notify=yes], [enable_notify=yes]) +-if test "x$enable_notify" != "xno"; then ++AC_ARG_ENABLE(libnotify, ++ AS_HELP_STRING([--enable-libnotify],[Use libnotify]), ++ ,[enable_libnotify=yes]) ++if test "x$enable_libnotify" != "xno"; then ++ PKG_CHECK_MODULES([NOTIFY], [libnotify >= 0.3.0]) + AC_DEFINE_UNQUOTED([ENABLE_NOTIFY], 1, [Enable notifications with libnotify]) + AC_SUBST(NOTIFY_CFLAGS) + AC_SUBST(NOTIFY_LIBS) diff --git a/gnome-base/gnome-mount/files/gnome-mount-0.8-vfat-defaults.patch b/gnome-base/gnome-mount/files/gnome-mount-0.8-vfat-defaults.patch new file mode 100644 index 000000000000..017dbc200704 --- /dev/null +++ b/gnome-base/gnome-mount/files/gnome-mount-0.8-vfat-defaults.patch @@ -0,0 +1,13 @@ +# Patch for setting noatime and flush for vfat partitions +# https://bugs.gentoo.org/show_bug.cgi?id=257745 +--- a/gnome-mount.schemas.in 2009-02-05 09:32:52.000000000 +0100 ++++ b/gnome-mount.schemas.in 2009-02-05 09:40:30.000000000 +0100 +@@ -6,7 +6,7 @@ + <applyto>/system/storage/default_options/vfat/mount_options</applyto> + <type>list</type> + <list_type>string</list_type> +- <default>[shortname=lower,uid=]</default> ++ <default>[shortname=lower,flush,noatime,uid=]</default> + <locale name="C"> + <short>Default mount options for vfat fs</short> + <long>A list of default mount options for volumes formatted with the vfat file system.</long> diff --git a/gnome-base/gnome-mount/files/gnome-mount-hal-no-media-fstab.patch b/gnome-base/gnome-mount/files/gnome-mount-hal-no-media-fstab.patch deleted file mode 100644 index 5900e4feb151..000000000000 --- a/gnome-base/gnome-mount/files/gnome-mount-hal-no-media-fstab.patch +++ /dev/null @@ -1,678 +0,0 @@ ---- gnome-mount-0.4/src/gnome-mount.c 2006-02-24 00:14:23.000000000 -0500 -+++ gnome-mount-0.4.new/src/gnome-mount.c 2006-06-18 19:40:03.000000000 -0400 -@@ -238,7 +238,8 @@ - /* #define MOUNT_ERROR_DIALOG_RESPONSE_INSTALL_DRIVER 10 see below */ - - static void --show_error_dialog_mount (LibHalVolume *volume, const char *error_name, const char *error_detail, -+show_error_dialog_mount (LibHalVolume *volume, LibHalDrive *drive, -+ const char *error_name, const char *error_detail, - const char *fstype_requested) - { - GtkWidget *w; -@@ -266,7 +267,10 @@ - 0, - _("Cannot mount volume")); - -- volume_name = libhal_volume_get_label (volume); -+ if (volume != NULL) -+ volume_name = libhal_volume_get_label (volume); -+ else -+ volume_name = NULL; - - if (strcmp (error_name, "org.freedesktop.Hal.Device.Volume.PermissionDenied") == 0) { - gtk_message_dialog_format_secondary_text ( -@@ -289,8 +293,8 @@ - volume_name != NULL ? - _("The volume '%s' uses the <i>%s</i> file system which is not supported by your system.") : - _("The volume uses the <i>%s</i> file system which is not supported by your system."), -- volume_name != NULL ? volume_name : fstype_requested, -- volume_name != NULL ? fstype_requested : ""); -+ volume_name != NULL ? volume_name : (fstype_requested != NULL ? fstype_requested : ""), -+ volume_name != NULL ? (fstype_requested != NULL ? fstype_requested : "") : ""); - - /* some day.. :-) - gtk_dialog_add_buttons (GTK_DIALOG (w), -@@ -463,9 +467,9 @@ - - notify_parent (FALSE); - -- show_error_dialog_mount (volume, error.name, error.message, -+ show_error_dialog_mount (volume, drive, error.name, error.message, - (fstype != NULL && strlen (fstype) > 0) ? -- fstype : libhal_volume_get_fstype (volume)); -+ fstype : (volume != NULL ? libhal_volume_get_fstype (volume) : NULL)); - - dbus_error_free (&error); - goto out; -@@ -573,6 +577,226 @@ - return flags; - } - -+ -+static gboolean -+fstab_open (gpointer *handle) -+{ -+#ifdef __FreeBSD__ -+ return setfsent () == 1; -+#else -+ *handle = fopen ("/etc/fstab", "r"); -+ return *handle != NULL; -+#endif -+} -+ -+static char * -+fstab_next (gpointer handle, char **mount_point) -+{ -+#ifdef __FreeBSD__ -+ struct fstab *fstab; -+ -+ fstab = getfsent (); -+ -+ /* TODO: fill out mount_point */ -+ if (mount_point != NULL && fstab != NULL) { -+ *mount_point = fstab->fs_file; -+ } -+ -+ return fstab ? fstab->fs_spec : NULL; -+#else -+ struct mntent *mnt; -+ -+ mnt = getmntent (handle); -+ -+ if (mount_point != NULL && mnt != NULL) { -+ *mount_point = mnt->mnt_dir; -+ } -+ -+ return mnt ? mnt->mnt_fsname : NULL; -+#endif -+} -+ -+ -+static void -+fstab_close (gpointer handle) -+{ -+#ifdef __FreeBSD__ -+ endfsent (); -+#else -+ fclose (handle); -+#endif -+} -+ -+ -+/* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */ -+static void -+canonicalize_filename (gchar *filename) -+{ -+ gchar *p, *q; -+ gboolean last_was_slash = FALSE; -+ -+ p = filename; -+ q = filename; -+ -+ while (*p) -+ { -+ if (*p == G_DIR_SEPARATOR) -+ { -+ if (!last_was_slash) -+ *q++ = G_DIR_SEPARATOR; -+ -+ last_was_slash = TRUE; -+ } -+ else -+ { -+ if (last_was_slash && *p == '.') -+ { -+ if (*(p + 1) == G_DIR_SEPARATOR || -+ *(p + 1) == '\0') -+ { -+ if (*(p + 1) == '\0') -+ break; -+ -+ p += 1; -+ } -+ else if (*(p + 1) == '.' && -+ (*(p + 2) == G_DIR_SEPARATOR || -+ *(p + 2) == '\0')) -+ { -+ if (q > filename + 1) -+ { -+ q--; -+ while (q > filename + 1 && -+ *(q - 1) != G_DIR_SEPARATOR) -+ q--; -+ } -+ -+ if (*(p + 2) == '\0') -+ break; -+ -+ p += 2; -+ } -+ else -+ { -+ *q++ = *p; -+ last_was_slash = FALSE; -+ } -+ } -+ else -+ { -+ *q++ = *p; -+ last_was_slash = FALSE; -+ } -+ } -+ -+ p++; -+ } -+ -+ if (q > filename + 1 && *(q - 1) == G_DIR_SEPARATOR) -+ q--; -+ -+ *q = '\0'; -+} -+ -+static char * -+resolve_symlink (const char *file) -+{ -+ GError *error; -+ char *dir; -+ char *link; -+ char *f; -+ char *f1; -+ -+ f = g_strdup (file); -+ -+ while (g_file_test (f, G_FILE_TEST_IS_SYMLINK)) { -+ link = g_file_read_link (f, &error); -+ if (link == NULL) { -+ g_warning ("Cannot resolve symlink %s: %s", f, error->message); -+ g_error_free (error); -+ g_free (f); -+ f = NULL; -+ goto out; -+ } -+ -+ dir = g_path_get_dirname (f); -+ f1 = g_strdup_printf ("%s/%s", dir, link); -+ g_free (dir); -+ g_free (link); -+ g_free (f); -+ f = f1; -+ } -+ -+out: -+ if (f != NULL) -+ canonicalize_filename (f); -+ return f; -+} -+ -+static gboolean -+is_in_fstab (const char *device_file, const char *label, const char *uuid, char **mount_point) -+{ -+ gboolean ret; -+ gpointer handle; -+ char *entry; -+ char *_mount_point; -+ -+ ret = FALSE; -+ -+ /* check if /etc/fstab mentions this device... (with symlinks etc) */ -+ if (!fstab_open (&handle)) { -+ handle = NULL; -+ goto out; -+ } -+ -+ while ((entry = fstab_next (handle, &_mount_point)) != NULL) { -+ char *resolved; -+ -+ if (label != NULL && g_str_has_prefix (entry, "LABEL=")) { -+ if (strcmp (entry + 6, label) == 0) { -+ ret = TRUE; -+ if (mount_point != NULL) -+ *mount_point = g_strdup (_mount_point); -+ goto out; -+ } -+ } -+ -+ if (uuid != NULL && g_str_has_prefix (entry, "UUID=")) { -+ if (strcmp (entry + 5, uuid) == 0) { -+ ret = TRUE; -+ if (mount_point != NULL) -+ *mount_point = g_strdup (_mount_point); -+ goto out; -+ } -+ } -+ -+ resolved = resolve_symlink (entry); -+ if (strcmp (device_file, resolved) == 0) { -+ ret = TRUE; -+ g_free (resolved); -+ if (mount_point != NULL) -+ *mount_point = g_strdup (_mount_point); -+ goto out; -+ } -+ -+ g_free (resolved); -+ } -+ -+out: -+ if (handle != NULL) -+ fstab_close (handle); -+ -+ return ret; -+} -+ -+#ifdef __FreeBSD__ -+#define MOUNT "/sbin/mount" -+#define UMOUNT "/sbin/umount" -+#else -+#define MOUNT "/bin/mount" -+#define UMOUNT "/bin/umount" -+#endif -+ - static gboolean - volume_mount (const char *udi, LibHalVolume *volume, LibHalDrive *drive) - { -@@ -587,9 +811,89 @@ - char *key; - gboolean ret; - const char *fstype; -+ const char *device_file; -+ const char *label; -+ const char *uuid; - - ret = FALSE; - -+ g_debug ("Mounting %s", udi); -+ -+ /* check if it's in /etc/fstab */ -+ label = NULL; -+ uuid = NULL; -+ device_file = NULL; -+ if (volume != NULL) { -+ label = libhal_volume_get_label (volume); -+ uuid = libhal_volume_get_uuid (volume); -+ device_file = libhal_volume_get_device_file (volume); -+ } else if (drive != NULL) { -+ device_file = libhal_drive_get_device_file (drive); -+ } -+ if (device_file != NULL) { -+ char *mount_point = NULL; -+ -+ if (is_in_fstab (device_file, label, uuid, &mount_point)) { -+ GError *err = NULL; -+ char *sout = NULL; -+ char *serr = NULL; -+ int exit_status; -+ char *args[3] = {MOUNT, NULL, NULL}; -+ char **envp = {NULL}; -+ -+ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), -+ device_file, mount_point); -+ args[1] = mount_point; -+ if (!g_spawn_sync ("/", -+ args, -+ envp, -+ 0, -+ NULL, -+ NULL, -+ &sout, -+ &serr, -+ &exit_status, -+ &err)) { -+ g_warning ("Cannot execute %s\n", MOUNT); -+ g_free (mount_point); -+ goto out; -+ } -+ -+ if (exit_status != 0) { -+ char errstr[] = "mount: unknown filesystem type"; -+ -+ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n", -+ MOUNT, exit_status, sout, serr); -+ -+ if (strstr (serr, "unknown filesystem type") != NULL) { -+ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFilesystemType", serr, NULL); -+ } else if (strstr (serr, "already mounted") != NULL) { -+ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.AlreadyMounted", serr, NULL); -+ } else if (strstr (serr, "only root") != NULL) { -+ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr, NULL); -+ } else if (strstr (serr, "bad option") != NULL) { -+ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.InvalidMountOption", serr, NULL); -+ } else { -+ show_error_dialog_mount (volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr, NULL); -+ } -+ -+ g_free (mount_point); -+ goto out; -+ -+ } -+ -+ g_print (_("Mounted %s at \"%s\" (using /etc/fstab)\n"), device_file, mount_point); -+ -+ g_free (mount_point); -+ ret = TRUE; -+ goto out; -+ -+ } -+ g_free (mount_point); -+ } -+ -+ -+ - if (volume != NULL) { - fstype = libhal_volume_get_fstype (volume); - } else { -@@ -690,6 +994,7 @@ - - g_free (mount_point); - -+out: - return ret; - } - -@@ -697,15 +1002,89 @@ - static gboolean - volume_unmount (const char *udi, LibHalVolume *volume, LibHalDrive *drive) - { -- gboolean ret = FALSE; -+ gboolean ret; - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - DBusError error; - char **options = NULL; - unsigned int num_options = 0; -+ const char *fstype; -+ const char *device_file; -+ const char *label; -+ const char *uuid; -+ -+ ret = FALSE; - - g_debug ("Unmounting %s", udi); - -+ /* check if it's in /etc/fstab */ -+ label = NULL; -+ uuid = NULL; -+ device_file = NULL; -+ if (volume != NULL) { -+ label = libhal_volume_get_label (volume); -+ uuid = libhal_volume_get_uuid (volume); -+ device_file = libhal_volume_get_device_file (volume); -+ } else if (drive != NULL) { -+ device_file = libhal_drive_get_device_file (drive); -+ } -+ if (device_file != NULL) { -+ char *mount_point = NULL; -+ -+ if (is_in_fstab (device_file, label, uuid, &mount_point)) { -+ GError *err = NULL; -+ char *sout = NULL; -+ char *serr = NULL; -+ int exit_status; -+ char *args[3] = {UMOUNT, NULL, NULL}; -+ char **envp = {NULL}; -+ -+ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), -+ device_file, mount_point); -+ args[1] = mount_point; -+ if (!g_spawn_sync ("/", -+ args, -+ envp, -+ 0, -+ NULL, -+ NULL, -+ &sout, -+ &serr, -+ &exit_status, -+ &err)) { -+ g_warning ("Cannot execute %s\n", UMOUNT); -+ g_free (mount_point); -+ goto out; -+ } -+ -+ if (exit_status != 0) { -+ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n", -+ UMOUNT, exit_status, sout, serr); -+ g_free (mount_point); -+ -+ if (strstr (serr, "is busy") != NULL) { -+ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.Busy", serr); -+ } else if (strstr (serr, "not mounted") != NULL) { -+ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.NotMounted", serr); -+ } else if (strstr (serr, "only root") != NULL) { -+ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr); -+ } else { -+ show_error_dialog_unmount (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr); -+ } -+ -+ goto out; -+ } -+ -+ g_print (_("Unmounted %s (using /etc/fstab).\n"), device_file); -+ -+ g_free (mount_point); -+ ret = TRUE; -+ goto out; -+ -+ } -+ g_free (mount_point); -+ } -+ - msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, - "org.freedesktop.Hal.Device.Volume", - "Unmount"); -@@ -752,8 +1131,82 @@ - DBusError error; - char **options = NULL; - unsigned int num_options = 0; -+ const char *fstype; -+ const char *device_file; -+ const char *label; -+ const char *uuid; -+ -+ ret = FALSE; - - g_debug ("Ejecting %s", udi); -+ -+ /* check if it's in /etc/fstab */ -+ label = NULL; -+ uuid = NULL; -+ device_file = NULL; -+ if (volume != NULL) { -+ label = libhal_volume_get_label (volume); -+ uuid = libhal_volume_get_uuid (volume); -+ device_file = libhal_volume_get_device_file (volume); -+ } else if (drive != NULL) { -+ device_file = libhal_drive_get_device_file (drive); -+ } -+ if (device_file != NULL) { -+ char *mount_point = NULL; -+ -+ if (is_in_fstab (device_file, label, uuid, &mount_point)) { -+ GError *err = NULL; -+ char *sout = NULL; -+ char *serr = NULL; -+ int exit_status; -+ char *args[3] = {"eject", NULL, NULL}; -+ char **envp = {NULL}; -+ -+ g_print (_("Device %s is in /etc/fstab with mount point \"%s\"\n"), -+ device_file, mount_point); -+ args[1] = mount_point; -+ if (!g_spawn_sync ("/", -+ args, -+ envp, -+ G_SPAWN_SEARCH_PATH, -+ NULL, -+ NULL, -+ &sout, -+ &serr, -+ &exit_status, -+ &err)) { -+ g_warning ("Cannot execute %s\n", "eject"); -+ g_free (mount_point); -+ goto out; -+ } -+ -+ if (exit_status != 0) { -+ g_warning ("%s said error %d, stdout='%s', stderr='%s'\n", -+ "eject", exit_status, sout, serr); -+ g_free (mount_point); -+ -+ if (strstr (serr, "is busy") != NULL) { -+ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.Busy", serr); -+ } else if (strstr (serr, "only root") != NULL) { -+ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr); -+ } else if (strstr (serr, "unable to open") != NULL) { -+ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.PermissionDenied", serr); -+ } else { -+ show_error_dialog_eject (udi, volume, drive, "org.freedesktop.Hal.Device.Volume.UnknownFailure", serr); -+ } -+ -+ goto out; -+ } -+ -+ g_print (_("Ejected %s (using /etc/fstab).\n"), device_file); -+ -+ g_free (mount_point); -+ ret = TRUE; -+ goto out; -+ -+ } -+ g_free (mount_point); -+ } - - msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi, - "org.freedesktop.Hal.Device.Volume", -@@ -1255,112 +1708,6 @@ - { - } - -- --/* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */ --static void --canonicalize_filename (gchar *filename) --{ -- gchar *p, *q; -- gboolean last_was_slash = FALSE; -- -- p = filename; -- q = filename; -- -- while (*p) -- { -- if (*p == G_DIR_SEPARATOR) -- { -- if (!last_was_slash) -- *q++ = G_DIR_SEPARATOR; -- -- last_was_slash = TRUE; -- } -- else -- { -- if (last_was_slash && *p == '.') -- { -- if (*(p + 1) == G_DIR_SEPARATOR || -- *(p + 1) == '\0') -- { -- if (*(p + 1) == '\0') -- break; -- -- p += 1; -- } -- else if (*(p + 1) == '.' && -- (*(p + 2) == G_DIR_SEPARATOR || -- *(p + 2) == '\0')) -- { -- if (q > filename + 1) -- { -- q--; -- while (q > filename + 1 && -- *(q - 1) != G_DIR_SEPARATOR) -- q--; -- } -- -- if (*(p + 2) == '\0') -- break; -- -- p += 2; -- } -- else -- { -- *q++ = *p; -- last_was_slash = FALSE; -- } -- } -- else -- { -- *q++ = *p; -- last_was_slash = FALSE; -- } -- } -- -- p++; -- } -- -- if (q > filename + 1 && *(q - 1) == G_DIR_SEPARATOR) -- q--; -- -- *q = '\0'; --} -- --static char * --resolve_symlink (const char *file) --{ -- GError *error; -- char *dir; -- char *link; -- char *f; -- char *f1; -- -- f = g_strdup (file); -- -- while (g_file_test (f, G_FILE_TEST_IS_SYMLINK)) { -- link = g_file_read_link (f, &error); -- if (link == NULL) { -- g_warning ("Cannot resolve symlink %s: %s", f, error->message); -- g_error_free (error); -- g_free (f); -- f = NULL; -- goto out; -- } -- -- dir = g_path_get_dirname (f); -- f1 = g_strdup_printf ("%s/%s", dir, link); -- g_free (dir); -- g_free (link); -- g_free (f); -- f = f1; -- } -- --out: -- if (f != NULL) -- canonicalize_filename (f); -- return f; --} -- - int - main (int argc, char *argv[]) - { -@@ -1689,7 +2036,8 @@ - - goto out; - -- } else if (fsusage == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM) { -+ } else if (fsusage == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM || -+ fsusage == LIBHAL_VOLUME_USAGE_UNKNOWN) { - if (volume_mount (udi, volume, drive)) - rc = 0; - } -@@ -1700,7 +2048,7 @@ - - out: - if (drive != NULL) -- libhal_volume_free (volume); -+ libhal_drive_free (drive); - - if (volume != NULL) - libhal_volume_free (volume); diff --git a/gnome-base/gnome-mount/gnome-mount-0.8-r1.ebuild b/gnome-base/gnome-mount/gnome-mount-0.8-r1.ebuild new file mode 100644 index 000000000000..4f8b6fea5f77 --- /dev/null +++ b/gnome-base/gnome-mount/gnome-mount-0.8-r1.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-mount/gnome-mount-0.8-r1.ebuild,v 1.1 2009/02/09 22:28:17 eva Exp $ + +inherit autotools eutils gnome2 + +DESCRIPTION="Wrapper for (un)mounting and ejecting disks" +HOMEPAGE="http://hal.freedesktop.org/" +SRC_URI="http://hal.freedesktop.org/releases/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="libnotify nautilus kernel_FreeBSD" + +RDEPEND=">=dev-libs/glib-2.15.0 + >=x11-libs/gtk+-2.8 + >=sys-apps/hal-0.5.8.1 + >=gnome-base/gnome-keyring-2.20 + >=gnome-base/gconf-2 + libnotify? ( >=x11-libs/libnotify-0.3 ) + nautilus? ( + >=gnome-base/libglade-2 + >=gnome-base/nautilus-2.21.2 ) + >=dev-libs/dbus-glib-0.71" + +DEPEND="${RDEPEND} + dev-util/pkgconfig + >=dev-util/intltool-0.35.5" + +DOCS="AUTHORS ChangeLog HACKING INSTALL NEWS README TODO" + +pkg_setup() { + G2CONF="${G2CONF} --disable-static + $(use_enable libnotify) + $(use_enable nautilus nautilus-extension)" +} + +src_unpack() { + gnome2_src_unpack + + use kernel_FreeBSD && epatch "${FILESDIR}/${PN}-0.6-freebsd-schemas.patch" + + # Include missing locale.h, bug #176035 + epatch "${FILESDIR}/${PN}-0.6-include-locale-h.patch" + + # Better defaults for vfat, bug #257745 + epatch "${FILESDIR}/${P}-vfat-defaults.patch" + + # Fix HAL locking for devices in fstab, bug #257746 + epatch "${FILESDIR}/${P}-fstablock.patch" + + # Fix automagic dependency, bug #257753 + epatch "${FILESDIR}/${P}-libnotify-automagic.patch" + + eautoreconf +} |