[gnome-disk-utility/udisks2-port] Propose 'noauto' for /etc/crypttab for devices with removable media
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/udisks2-port] Propose 'noauto' for /etc/crypttab for devices with removable media
- Date: Fri, 12 Aug 2011 18:37:52 +0000 (UTC)
commit b41a9ce4c752d696caf6dab3aef4feb013af920d
Author: David Zeuthen <davidz redhat com>
Date: Fri Aug 12 14:37:02 2011 -0400
Propose 'noauto' for /etc/crypttab for devices with removable media
Also tweak removable-detection so mmc cards are included.
Signed-off-by: David Zeuthen <davidz redhat com>
src/palimpsest/gduwindow.c | 46 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index dbf23bc..840c93c 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -2409,6 +2409,33 @@ fstab_on_device_combobox_changed (GtkComboBox *combobox,
fstab_update_device_explanation (data);
}
+static gboolean
+drive_treat_as_removable (UDisksDrive *drive,
+ UDisksBlockDevice *block)
+{
+ gboolean ret = FALSE;
+ const gchar *device_file;
+
+ g_return_val_if_fail (UDISKS_IS_DRIVE (drive), FALSE);
+ g_return_val_if_fail (UDISKS_IS_BLOCK_DEVICE (block), FALSE);
+
+ if (udisks_drive_get_media_removable (drive))
+ {
+ ret = TRUE;
+ goto out;
+ }
+
+ device_file = udisks_block_device_get_device (block);
+ if (g_str_has_prefix (device_file, "/dev/mmcblk"))
+ {
+ ret = TRUE;
+ goto out;
+ }
+
+ out:
+ return ret;
+}
+
static void
fstab_populate_device_combo_box (GtkWidget *device_combobox,
UDisksDrive *drive,
@@ -2488,7 +2515,7 @@ fstab_populate_device_combo_box (GtkWidget *device_combobox,
/* if the device is using removable media, prefer
* by-id / by-path to by-uuid / by-label
*/
- if (drive != NULL && udisks_drive_get_media_removable (drive))
+ if (drive != NULL && drive_treat_as_removable (drive, block))
{
if (by_id != -1)
selected = by_id;
@@ -2548,7 +2575,6 @@ check_if_system_mount (const gchar *dir)
return FALSE;
}
-
static void
on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
gpointer user_data)
@@ -2638,7 +2664,7 @@ on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
type = "auto";
opts = "defaults";
/* propose noauto if the media is removable - otherwise e.g. systemd will time out at boot */
- if (drive != NULL && udisks_drive_get_media_removable (drive))
+ if (drive != NULL && drive_treat_as_removable (drive, block))
opts = "defaults,noauto";
freq = 0;
passno = 0;
@@ -2824,6 +2850,7 @@ on_generic_menu_item_configure_fstab (GtkMenuItem *menu_item,
typedef struct
{
+ UDisksDrive *drive;
UDisksBlockDevice *block;
GduWindow *window;
@@ -2988,6 +3015,9 @@ crypttab_dialog_present (CrypttabDialogData *data)
configured = FALSE;
name = g_strdup_printf ("luks-%s", udisks_block_device_get_id_uuid (data->block));
options = "";
+ /* propose noauto if the media is removable - otherwise e.g. systemd will time out at boot */
+ if (data->drive != NULL && drive_treat_as_removable (data->drive, data->block))
+ options = "noauto";
passphrase_contents = "";
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->configure_checkbutton), configured);
@@ -3214,6 +3244,7 @@ on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
+ UDisksObject *drive_object;
GtkWidget *dialog;
CrypttabDialogData *data;
GVariantIter iter;
@@ -3231,6 +3262,15 @@ on_generic_menu_item_configure_crypttab (GtkMenuItem *menu_item,
data->block = udisks_object_peek_block_device (object);
g_assert (data->block != NULL);
+ data->drive = NULL;
+ drive_object = (UDisksObject *) g_dbus_object_manager_get_object (udisks_client_get_object_manager (window->client),
+ udisks_block_device_get_drive (data->block));
+ if (drive_object != NULL)
+ {
+ data->drive = udisks_object_peek_drive (drive_object);
+ g_object_unref (drive_object);
+ }
+
dialog = gdu_window_new_widget (window, "crypttab-dialog", &data->builder);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]