summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/harddrake214
1 files changed, 10 insertions, 4 deletions
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 7700616d5..a8b0865b1 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -462,10 +462,7 @@ foreach (@classes) {
rename_field($_, 'usb_driver', 'driver');
rename_field($_, 'usb_id', 'id');
rename_field($_, 'usb_media_type', 'media_type');
- if ($_->{nice_media_type}) {
- delete $_->{media_type};
- rename_field($_, 'nice_media_type', 'media_type');
- }
+ force_rename_field($_, 'nice_media_type', 'media_type');
rename_field($_, 'usb_pci_bus', 'bus');
rename_field($_, 'nice_bus', 'bus');
rename_field($_, 'usb_vendor', 'vendor');
@@ -573,6 +570,15 @@ sub titleFormat {
[ $title . "\n", { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD, scale => Gtk2::Pango->PANGO_SCALE_LARGE } ];
}
+sub force_rename_field {
+ my ($dev, $new_field, $field) = @_;
+ if ($dev->{$new_field}) {
+ delete $dev->{$field};
+ rename_field($dev, $new_field, $field);
+ }
+}
+
+
sub rename_field {
my ($dev, $field, $new_field) = @_;
if ($dev->{$field}) {