summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <ahferroin7@gmail.com>2018-11-02 14:28:44 -0400
committerCosta Tsaousis <costa@tsaousis.gr>2018-11-02 20:28:44 +0200
commit06b7c5026953a1808c9b8617b9b6d3fe6a75244e (patch)
treedd90479937806e043566da2fbc6ecbad1acc607d /system
parent6342d7af13e430fee8520a99fac23fb121746fb3 (diff)
edit-config: Better support for custom editors. (#4551)
* edit-config: Better support for custom editors. Some systems (Debian for example) don't use the `$EDITOR` environment variable to specify the preferred default editor. On most such systems, there is instead a symbolic link (or a shell script) called `editor` located somewhere in `$PATH` which will invoke the appropriate command. This updates the `edit-config` script to use this command if present in preference to just invoking `vi` as the editor. * Add missing quotes.
Diffstat (limited to 'system')
-rwxr-xr-xsystem/edit-config.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/system/edit-config.in b/system/edit-config.in
index 1b86549fa4..abfd5a454f 100755
--- a/system/edit-config.in
+++ b/system/edit-config.in
@@ -4,7 +4,12 @@
file="${1}"
-EDITOR="${EDITOR-vi}"
+if [ "$(command -v editor)" ] ; then
+ EDITOR="${EDITOR-editor}"
+else
+ EDITOR="${EDITOR-vi}"
+fi
+
[ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="@configdir_POST@"
[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"