From: Carsten Schlote <c.schl...@konzeptpark.de>

- Added  visudo and configuration options for default and ENV editor.
- Added install_* for visudo
- Fixed install rights
- Removed __ from kconfig options and use better names for them.

Signed-off-by: Carsten Schlote <c.schl...@konzeptpark.de>
---
 rules/sudo.in   |   24 ++++++++++++++++++++++--
 rules/sudo.make |   25 +++++++++++++++++++------
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/rules/sudo.in b/rules/sudo.in
index 1e9033c..4540dfa 100644
--- a/rules/sudo.in
+++ b/rules/sudo.in
@@ -11,16 +11,36 @@ menuconfig SUDO
 
 if SUDO
 
-config SUDO__SENDMAIL
+config SUDO_USE_SENDMAIL
        bool
        # FIXME: sendmail support is buggy and searches for
        # /sbin/sendmail on the host
        #prompt "sendmail support"
 
-config SUDO__ETC_SUDOERS
+config SUDO_INSTALL_ETC_SUDOERS
        bool "Install sudoers file into /etc"
        default y
        help
          Installs /etc/sudoers from a selectable source
 
+config SUDO_INSTALL_VISUDO
+       bool "Install visudo to edit /etc/sudoers"
+       help
+         Installs visudo to edit /etc/sudoers.
+
+if SUDO_INSTALL_VISUDO
+
+config SUDO_DEFAULT_EDITOR
+       string "visudo default editor"
+       default "/bin/vi"
+       help
+         Default editor for visudo
+
+config SUDO_USE_ENV_EDITOR
+       bool "Use EDITOR env for visudo"
+       help
+         Uses editor from EDITOR env for visudo
+
+endif
+
 endif
diff --git a/rules/sudo.make b/rules/sudo.make
index fe59d43..32e3a7f 100644
--- a/rules/sudo.make
+++ b/rules/sudo.make
@@ -61,12 +61,22 @@ SUDO_AUTOCONF = \
        --with-ignore-dot \
        --without-pam
 
-ifdef PTXCONF_SUDO__SENDMAIL
+ifdef PTXCONF_SUDO_USE_SENDMAIL
 SUDO_AUTOCONF += --with-sendmail
 else
 SUDO_AUTOCONF += --without-sendmail
 endif
 
+ifdef PTXCONF_SUDO_DEFAULT_EDITOR
+SUDO_AUTOCONF += --with-editor=$(PTXCONF_SUDO_DEFAULT_EDITOR)
+endif
+
+ifdef PTXCONF_SUDO_USE_ENV_EDITOR
+SUDO_AUTOCONF += --with-env-editor
+else
+SUDO_AUTOCONF += --without-env-editor
+endif
+
 #  --disable-root-mailer   Don't run the mailer as root, run as the user
 #  --disable-setreuid      Don't try to use the setreuid() function
 #  --disable-setresuid     Don't try to use the setresuid() function
@@ -131,17 +141,20 @@ $(STATEDIR)/sudo.targetinstall:
        @$(call install_fixup, sudo,DEPENDS,)
        @$(call install_fixup, sudo,DESCRIPTION,missing)
 
-       @$(call install_copy, sudo, 0, 0, 7755, -, /usr/bin/sudo)
+       @$(call install_copy, sudo, 0, 0, 7711, -, /usr/bin/sudo)
        @$(call install_link, sudo, sudo, /usr/bin/sudoedit)
 
-       @$(call install_copy, sudo, 0, 0, 0755, -, \
-               /usr/libexec/sudo_noexec.so)
+       @$(call install_copy, sudo, 0, 0, 0644, -, /usr/libexec/sudo_noexec.so)
 
-ifdef PTXCONF_SUDO__ETC_SUDOERS
+ifdef PTXCONF_SUDO_INSTALL_ETC_SUDOERS
        @$(call install_alternative, sudo, 0, 0, 0440, /etc/sudoers, n)
 endif
-       @$(call install_finish, sudo)
 
+ifdef PTXCONF_SUDO_INSTALL_VISUDO
+       @$(call install_copy, sudo, 0, 0, 711, -, /usr/sbin/visudo)
+endif
+
+       @$(call install_finish, sudo)
        @$(call touch)
 
 # vim: syntax=make
-- 
1.6.6.1


-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to