Make editor used for 'virsh edit' configurable

Debian wants to use 'sensible-editor' instead of vi other distros might
want to use other defaults. This avoids distro specific patches.
This commit is contained in:
Guido Günther 2014-09-28 10:34:03 +02:00
parent 4882618ed1
commit adac88c347
2 changed files with 10 additions and 1 deletions

View File

@ -2773,6 +2773,14 @@ test "x$lv_cv_static_analysis" = xyes && t=1
AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
[Define to 1 when performing static analysis.])
AC_ARG_WITH([default-editor],
[AS_HELP_STRING([--with-default-editor],
[Editor to use for interactive commands
@<:@default=vi@:>@])],
[DEFAULT_EDITOR=${withval}],
[DEFAULT_EDITOR=vi])
AC_DEFINE_UNQUOTED([DEFAULT_EDITOR], ["$DEFAULT_EDITOR"], [Default editor to use])
# Some GNULIB base64 symbols clash with a kerberos library
AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
@ -2973,6 +2981,7 @@ AC_MSG_NOTICE([ numad: $with_numad])
AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE])
AC_MSG_NOTICE([ Init script: $with_init_script])
AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files])
AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
AC_MSG_NOTICE([])

View File

@ -785,7 +785,7 @@ vshEditFile(vshControl *ctl, const char *filename)
if (!editor)
editor = virGetEnvBlockSUID("EDITOR");
if (!editor)
editor = "vi"; /* could be cruel & default to ed(1) here */
editor = DEFAULT_EDITOR;
/* Check that filename doesn't contain shell meta-characters, and
* if it does, refuse to run. Follow the Unix conventions for