store valid modes in an array

This commit is contained in:
Johannes 'josch' Schauer 2018-09-21 18:57:34 +02:00
parent 550562cf6f
commit 0cdd803ba0
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -988,10 +988,9 @@ sub main() {
if ($options->{mode} eq 'sudo') {
$options->{mode} = 'root';
}
if ($options->{mode} ne 'auto' and $options->{mode} ne 'root'
and $options->{mode} ne 'fakechroot'
and $options->{mode} ne 'proot' and $options->{mode} ne 'unshare') {
die "invalid mode. Choose from auto, root, fakechroot, proot, unshare";
my @valid_modes = ('auto', 'root', 'unshare', 'fakechroot', 'proot');
if (!grep { $_ eq $options->{mode} } @valid_modes) {
die "invalid mode. Choose from " . (join ', ', @valid_modes);
}
if ($options->{variant} eq 'essential' and defined $options->{include}) {