Bug 3612 - sysv init scripts don't take the consistent format.
Summary: sysv init scripts don't take the consistent format.
Status: RESOLVED NOTABUG
Alias: None
Product: System Startup
Classification: Runtime
Component: system-startup (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.4 M4
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on: 3611
Blocks:
  Show dependency tree
 
Reported: 2012-12-17 06:26 UTC by Chen Qi
Modified: 2013-02-27 03:27 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chen Qi 2012-12-17 06:26:34 UTC
Init scripts in yocto don't take the consistent format. Some have do_start(), do_stop() in them, others don't. In particular, the 'rc' program invokes these boot scripts in different ways according to their suffixes. See the code snippet below.
startup() {
  # Handle verbosity
  [ "$VERBOSE" = very ] && echo "INIT: Running $@..."

  case "$1" in
        *.sh)
                 # Source shell script for speed.
                (
                        trap - INT QUIT TSTP
                        scriptname=$1
                        shift
                        . $scriptname
                )
                ;;
        *)
                "$@"
                ;;
  esac
  startup_progress
}

This is weird and inappropriate. In newer version of these sysvinit scripts, this problem has been fixed. So I think we should fix it too.

We may need a directory, e.g., /lib/init/ to keep all wrapper functions, hook functions and aux functions. We should not put these functions under /init.d because in essence, they are not init scripts or daemons, they only provide some functionalities that those initscripts may need.

For what's its worth, here's some guidelines about sysv style boot scritps stated in boot(7).
For each managed service (mail, nfs server, cron, etc.) there is a single startup script located in a specific directory (/etc/init.d in most versions of Linux). Each of these scripts accepts as a single argument the word "start" -- causing it to start the service, or the word "stop" -- causing it to stop the service. The script may optionally accept other "convenience" parameters (e.g: "restart", to stop and then start, "status" do display the service status). Running the script without parameters displays the possible arguments.
Comment 1 Chen Qi 2012-12-17 06:28:03 UTC
I'd like to mark this bug to be related to bug#3611 and bug#3435 as they all involve sysv init scripts optimization.
Comment 2 Chen Qi 2013-01-10 02:54:47 UTC
I changed to the milestone to 1.4M3 because it turned out that this bug should be solved as soon as possible.

Take hwclock.sh as an example.
Although there are symlinks in /etc/rc[2345].d/ like 'Sxxhwclock.sh -> ../init.d/hwclock.sh', they actually have no real effects! And the reason is just because they end up with '.sh'.
Comment 3 Chen Qi 2013-02-27 03:27:43 UTC
I made a mistake and there's no such bug.
Sorry for that.

Mark this bug as RESOLVED/NOTABUG.