| Summary: | sysv init scripts don't take the consistent format. | ||
|---|---|---|---|
| Product: | [Runtime] System Startup | Reporter: | Chen Qi <Qi.Chen> |
| Component: | system-startup | Assignee: | Chen Qi <Qi.Chen> |
| Status: | RESOLVED NOTABUG | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium | CC: | kevin.tian, liezhi.yang, sgw, yi.zhao, zhenfeng.zhao |
| Version: | 1.4 | ||
| Target Milestone: | 1.4 M4 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | --- | |
| Bug Depends on: | 3611 | ||
| Bug Blocks: | |||
I'd like to mark this bug to be related to bug#3611 and bug#3435 as they all involve sysv init scripts optimization. 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'. I made a mistake and there's no such bug. Sorry for that. Mark this bug as RESOLVED/NOTABUG. |
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.