diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index 6fb151a..34855c4 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -30,6 +30,7 @@ sub exec_usage { -a assemble arrays when run as root -c check database + -d file alternative database file -h print this help and exit -q be quiet -v be more verbose @@ -62,7 +63,7 @@ sub exec_version { my $ROOT=$<==0?1:0; my %opts; -getopts('achqvV', \%opts) or die "# ERROR: getopts failed, try -h.\n"; # Values in %opts +getopts('acd:hqvV', \%opts) or die "# ERROR: getopts failed, try -h.\n"; # Values in %opts exec_usage if $opts{h}; exec_version if $opts{V}; @@ -73,6 +74,15 @@ $VERBOSE+=1 if $opts{v}; my $MDADMCONF_DB = '/etc/mxmd.conf'; # the 'database' with serials +if ($opts{d}) { + my $db = $opts{d}; + if (-e $db) { + $MDADMCONF_DB = $db; + } else { + die "# db file '$db' does not exist, stopped"; + } +} + my $MDADM_CONF_BASE = '/dev/shm/mdadm.conf'; # config for mdadm, created with information from above my $MDADM_ASSEMBLE_OPTIONS = '';