1 |
On Fri, 2007-03-09 at 07:39 +0000, Roy Marples wrote: |
2 |
> On Thu, 08 Mar 2007 16:00:50 -0800 |
3 |
> Ned Ludd <solar@g.o> wrote: |
4 |
> |
5 |
> > On Thu, 2007-03-08 at 17:00 +0100, Natanael Copa wrote: |
6 |
> > > Hi, |
7 |
> > > |
8 |
> > > Are there anybody more than me that use the gentoo init.d scripts |
9 |
> > > without using bash? |
10 |
> > > |
11 |
> > > Most init.d scripts runs just fine with a small runscript wrapper. |
12 |
> > > A few needs patching to work, typically replacing: |
13 |
> > > |
14 |
> > > [[ expr || expr ]] |
15 |
> > > |
16 |
> > > with: |
17 |
> > > |
18 |
> > > [[ expr ]] || [[ expr ]] |
19 |
> |
20 |
> Well, not many shells support that either. |
21 |
> [ expr -o expr ] |
22 |
> or |
23 |
> [ expr ] || [ expr] |
24 |
> should work across the board. |
25 |
> |
26 |
> > > But sometimes arrays and such are used (very often its easy to work |
27 |
> > > around) |
28 |
> |
29 |
> Yes it's easy to work around. |
30 |
> Infact we had a discussion about this on -dev and posted the below |
31 |
> function |
32 |
> |
33 |
> _get_array() { |
34 |
> if [ -n "${BASH}" ] ; then |
35 |
> case "$(declare -p "$1" 2>/dev/null)" in |
36 |
> "declare -a "*) |
37 |
> echo "set -- \"\${$1[@]}\"" |
38 |
> return |
39 |
> ;; |
40 |
> esac |
41 |
> fi |
42 |
> |
43 |
> echo "eval set -- \"\$$1\"" |
44 |
> } |
45 |
> |
46 |
> eval "$(_get_array "config_${IFVAR}")" |
47 |
> for cmd in "$@" ; do |
48 |
> ... |
49 |
> done |
50 |
> |
51 |
> Which means we can support bash arrays AND a non bash array |
52 |
> config_eth0=( "one" "t w o" "three" ) |
53 |
> and |
54 |
> config_eth0="'one' 't w o' 'three'" |
55 |
> |
56 |
> > > |
57 |
> > > Are there any hope for setting a gentoo policy that says bash |
58 |
> > > specific things should be avoided if possible in init.d scripts? |
59 |
> |
60 |
> There's no such policy. Our policy has always been init scripts should |
61 |
> be parseable by a shell. The shell in question has always been bash |
62 |
> because |
63 |
> 1) baselayout-1 requires it |
64 |
> 2) bash forces itself to be /bin/sh anyway |
65 |
> |
66 |
> The lastest bash in the tree no longer enforces it's /bin/sh - instead |
67 |
> it only creates the link if it does not exist, allowing any shell to be |
68 |
> used. Yay! |
69 |
|
70 |
|
71 |
Sweet ass sweet... |
72 |
|
73 |
I'm sure it will take time to get 99% of the misc remaining bash init |
74 |
scripts converted over as we find them. If we mostly target server stuff |
75 |
for now we will be fine.. |
76 |
|
77 |
> > That is a goal with baselayout-2. I'd be interested if we started a |
78 |
> > tracker bug for such things. I think policy might be a bit far |
79 |
> > reaching at this point. But it's for sure a worthwhile goal. |
80 |
> |
81 |
> baselayout-2 is pure C (except for the init scripts themselves) and is |
82 |
> nearing the final stage of development before it enters the tree. It |
83 |
> currently works with any shell in portage except for zsh and ksh. It |
84 |
> can work with bb provided that some things are disabled. |
85 |
|
86 |
Gimme bugs.. I need #'s if I'm going to work toward solving them. |
87 |
I'd rather not disable vs update bb to conform with what you need. |
88 |
Removing our s-s-d for us is very undesirable as long as we have an |
89 |
alternative to the current bloated s-s-d. So please give us bugs |
90 |
to work towards solving etc.. |
91 |
|
92 |
I think Natanael might also become one of your best testers and bug |
93 |
reporters. He has been very helpful in the past and I'm sure he will |
94 |
continue to be in the future. |
95 |
|
96 |
|
97 |
|
98 |
> |
99 |
> I'm making it a policy that all init scripts on my local machines have |
100 |
> already been changed. Naughty me. I've filed bugs for a few other |
101 |
> scripts too. |
102 |
|
103 |
Natanael please search bugzilla for scripts you have noticed in which |
104 |
Roy has not already filed bugs. If no bug exists please file one |
105 |
(patches attached if you can) |
106 |
|
107 |
|
108 |
> So for a desktop it should work off the bat. Not sure if |
109 |
> I'll put baselayout-2 on my server right now as it's headless and it's a |
110 |
> PITA to get a head to it. |
111 |
> |
112 |
> Once baselayout-2 hits portage then we can have a tracker bug. |
113 |
> |
114 |
> Thanks |
115 |
> |
116 |
> Roy |
117 |
> |
118 |
-- |
119 |
Ned Ludd <solar@g.o> |
120 |
Gentoo Linux |
121 |
|
122 |
-- |
123 |
gentoo-embedded@g.o mailing list |