diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2022-12-06 10:53:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 10:53:30 -0500 |
commit | 56e22c16e8de8ae63f58bca359351e6f10c15af5 (patch) | |
tree | 55e42ee29eb7c6bff3348fc5bb579a45bded1ea5 /packaging | |
parent | 6f2f84936b70503b8b8effa271e2a5ecaa11dce3 (diff) |
Cleanly reimplement system/edit-config.in. (#13702)
* Cleanly reimplement system/edit-config.in
- Added support for pulling config files from Docker containers.
- Added auto-detection for Docker containers.
- Use directory the script is in for target directory for config files
instead of templating it in at build time.
- Prefix error messages with `ERROR:`.
- Robustly check for a valid editor _before_ invoking it.
- Add support for actual command-line options, including a proper
`--help` option.
- Use prefix matching of absolute paths to determine file validity
instead of blindly excluding certain path types.
- If editing a non-existing file we do not provide a stock copy of,
create an empty file instead of throwing an error.
- Make the whole script properly modular.
* Improve robustness of container autodetection.
Instead of relying on the lack of certain directories on a host system,
use some relatively standard checks to determine if we appear to be
running in a container.
* Auto-detect stock config paths at runtinme instead of hard-coding them at build time.
THis will simplify testing of the script, as well as making it a bit
more resilient to users moving things around.
* Add an option to list known config files.
* Fix container environment check to not require root.
* Fix help output.
* Fix path prefix check.
* Fix file path handling.
* Use correct variable when editing files.
* Use correct path for `env`.
* Source profile before running `set -e`.
To prevent questionablly written profiles from causing the script to
exit.
* Produce columnar output when listing valid files.
* Fix copy check.
* Fix build issues.
* fix build issues
* formatting
Co-authored-by: ilyam8 <ilya@netdata.cloud>
Diffstat (limited to 'packaging')
-rwxr-xr-x | packaging/docker/run.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index 1e001256c2..244f92c421 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -49,6 +49,12 @@ if mountpoint -q /etc/netdata && [ -z "$(ls -A /etc/netdata)" ]; then cp -a /etc/netdata.stock/. /etc/netdata fi +if mountpoint -q /etc/netdata; then + hostname > /etc/netdata/.container-hostname +else + rm -f /etc/netdata/.container-hostname +fi + if [ -n "${NETDATA_CLAIM_URL}" ] && [ -n "${NETDATA_CLAIM_TOKEN}" ] && [ ! -f /var/lib/netdata/cloud.d/claimed_id ]; then # shellcheck disable=SC2086 /usr/sbin/netdata-claim.sh -token="${NETDATA_CLAIM_TOKEN}" \ |