Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to create label on vfat type #103

Merged
merged 1 commit into from Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/perl/Filesystem.pm
Expand Up @@ -29,6 +29,7 @@ use constant REMOUNT => qw (/bin/mount -o remount);
use constant FSTAB => "/etc/fstab";
use constant MTAB => "/etc/mtab";
use constant MKFSLABEL => '-L';
use constant MKFSLABELVFAT => '-n';
use constant MKFSFORCE => '-f';
use constant SWAPON => '/sbin/swapon';
use constant TUNE2FS => '/sbin/tune2fs';
Expand Down Expand Up @@ -291,7 +292,7 @@ sub formatfs
};

my $tunecmd;
my @opts = exists $self->{label} ? (MKFSLABEL, $self->{label}):();
my @opts = exists $self->{label} ? ($self->{type} eq 'vfat' ? MKFSLABELVFAT : MKFSLABEL, $self->{label}) : ();
push (@opts, split ('\s+', $self->{mkfsopts})) if exists $self->{mkfsopts};
push (@opts, MKFSFORCE) if ($self->{type} eq 'xfs');

Expand Down Expand Up @@ -616,10 +617,10 @@ sub do_format_ks

# Extract the absolute path to make it work on different SL versions.
if (exists (MKFSCMDS->{$self->{type}})) {
my $mkfs = basename (MKFSCMDS->{$self->{type}});
print join (' ', $mkfs,
my $mkfs = basename (MKFSCMDS->{$self->{type}});
print join (' ', $mkfs,
$self->{block_device}->devpath,
exists ($self->{label}) ? (MKFSLABEL, $self->{label}) : (),
exists ($self->{label}) ? ($self->{type} eq 'vfat' ? MKFSLABELVFAT : MKFSLABEL, $self->{label}) : (),
exists ($self->{mkfsopts})? $self->{mkfsopts}:())
, "\n";
}
Expand Down