=Added dls to runtipictl + some script refactoring
This commit is contained in:
parent
d728d87a8a
commit
ff5c949f5d
|
@ -7,13 +7,23 @@ jlmkr () {
|
|||
JAIL_UID=${JAIL_UID:-${UID}}
|
||||
|
||||
jlmkr-exec () {
|
||||
local cli="cd ${START_DIR:-/srv/runtipi}; ${1:?Must supply command} "${2:+"$(
|
||||
printf '\"%s\" ' "${@:2}"
|
||||
)"}
|
||||
local set_x=" set -x; pwd; id; "
|
||||
[ -z "$QUIET" ] || set_x=""
|
||||
local cli="cd ${START_DIR:-/srv/runtipi};${set_x} ${1:?Must supply command} "
|
||||
if [ -n "$ROOT_EXEC" ]; then
|
||||
cli="$cli ${*:2}"
|
||||
else
|
||||
cli="$cli "${2:+"$(
|
||||
printf '\"%s\" ' "${@:2}"
|
||||
)"}
|
||||
fi
|
||||
|
||||
if jlmkr exec runtipi true; then
|
||||
[ -n "$QUIET" ] || printf 'jlmkr UID:\t%s\ncli:\t\t%s\n' "${JAIL_UID}" "$cli"
|
||||
jlmkr shell --uid "${JAIL_UID}" runtipi /bin/bash -c "$cli"
|
||||
if [ -n "$ROOT_EXEC" ]; then
|
||||
jlmkr exec runtipi /bin/bash <<<"$cli"
|
||||
else
|
||||
jlmkr shell --uid "${JAIL_UID}" runtipi /bin/bash -c "$cli"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: ${_ERROR_MGS:-"Please check if runtipi jail has started! Have you tried 'full-start'?"}" >&2
|
||||
exit -1
|
||||
|
@ -41,6 +51,17 @@ runtipi-app-docker-compose() {
|
|||
${LOCAL_YML} ${@:2}
|
||||
}
|
||||
|
||||
dls() {
|
||||
# Default docker ps format is:
|
||||
# jlmkr-exec docker ps --format "table {{ .ID }}\t{{ .Image }}\t{{ .Command }}\t{{ .Created }}\t{{ .Status }}\t{{ .Ports }}\t{{ .Names }}"
|
||||
|
||||
local base='{{.Status}}\t{{.ID}}\t{{.Names}}\t{{.Image}}' #'\t{{.Networks}}\t{{.Ports}}\t{{.Mounts}}'
|
||||
local compose='{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.service"}}'
|
||||
local format="table $compose\t$base"
|
||||
ROOT_EXEC=1 jlmkr-exec \
|
||||
docker "container ls --all --format '$format' | ( sed -u 1q ; sed -Ee 's|^|555|; s|^555runtipi|000runtipi|;' | sort | sed -Ee 's/^[[:digit:]]{3}//' )"
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
cli)
|
||||
runtipi-cli "${@:2}"
|
||||
|
@ -65,6 +86,9 @@ case "${1}" in
|
|||
docker)
|
||||
jlmkr-exec docker "${@:2}"
|
||||
;;
|
||||
dls)
|
||||
dls "${@:2}"
|
||||
;;
|
||||
dcoapp)
|
||||
runtipi-app-docker-compose "${@:2}"
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue