28 lines
561 B
Bash
Executable File
28 lines
561 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Load configs
|
|
CONFIG_FILE=/mnt/data/hassos.json
|
|
|
|
CLI="$(jq --raw-output '.cli' ${CONFIG_FILE})"
|
|
DOCKER_ARGS="$(jq --raw-output '.cli_args // empty' ${CONFIG_FILE})"
|
|
APPARMOR="$(jq --raw-output '.cli_apparmor // "docker-default"' ${CONFIG_FILE})"
|
|
|
|
CLI_DATA=/mnt/data/cli
|
|
mkdir -p ${CLI_DATA}
|
|
|
|
# Run CLI
|
|
docker run \
|
|
--rm -ti --init \
|
|
--security-opt apparmor="${APPARMOR}" \
|
|
-v ${CLI_DATA}:/data \
|
|
-v /etc/machine-id:/etc/machine-id:ro \
|
|
$DOCKER_ARGS \
|
|
${CLI}
|
|
|
|
# Jump to root shell
|
|
if [ $? -eq 10 ]; then
|
|
/bin/ash
|
|
fi
|
|
|
|
exit
|