summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Luttringer <seblu@seblu.net>2012-03-12 22:50:42 +0100
committerSébastien Luttringer <seblu@seblu.net>2012-03-13 12:32:42 +0100
commit9f75591c8a56ba7ec1ea20cfe16dd10a83c65503 (patch)
tree0bd6ab03b6ef8e6dad4589ecd55e7f99e58857a9
parent788daea5db4445f02fc156132f00829e1107dc6f (diff)
Remove NEED_ROOT crap
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 <seblu@seblu.net>
-rw-r--r--functions10
-rwxr-xr-xrc.d1
2 files changed, 0 insertions, 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