#!/usr/bin/perl
#
# Check disk layout on mac
# return 0 if layout problem is identified
# APL hardcoded
# script runs from Darwin pkg installer


use strict;

my $APL='/opt/sarch/';

if(-d "$APL/var/conf/sm") {
   print "SM is previously configured\n";
   exit 1;
   # TBD: check that configuration is not compromized
}else{    # SM never configured. it should have store + one more volume
   my @df=`/bin/df -P`;         # get list of filesystems
   if (!grep {m|/Volumes/va-store|} @df) {
     print "/Volumes/va-store is not found\n";
     exit 0;
   }
   if (! grep {m|/Volumes/va-|} grep {! m|/Volumes/va-store|} @df) {
     print "/Volumes/va-XXXXX is not found\n";
     exit 0;
   }
   exit 1;
}

 
