33 lines
504 B
Bash
Executable File
33 lines
504 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Load configs
|
|
CONFIG_FILE=/mnt/data/supervisor.json
|
|
|
|
CLI="$(jq --raw-output '.cli' $CONFIG_FILE)"
|
|
DOCKER_ARGS="$(jq --raw-output '.cli_args // empty' $CONFIG_FILE)"
|
|
CLI_DATA=/mnt/data/cli
|
|
|
|
##
|
|
# Main program
|
|
run_cli() {
|
|
# Run CLI
|
|
docker run --name cli \
|
|
--rm -ti \
|
|
-v $CLI_DATA:/data \
|
|
$DOCKER_ARGS \
|
|
$CLI
|
|
|
|
# Jump to root shell
|
|
if [ $? -eq 10 ]; then
|
|
sh
|
|
fi
|
|
}
|
|
|
|
##
|
|
# Run endless CLI
|
|
mkdir -p $CLI_DATA
|
|
|
|
while true; do
|
|
run_cli
|
|
done
|