Re: some issues with the init scripts and other stuff as well... :)
On Thu, Aug 28, 2008 at 12:29:07AM +0100, chgans wrote:
> * mountoverflowtmp: df -kP | grep -v Filesystem => df -k | grep -v
> Filesystem
> Not sure about the impact of not using -P (posix compatibility)
> The only difference with -P on a debian machine is the header of the
> output, which is ignore by the script via the grep -v
doesn't make too much sense it seems.
Nevertheless: http://busybox.net/lists/busybox/2008-August/032814.html
> TESTED: OK
>
> * from ? that call usr/bin/savelog
> /usr/bin/savelog: line 160: getopts: not found
>
>
> /usr/bin/savelog: shift: line 162: Illegal number: -1
It pretends /bin/sh but that script certainly tries to use a number of
non sh stuff.
$ grep ASH_GETOPTS .config
# CONFIG_ASH_GETOPTS is not set
looks like even the $OPTIND stuff should work if
CONFIG_FEATURE_SH_IS_ASH=y
There is getopt, as you certainly know:
$ ./busybox getopt --help
BusyBox v1.13.0.svn (2008-08-28 18:55:52 CEST) multi-call binary
Usage: getopt [OPTIONS]...
Parse command options
-a,--alternative Allow long options starting with single -
-l,--longoptions=longopts Long options to be recognized
-n,--name=progname The name under which errors are reported
-o,--options=optstring Short options to be recognized
-q,--quiet Disable error reporting by getopt(3)
-Q,--quiet-output No normal output
-s,--shell=shell Set shell quoting conventions
-T,--test Test for getopt(1) version
-u,--unquoted Don't quote the output
> * from mount{all|nfs}-bootclean.sh:
> from root/lib/init/bootclean.sh
> Cleaning /var/run...find: unrecognized: -xtype
> replace -xtype by -type ?
> TESTED: OK but don't know really the side effects...
we don't have xtype and even the helptext of -xtype is way too complicated
for me to understand when read once ;)
>
> ---
>
> Then i tried to make some changes to update-rc.d, i've attached the
> file, there are some comments in the header about why and how i did that
> (it's just an idea, experimental stuff).
>#!/bin/sh
>#
># Copyright 2008 Hands.com Ltd <phil@hands.com>
># Copyright 2008 Neil Williams <codehelp@debian.org>
>#
># This program is free software; you can redistribute it and/or modify
># it under the terms of the GNU General Public License as published by
># the Free Software Foundation; either version 3 of the License, or
># (at your option) any later version.
>
>#
># As busybox doesn't understand runlevels, here is the way we work:
># - We honnor all start/stop in multi-user runlevel without any
s/honnor/honor/g
># modification
># - All start for system start-up are honnored but with an extra
[snip overly complicated rcS]
fwiw:
http://repo.or.cz/w/buildroot.git?a=blob_plain;f=target/generic/target_busybox_skeleton/etc/inittab;hb=HEAD
http://repo.or.cz/w/buildroot.git?a=blob_plain;f=target/generic/target_busybox_skeleton/etc/init.d/rcS;hb=HEAD
The rcS could be extended to handle the start/stop, something like
(untested)
--- a/target/generic/target_busybox_skeleton/etc/init.d/rcS
+++ b/target/generic/target_busybox_skeleton/etc/init.d/rcS
@@ -4,7 +4,15 @@
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
-for i in /etc/init.d/S??* ;do
+if test "x$1" = "xstop"
+then
+ who="K??*"
+ what="stop"
+else
+ who="S??*"
+ what="start"
+fi
+for i in /etc/init.d/$who ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
@@ -14,13 +22,13 @@ for i in /etc/init.d/S??* ;do
# Source shell script for speed.
(
trap - INT QUIT TSTP
- set start
+ set $what
. $i
)
;;
*)
# No sh extension, so fork subprocess.
- $i start
+ $i $what
;;
esac
done
Reply to: