Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 361802 Details for
Bug 489274
sys-apps/openrc - Rewritten local initscript for verbose output and error checking
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Rewritten local initscript
Verbose-local-initscript.patch (text/plain), 4.55 KB, created by
Thomas Deutschmann (RETIRED)
on 2013-10-24 16:38:59 UTC
(
hide
)
Description:
Rewritten local initscript
Filename:
MIME Type:
Creator:
Thomas Deutschmann (RETIRED)
Created:
2013-10-24 16:38:59 UTC
Size:
4.55 KB
patch
obsolete
>--- init.d/local.in.old 2013-10-24 17:04:46.164708271 +0200 >+++ init.d/local.in 2013-10-24 17:10:52.092103715 +0200 >@@ -1,5 +1,5 @@ > #!@SBINDIR@/runscript >-# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> >+# Copyright 1999-2013 Gentoo Foundation > # Released under the 2-clause BSD license. > > description="Executes user programs in @SYSCONFDIR@/local.d" >@@ -12,40 +12,109 @@ > > start() > { >- einfo "Starting local" >+ local executable= has_executables=0 has_errors=0 > >- local file >- for file in @SYSCONFDIR@/local.d/*.start ; do >- [ -x "$file" ] && "$file" >+ ebegin "Starting local" >+ eindent >+ >+ for executable in @SYSCONFDIR@/local.d/*.start; do >+ if [ -x "${executable}" ]; then >+ has_executables=1 >+ vebegin "Executing \"${executable}\"" >+ "${executable}" 2>&1 >/dev/null >+ if [ $? -ne 0 ]; then >+ has_errors=1 >+ eend 1 "Execution of \"${executable}\" failed." >+ else >+ veend 0 >+ fi >+ fi > done > >+ eoutdent >+ > if type local_start >/dev/null 2>&1; then >- ewarn "@SYSCONFDIR@/conf.d/local should be removed." >+ ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." > ewarn "Please move the code from the local_start function" >- ewarn "to scripts with an .start extension" >- ewarn "in @SYSCONFDIR@/local.d" >+ ewarn "to executable scripts with an .start extension" >+ ewarn "in \"@SYSCONFDIR@/local.d\"" > local_start > fi > >- eend 0 >+ if [ ${has_errors} -eq 0 ] && yesno "${rc_verbose:-${RC_VERBOSE}}"; then >+ if [ ${has_executables} -eq 0 ]; then >+ # We are using ewarn instead of vewarn, because we are >+ # checking for verbose mode in the surrounding if clause. >+ # We are doing that, because this way, the if clause >+ # looks cleaner. >+ ewarn "No executable \"@SYSCONFDIR@/local.d/*.start\" file found!" >+ ewarn "This might be OK if you don't want to execute a file on local start" >+ ewarn "or may indicate an configuration error." >+ fi >+ else >+ # We don't call eend when we don't run in verbose mode, because >+ # the last eend would overwrite our previous veend. >+ eend ${has_errors} "One or more executable \"@SYSCONFDIR@/local.d/*.start\" file(s) failed with a non-zero exit status!" >+ fi >+ >+ # We have to end with a zero exit code, because a failed execution >+ # of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in >+ # marking the local service as failed. Otherwise we are unable to >+ # execute any executable @SYSCONFDIR@/local.d/*.stop file, because a failed >+ # marked service cannot be stopped (and the stop function would >+ # actually call the executable @SYSCONFDIR@/local.d/*.stop file(s)). >+ return 0 > } > > stop() > { >- einfo "Stopping local" >+ local executable= has_executables=0 has_errors=0 >+ >+ ebegin "Stopping local" >+ eindent > >- local file >- for file in @SYSCONFDIR@/local.d/*.stop; do >- [ -x "$file" ] && "$file" >+ for executable in @SYSCONFDIR@/local.d/*.stop; do >+ if [ -x "${executable}" ]; then >+ has_executables=1 >+ vebegin "Executing \"${executable}\"" >+ "${executable}" 2>&1 >/dev/null >+ if [ $? -ne 0 ]; then >+ has_errors=1 >+ eend 1 "Execution of \"${executable}\" failed." >+ else >+ veend 0 >+ fi >+ fi > done > >+ eoutdent >+ > if type local_start >/dev/null 2>&1; then >- ewarn "@SYSCONFDIR@/conf.d/local should be removed." >- ewarn "Please move the code from the local_stop function" >- ewarn "to scripts with an .stop extension" >- ewarn "in @SYSCONFDIR@/local.d" >- local_stop >+ ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." >+ ewarn "Please move the code from the local_start function" >+ ewarn "to executable scripts with an .stop extension" >+ ewarn "in \"@SYSCONFDIR@/local.d\"" >+ local_start >+ fi >+ >+ if [ ${has_errors} -eq 0 ] && yesno "${rc_verbose:-${RC_VERBOSE}}"; then >+ if [ ${has_executables} -eq 0 ]; then >+ # We are using ewarn instead of vewarn, because we are >+ # checking for verbose mode in the surrounding if clause. >+ # We are doing that, because this way, the if clause >+ # looks cleaner. >+ ewarn "No executable \"@SYSCONFDIR@/local.d/*.stop\" file found!" >+ ewarn "This might be OK if you don't want to execute a file on local stop" >+ ewarn "or may indicate an configuration error." >+ fi >+ else >+ # We don't call eend when we don't run in verbose mode, because >+ # the last eend would overwrite our previous veend. >+ eend ${has_errors} "One or more executable \"@SYSCONFDIR@/local.d/*.stop\" file(s) failed with a non-zero exit status!" > fi > >- eend 0 >+ # An executable @SYSCONFDIR@/local.d/*.stop file which failed with a >+ # non-zero exit status is not a reason to mark this service >+ # as failed, therefore we have to end with a zero exit code. >+ return 0 > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 489274
:
361802
|
362126