From 9f75591c8a56ba7ec1ea20cfe16dd10a83c65503 Mon Sep 17 00:00:00 2001 From: Sébastien Luttringer Date: Mon, 12 Mar 2012 22:50:42 +0100 Subject: Remove NEED_ROOT crap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch revert patch 042d197b4d989ec64. NEED_ROOT was introduced to fix bug FS#24095. But in fact it doesn't solve it because nobody use it. The idea was to allow initscripts developper to have a check runned by every scripts which tell if scripts need to be run as root (most of them) or not (and the script check itself which part of him have to be run as root). All this to display a cute error message. I think this complexity is superfluous and let part of initscript will fail if rights are not enough. I must confess that we should have marked this bug as wontfix rather than do that. Signed-off-by: Sébastien Luttringer --- functions | 10 ---------- rc.d | 1 - 2 files changed, 11 deletions(-) diff --git a/functions b/functions index a3c2660..25861d0 100644 --- a/functions +++ b/functions @@ -656,15 +656,5 @@ for f in /etc/rc.d/functions.d/*; do [[ -e $f ]] && . "$f" done -# Exit current shell if user is not root -need_root() { - (( EUID )) && printf 'You need to be root.\n' && exit 1 -} - -# Quit script if it's not running by root -# This can be disabled in scripts sourcing functions by setting NEED_ROOT=0 -# A local call to need_root can be done to ensure part of script need root privilege -(( NEED_ROOT )) && need_root - # End of file # vim: set ts=2 sw=2 noet: diff --git a/rc.d b/rc.d index 115dc05..0cfbdaf 100755 --- a/rc.d +++ b/rc.d @@ -1,6 +1,5 @@ #!/bin/bash -NEED_ROOT=0 # this script can be run without be root . /etc/rc.conf . /etc/rc.d/functions -- cgit v1.2.3-54-g00ecf