Check that all binaries needed are installed before running
authorJavier Fernández-Sanguino <javier.fernandez-sanguino@projectaon.org>
Wed, 3 Apr 2013 18:53:22 +0000 (18:53 +0000)
committerJavier Fernández-Sanguino <javier.fernandez-sanguino@projectaon.org>
Wed, 3 Apr 2013 18:53:22 +0000 (18:53 +0000)
git-svn-id: https://projectaon.org/data/trunk@2222 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11

common/scripts/gbtopml.pl
common/scripts/gbtosvg.pl
common/scripts/gbtoxhtml-less-simple.pl
common/scripts/gbtoxhtml-simple.pl
common/scripts/gbtoxhtml.pl

index c8a87c2..9bbf88a 100755 (executable)
@@ -14,6 +14,19 @@ my $PATH_PREFIX  = "$ENV{'HOME'}/aon/data";
 my $XML_PATH = "$PATH_PREFIX/xml";
 my $PML_PATH = "$PATH_PREFIX/pml";
 
+my $JAVA       = '/usr/bin/java';
+
+# Check that all the binaries are were want them
+
+my @BINARIES;
+push @BINARIES, ($JAVA);
+
+foreach (@BINARIES) {
+    if ( ! -e $_ ) {
+        die "$PROGRAM_NAME: Cannot find binary '".$_."'. Please install it.\n";
+    }
+}
+
 ##
 
 unless( $ARGV[ 0 ] ) { die "Usage:\n\t${PROGRAM_NAME} book-code\n"; }
@@ -87,4 +100,4 @@ elsif( $bookCode eq "12tmod" ) {
 }
 else{ die "Error:\n\tUknown book code.\n"; }
 
-print qx{java org.apache.xalan.xslt.Process -IN $XML_PATH/$XML_SOURCE -XSL $XML_PATH/pml.xsl -OUT $PML_PATH/$BOOK_PATH/$bookCode.txt -PARAM use-illustrators \"$USE_ILLUSTRATORS\"};
+print qx{$JAVA org.apache.xalan.xslt.Process -IN $XML_PATH/$XML_SOURCE -XSL $XML_PATH/pml.xsl -OUT $PML_PATH/$BOOK_PATH/$bookCode.txt -PARAM use-illustrators \"$USE_ILLUSTRATORS\"};
index f996ccb..e9fa73f 100755 (executable)
@@ -16,6 +16,19 @@ my $JAVA       = '/usr/bin/java';
 my $XALAN_JAR  = '/usr/share/java/xalan2.jar';
 my $DOT        = '/usr/local/bin/dot';
 
+
+# Check that all the binaries are were want them
+
+my @BINARIES;
+push @BINARIES, ($RXP, $JAVA, $XALAN_JAR, $DOT);
+
+foreach (@BINARIES) {
+    if ( ! -e $_ ) {
+            die "$PROGRAM_NAME: Cannot find binary '".$_."'. Please install it.\n";
+    }
+}
+
+
 ###
 
 my $bookCode     = '';
index db9cc78..feae705 100755 (executable)
@@ -21,6 +21,17 @@ my $ZIP        = '/usr/bin/zip';
 my $JAVA       = '/usr/bin/java';
 my $XALAN_JAR  = '/usr/share/java/xalan2.jar';
 
+# Check that all the binaries are were want them
+
+my @BINARIES;
+push @BINARIES, ($RXP, $CP, $MV, $ZIP, $JAVA, $XALAN_JAR, $RM);
+
+foreach (@BINARIES) {
+    if ( ! -e $_ ) {
+            die "$PROGRAM_NAME: Cannot find binary '".$_."'. Please install it.\n";
+    }
+}
+
 ###
 
 my $bookCode     = '';
index fc1df53..09dc2a5 100755 (executable)
@@ -18,7 +18,7 @@ unless( -e $RXP && -x $RXP ) {
     # try somewhere else
     $RXP = '/usr/local/bin/rxp';
 }
-my $ZIP        = '/usr/bin/zip -q';
+my $ZIP        = '/usr/bin/zip';
 my $JAVA       = '/usr/bin/java';
 # latest binary download names the relevant jar "xalan.jar"
 # older installations may have "xalan2.jar"
@@ -28,6 +28,17 @@ unless( -e $XALAN_JAR ) {
     $XALAN_JAR = '/usr/share/java/xalan2.jar';
 }
 
+# Check that all the binaries are were want them
+
+my @BINARIES;
+push @BINARIES, ($RXP, $ZIP, $JAVA, $XALAN_JAR);
+
+foreach (@BINARIES) {
+    if ( ! -e $_ ) {
+            die "$PROGRAM_NAME: Cannot find binary '".$_."'. Please install it.\n";
+    }
+}
+
 ###
 
 my $bookCode     = '';
@@ -122,7 +133,7 @@ if( $bookXML =~ m{^([-\w\@./]+)$} ) {
     my $bookPath = "$outPath${FILENAME_SEPARATOR}${bookCode}";
 
     print qx{$JAVA -classpath "$XALAN_JAR" org.apache.xalan.xslt.Process -IN "${bookXML}" -XSL "${xhtmlXSL}" -OUT "${bookPath}.htm" -PARAM use-illustrators "$rulesHash{'use-illustrators'}"};
-    print qx{$ZIP $bookPath.zip $bookPath.htm};
+    print qx{$ZIP -q $bookPath.zip $bookPath.htm};
 }
 
 print "Success\n" if $verbose;
index 194c30b..2a4bd3d 100755 (executable)
@@ -24,6 +24,17 @@ my $XALAN_JAR  = '/usr/share/java/xalan2.jar';
 my $RM         = '/bin/rm';
 my $CHMOD      = '/bin/chmod';
 
+# Check that all the binaries are were want them
+
+my @BINARIES;
+push @BINARIES, ($RXP, $CP, $MV, $TAR, $ZIP, $BZIP2, $JAVA, $XALAN_JAR, $RM, $CHMOD);
+
+foreach (@BINARIES) {
+    if ( ! -e $_ ) {
+        die "$PROGRAM_NAME: Cannot find binary '".$_."'. Please install it.\n";
+    }
+}
+
 ###
 
 my $bookCode     = '';