Bug 489757 - (wildejoe) init scripts are not LSB compliant, fail on openSUSE/SLES
init scripts are not LSB compliant, fail on openSUSE/SLES
Status: NEW
Product: penrose
Classification: Retired
Component: Installation (Show other bugs)
2.0
All Linux
low Severity medium
: ---
: ---
Assigned To: Jim Whitehurst
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-11 13:59 EDT by Joe Wilde
Modified: 2016-01-28 17:01 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joe Wilde 2009-03-11 13:59:45 EDT
Description of problem:
vd-server and vd-monitor scripts are not LSB compliant, so using them across various distro's can be painful.

Version-Release number of selected component (if applicable):
2.0

How reproducible:
Attempt to use scripts on openSUSE or SLES and get errors because of references to /etc/init.d/functions and /etc/sysconfig/network

Steps to Reproduce:
1. Attempt to use scripts on openSUSE or SLES
  
Actual results:
get errors because of references to /etc/init.d/functions and /etc/sysconfig/network

Expected results:
expect use of LSB init functions and LSB oriented dependency checks

Additional info:
a patch that could partially address the issue:
9a10,21
> # following block is to support LSB method of handling init scripts
> # $remote_fs is used since /opt may be mounted from a remote fs and not covered by $local_fs
> ### BEGIN INIT INFO
> # Provides:          vd-server
> # Required-Start:    $remote_fs $network $syslog
> # Required-Stop:     $remote_fs $network $syslog
> # Default-Start:     3 4 5
> # Default-Stop:      0 1 2 6
> # Short-Description: Penrose VD-Server
> # Description:       Penrose Virtual Directory Server
> ### END INIT INFO
> 
11c23,42
< . /etc/init.d/functions
---
> # the following line does not work with LSB standard, added if..fi to accomadate both LSB and old non-LSB
> #. /etc/init.d/functions
> if [ -f /lib/lsb/init-functions ]; then
>   . /lib/lsb/init-functions
>   alias START_DAEMON=start_daemon
>   alias STATUS=MyStatus
>   alias LOG_SUCCESS=log_success_msg
>   alias LOG_FAILURE=log_failure_msg
>   alias LOG_WARNING=log_warning_msg
> elif [ -f /etc/init.d/functions ]; then
>   . /etc/init.d/functions
>   alias START_DAEMON=daemon
>   alias STATUS=status
>   alias LOG_SUCCESS=success
>   alias LOG_FAILURE=failure
>   alias LOG_WARNING=passed
> else
>   echo "Error: your platform is not supported by $0" > /dev/stderr
>   exit 1
> fi
37c68
<         daemon --user $PENROSE_USER $PENROSE_SCRIPT start
---
>         $START_DAEMON --user $PENROSE_USER $PENROSE_SCRIPT start
47c78
<         daemon --user $PENROSE_USER $PENROSE_SCRIPT stop
---
>         $START_DAEMON --user $PENROSE_USER $PENROSE_SCRIPT stop
63c94
<         status $PENROSE_PROG
---
>         $STATUS $PENROSE_PROG
72a104,109
>     force-reload)
> 	if [ -f /var/lock/subsys/vd-server ] ; then
>   	  	killproc $PENROSE_PROG -HUP
> 		RETVAL=$?
> 	fi
> 	;;
Comment 1 Joe Wilde 2009-03-11 19:58:31 EDT
Turns out my potential patch only partially worked, and only under a wacky shell.

The following should work much better.
It's rough since LSB's start_daemon is not expecting the script to spin off a new process (exec java), so its return code is 7 (program exited) not 0.
This also doesn't fully meet all LSB specs, but it should work:

# diff /opt/vd-server-2.0/etc/init.d/vd-server /etc/init.d/vd-server
9a10,21
> # following block is to support LSB method of handling init scripts
> # $remote_fs is used since /opt may be mounted from a remote fs and not covered by $local_fs
> ### BEGIN INIT INFO
> # Provides:          vd-server
> # Required-Start:    $remote_fs $network $syslog
> # Required-Stop:     $remote_fs $network $syslog
> # Default-Start:     3 4 5
> # Default-Stop:      0 1 2 6
> # Short-Description: Penrose VD-Server
> # Description:       Penrose Virtual Directory Server
> ### END INIT INFO
> 
11c23,36
< . /etc/init.d/functions
---
> # the following line does not work with LSB standard, added if..fi to accommodate both LSB and old non-LSB
> #. /etc/init.d/functions
> if [ -f /lib/lsb/init-functions ] ; then
> 	. /lib/lsb/init-functions
> 	START_DAEMON=start_daemon
> 	DUSEROPT=u
> elif [ -f /etc/init.d/functions ] ; then
> 	. /etc/init.d/functions
> 	START_DAEMON=daemon
> 	DUSEROPT=-user
> else
> 	echo "Error: your platform is not supported by $0" > /dev/stderr
> 	exit 1
> fi
12a38
> # shouldn't have to test this if "Required-Start" condition is adhered to?
14c40
< if [ -r /etc/sysconfig/network ] ; then
---
> if [ -f /etc/sysconfig/network -a -r /etc/sysconfig/network ] ; then
37c63
<         daemon --user $PENROSE_USER $PENROSE_SCRIPT start
---
>         $START_DAEMON -$DUSEROPT $PENROSE_USER $PENROSE_SCRIPT start
40c66
< 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/vd-server
---
> 	[ $RETVAL -eq 0 ] || [ "$START_DAEMON"="start_daemon" -a $RETVAL -eq 7 ] && touch /var/lock/subsys/vd-server
47c73
<         daemon --user $PENROSE_USER $PENROSE_SCRIPT stop
---
>         $START_DAEMON -$DUSEROPT $PENROSE_USER $PENROSE_SCRIPT stop
50c76
<         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/vd-server /var/run/vd-server.args
---
> 	[ $RETVAL -eq 0 ] || [ "$START_DAEMON"="start_daemon" -a $RETVAL -eq 7 ] && rm -f /var/lock/subsys/vd-server /var/run/vd-server.args
53a80,85
> function reload() {
>         # send signal to reload configs.
>     	killproc $PENROSE_PROG -HUP
> 	return $?
> }
> 
63c95
<         status $PENROSE_PROG
---
>         $PENROSE_SCRIPT status
70,71c102,107
<     	killproc $PENROSE_PROG -HUP
< 	RETVAL=$?
---
> 	reload
> 	;;
>     force-reload)
> 	if [ -f /var/lock/subsys/vd-server ] ; then
> 		reload
> 	fi

Note You need to log in before you can comment on or make changes to this bug.