Created
January 13, 2017 15:43
-
-
Save gadomski/44783981576a3de589a206deb319b79a to your computer and use it in GitHub Desktop.
Using a docker image to run `pdal translate` without having to specify volume paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -e | |
docker_image=gadomski/magic-bucket | |
realpath() { | |
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" | |
} | |
if [[ ! -e $1 ]]; then | |
echo "ERROR: infile $1 does not exist" | |
exit 1 | |
fi | |
infile=`realpath "$1"` | |
volume1=`dirname "$infile"` | |
infilename="${infile##*/}" | |
shift | |
if [[ -z $1 ]]; then | |
echo "ERROR: outfile $1 is empty" | |
exit 1 | |
fi | |
outfile=`realpath "$1"` | |
volume2=`dirname "$outfile"` | |
outfilename="${outfile##*/}" | |
shift | |
docker run --rm -v $volume1:/volume1 -v $volume2:/volume2 $docker_image pdal translate /volume1/$infilename /volume2/$outfilename $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment