| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
##### |
| 4 |
# This script provides a sub-command type access to the various davix binaries |
| 5 |
# installed in /usr/local/bin. Instead of calling /usr/local/bin/davix-ls, the |
| 6 |
# script makes it possible to call /usr/local/bin/davix.sh ls with exactly the |
| 7 |
# same set of options. The script is tuned to be used as the entrypoint of the |
| 8 |
# Dockerfile, allowing to run commands such as the following, which is slightly |
| 9 |
# more convenient: docker run -it --rm ... davix ls ... |
| 10 |
##### |
| 11 |
|
| 12 |
cmd=$1 |
| 13 |
shift |
| 14 |
|
| 15 |
if [ -x "/usr/local/bin/davix-$cmd" ]; then |
| 16 |
exec /usr/local/bin/davix-$cmd $@ |
| 17 |
else |
| 18 |
echo "$cmd is an unknown subcommand!" >& 2 |
| 19 |
commands= |
| 20 |
cd /usr/local/bin |
| 21 |
for binary in $(ls -1 davix-*); do |
| 22 |
commands="$commands ${binary#*-}" |
| 23 |
done |
| 24 |
echo "Should be one of: $commands" >& 2 |
| 25 |
fi |