-
Notifications
You must be signed in to change notification settings - Fork 2
/
powertop.docker
executable file
·69 lines (56 loc) · 1.58 KB
/
powertop.docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /usr/bin/env bash
set -eu
cd "$( dirname "$( readlink -e "${0}" )" )" || exit 1
# shellcheck disable=SC1091
[ ! -s common/vars.sh ] || . common/vars.sh
# shellcheck disable=SC2034 # Set from common/vars.sh
[[ -n "${__COMMON_VARS_INCLUDED:-}" ]] || {
echo >&2 "FATAL: Inclusion of common defaults failed"
exit 1
}
# shellcheck disable=SC2034
declare IMAGE="none"
# shellcheck disable=SC1091
[ -s common/run.sh ] && . common/run.sh >/dev/null
if (( EUID )); then
die "Please re-run '$( basename "${0}" )' as user 'root'"
fi
declare CATEGORY='sys-power'
declare PN='powertop'
# FIXME: shellcheck wants:
#
# docker_extra_mounts+=( $( add_mount ... ) )
#
# ... to be expressed in the form of:
#
# readarray -O "${#docker_extra_mounts[@]}" -t docker_extra_mounts < <(
# add_mount ...
# )
#
# shellcheck disable=SC2207
{
declare -a docker_extra_mounts=()
docker_extra_mounts+=( $( add_mount --print --no-ro \
'/var/cache/powertop/'
) ) || :
export DOCKER_EXTRA_MOUNTS="${docker_extra_mounts[*]:-}"
unset docker_extra_mounts
}
declare -a docker_cmd_vars=()
docker_cmd_vars=(
--env "LINES=${LINES}"
--env "COLUMNS=${COLUMNS}"
--env "TERM=${TERM}"
)
export DOCKER_CMD_VARS="${docker_cmd_vars[*]:-}"
unset docker_cmd_vars
export DOCKER_INTERACTIVE=1
export DOCKER_PRIVILEGED=1
export NO_BUILD_MOUNTS='no_build_mounts' # ... any value will do
#export DOCKER_ENTRYPOINT='/bin/sh'
_docker_resolve "${CATEGORY}/${PN}" 'service' >/dev/null
image="$( _docker_image_exists )"
export image
#set -o xtrace
_docker_run ${@+"${@}"}
# vi: set colorcolumn=80 syntax=sh: