summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/bootloader-config
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/bootloader-config')
-rwxr-xr-xperl-install/standalone/bootloader-config40
1 files changed, 23 insertions, 17 deletions
diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config
index 8c3dc7466..4a21bc7ac 100755
--- a/perl-install/standalone/bootloader-config
+++ b/perl-install/standalone/bootloader-config
@@ -239,9 +239,10 @@ sub migrate_to_uuids() {
_add_uuid_to_swap($_) if $_->{fs_type} eq 'swap' && !$_->{device_UUID};
}
- _migrate_to_uuids__fstab();
-
my $fstab = [ fs::get::fstab($all_hds) ];
+
+ _migrate_to_uuids__fstab($fstab);
+
my $bootloader_migrated;
my $may_migrate = sub {
my ($label, $dev_ref) = @_;
@@ -269,16 +270,30 @@ sub migrate_to_uuids() {
}
sub _migrate_to_uuids__fstab() {
+ my ($fstab) = @_;
+
+ my @raw_fstab = fs::read_fstab('', '/etc/fstab', 'keep_freq_passno', 'verbatim_credentials');
+
my $fstab_migrated;
- foreach my $part (fs::get::really_all_fstab($all_hds)) {
- if (_set_prefer_device_UUID($part)) {
- log::l("migrate_to_uuids: migrating fstab $part->{device} entry");
- $fstab_migrated = 1;
- }
+ foreach my $part (@raw_fstab) {
+ devices::should_prefer_UUID($part->{device}) or next;
+
+ my $part_ = find { fs::get::is_same_hd($part, $_) } @$fstab
+ or log::l("migrate_to_uuids: do not know $part->{device}, can not migrate it"), next;
+
+ $part->{device_UUID} = $part_->{device_UUID}
+ or log::l("migrate_to_uuids: no UUID for $part->{device}, can not migrate it"), next;
+ $part->{prefer_device_UUID} = 1;
+ $part->{prefer_device} = 0;
+
+ log::l("migrate_to_uuids: migrating fstab $part->{device} entry");
+ $fstab_migrated = 1;
}
if ($fstab_migrated) {
cp_af('/etc/fstab', '/etc/fstab.before-migrate-to-uuids');
- fs::write_fstab($all_hds);
+
+ my ($s) = fs::prepare_write_fstab(\@raw_fstab, '', 'keep_smb_credentials');
+ output('/etc/fstab', $s);
}
}
@@ -290,15 +305,6 @@ sub _migrate_dev_to_uuid {
$part && $part->{device_UUID} && "UUID=$part->{device_UUID}";
}
-sub _set_prefer_device_UUID {
- my ($part) = @_;
- $part->{device_UUID} && !$part->{prefer_device_UUID} && !$part->{prefer_device_LABEL}
- && devices::should_prefer_UUID($part->{device}) or return;
- $part->{prefer_device_UUID} = 1;
- $part->{prefer_device} = 0;
- 1;
-}
-
# add UUID to swap v.2 in case the swap was created long ago when mkswap didn't do it by default
sub _add_uuid_to_swap {
my ($part) = @_;