[Devel] [PATCH] Better detection of used distribution in OpenVZ initscript.

Maik Broemme mbroemme at plusserver.de
Wed Mar 22 14:13:39 PST 2006


Hi,

attached is a diff which fixes the distribution detection on my LFS
(Linuxfromscratch) system, also i guess it is more accurate now. :)

Original version:

root at bart:/etc/rc.d/init.d# /etc/rc.d/init.d/vz start
Starting OpenVZ: /etc/rc.d/init.d/vz: line 94: echo_success: command not found
Bringing up interface venet0: /etc/rc.d/init.d/vz: line 94: echo_success: command not found
Configuring interface venet0: net.ipv4.conf.venet0.send_redirects = 0
/etc/rc.d/init.d/vz: line 94: echo_success: command not found
root at bart:/etc/rc.d/init.d#

Modified version:

root at bart:/etc/rc.d/init.d# /etc/rc.d/init.d/vz start
Starting OpenVZ: 
Bringing up interface venet0: 
Configuring interface venet0: net.ipv4.conf.venet0.send_redirects = 0

root at bart:/etc/rc.d/init.d#

I guess the DISTR variable should only be set if we are really working
under that distribution. For example: On my LFS system i have
`/etc/init.d/functions' but not `/etc/redhat-release' but this file every
RedHat based distribution includes.

--Maik
-------------- next part --------------
--- vz.orig	2006-03-22 22:56:22.553944500 +0100
+++ vz	2006-03-22 23:11:31.474748500 +0100
@@ -52,11 +52,15 @@
 
 # Source function library.
 if [ -r /etc/init.d/functions ]; then
-	DISTR=redhat
 	source /etc/init.d/functions
+	if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ]; then
+		DISTR=redhat
+	fi
 elif [ -r /etc/rc.status ]; then
-	DISTR=suse
 	source /etc/rc.status
+	if [ -r /etc/SuSE-release ]; then
+		DISTR=suse
+	fi
 else
 	rc_done='^[[71G done'
 	rc_failed='^[[71Gfailed'


More information about the Devel mailing list