Show
Ignore:
Timestamp:
28.09.2017 20:34:52 (2 years ago)
Author:
ak19
Message:

Rewriting the part of makegs2.sh that grabs the imagemagick binary, as the El Cap binary (10.11) was made backwards compatible with Mountain Lion (10.5). And we also want the untarring to be silent.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/makegs2.sh

    r32007 r32008  
    3939 
    4040if [[ "x$getgnomelib" == "x" && "x$getimagick" == "x" ]]; then 
    41     echo "No recognised args provided" 
     41    echo "Launching with no args" 
    4242fi 
    4343 
     
    8585echo "****************************************"     
    8686 
     87# Get the imagemagick precompiled binary for the OS system if compilation was successful 
     88if [[ "$status" == "0" && "x$getimagick" == "ximagemagick" ]]; then     
    8789 
    88 imgpkg= 
    89 if [ "x$getimagick" = "ximagemagick" ]; then 
    90    os=`uname` 
     90    imgpkg= 
     91     
     92    os=`uname` 
    9193 
    9294   if [ "x$os" = "xDarwin" ]; then 
    93        # by default, resort to the Mac Leopard (10.5) imagemagick binary 
    94        imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.5.tar.gz 
     95       # The imagemagick binary built on El Capitan (10.11) was made backwards compatible up to and including Mountain Lion (10.8) using the mmacosx-version-min flag. 
     96       # The kernel version of Mountain Lion is 12.6.0. For El Capitan it's 15.6.0 
     97       # So any kernel version less than 12, we'll use the Leopard (10.5) imagemagick binary, and for greater, we'll use the El Capitan imgmagick binary 
     98     
     99       # by default on Macs, will resort to the MountainLion-and-later compatible ElCapitan binary 
     100       imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.11.tar.gz 
    95101 
    96102       kernelVersion=`uname -r` 
     103        
     104       # kernel version is something like 15.6.0, need the major version number to do integer (not float) comparisons 
     105 
     106       # https://stackoverflow.com/questions/20348097/bash-extract-string-before-a-colon 
     107       # doesn't work, even when put into backticks: 
     108       # majorKernelVersion=sed 's/\..*//' 
     109        
     110       # Using pure bash solution to substring before first period mark 
     111       # NOTE: two percent signs gets chars up to the first occurrence of period mark. Single percent sign gets chars up to last period mark. 
     112       majorKernelVersion=${kernelVersion%%\.*} 
     113       echo "MacOS major kernel version: $majorKernelVersion" 
     114 
     115       # bash evaluates string as integer/vice-versa depending on context 
     116       # https://unix.stackexchange.com/questions/232384/argument-string-to-integer-in-bash 
     117       # http://tldp.org/LDP/abs/html/comparison-ops.html 
     118 
    97119       # El Capitan is MacOS version 10.11 but its kernelVersion is 15.6.0 
    98        if [ "x$kernelVersion" = "x15.6.0" ]; then 
    99        echo "Getting imagemagick built for El Capitan" 
    100        imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.11.tar.gz 
     120       # For MacOS versions older than Mountain Lion/10.8 (kernel 12.6.0) use the Mac Leopard (10.5) imagemagick binary 
     121       if [ "$majorKernelVersion" -lt "12" ]; then 
     122       echo "Getting imagemagick built on Mac Leopard" 
     123       imgpkg=http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-darwin-10.5.tar.gz 
    101124       else 
    102        echo "Getting imagemagick built on Mac Leopard" 
     125       echo "Getting imagemagick built for El Capitan 10.11 (15.6.0) that's compatible with Mountain Lion 10.8 (kernel v 12.6.0) and onwards" 
    103126       fi 
    104127 
    105128       pushd ext 
    106129       curl $imgpkg > imagemagick.tar.gz 
    107        tar -xvzf imagemagick.tar.gz 
     130       tar -xzf imagemagick.tar.gz 
     131       rm -rf ../bin/darwin/imagemagick 
    108132       mv imagemagick/darwin ../bin/darwin/imagemagick 
    109133       popd 
     
    115139       echo "Getting 64 bit imagemagick precompiled binary" 
    116140       wget http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-linux-x64.tar.gz 
    117        tar -xvzf imagemagick-linux-x64.tar.gz 
     141       tar -xzf imagemagick-linux-x64.tar.gz 
    118142       else 
    119143       echo "Getting 32 bit imagemagick precompiled binary" 
    120144       wget http://trac.greenstone.org/export/head/gs2-extensions/imagemagick/trunk/imagemagick-linux.tar.gz 
    121        tar -xvzf imagemagick-linux.tar.gz 
     145       tar -xzf imagemagick-linux.tar.gz 
    122146       fi 
    123  
     147  
     148       rm -rf ../bin/linux/imagemagick 
    124149       mv imagemagick/linux ../bin/linux/imagemagick 
    125150       popd