1 |
Excerpts from Mike Frysinger's message of Wed Oct 13 16:13:58 +0200 2010: |
2 |
> On Wednesday, October 13, 2010 04:23:16 Amadeusz Żołnowski wrote: |
3 |
> > Excerpts from Mike Frysinger's message of Tue Oct 12 22:57:11 +0200 2010: |
4 |
> > > On Tuesday, October 12, 2010 16:26:31 Jeroen Roovers wrote: |
5 |
> > > > On Tue, 12 Oct 2010 22:09:06 +0200 Dirkjan Ochtman wrote: |
6 |
> > > > > On Fri, Oct 1, 2010 at 15:07, Peter Volkov wrote: |
7 |
> > > > > > [a very thorough review of the openvpn ebuild] |
8 |
> > > > > |
9 |
> > > > > Thanks for reviewing, I've fixed most of the issues. |
10 |
> > > > > |
11 |
> > > > > >> if [[ -n $(ls /etc/openvpn/*/local.conf 2>/dev/null) ]] ; |
12 |
> > > > > >> |
13 |
> > > > > >> then |
14 |
> > > > > > |
15 |
> > > > > > I'd suggested [ -e /etc/openvpn/*/local.conf ] here, but probably |
16 |
> > > > > > there are better alternatives. Also ${ROOT} is missed here. |
17 |
> > > > > |
18 |
> > > > > I've put ${ROOT} in, are there no better alternatives? I don't think |
19 |
> > > > > anyone mentioned any. |
20 |
> > > > |
21 |
> > > > for foo in ${ROOT}/etc/openvpn/*/local.conf; do |
22 |
> > > > |
23 |
> > > > [ -e ${foo} ] && bar ${foo} |
24 |
> > > > |
25 |
> > > > done |
26 |
> > > > |
27 |
> > > > If no ${ROOT}/etc/openvpn/*/local.conf is found, it returns the exact |
28 |
> > > > string; which doesn't exist so Nothing Happens. |
29 |
> > > |
30 |
> > > i'd say doing a loop is worse than a `ls` hack. and this has quoting |
31 |
> > > problems, but that's ancillary ... |
32 |
> |
33 |
> > What about defining following function? |
34 |
> > |
35 |
> > any_exists() { |
36 |
> > local f |
37 |
> > |
38 |
> > for f; do |
39 |
> > [[ -e $f ]] && return 0 |
40 |
> > done |
41 |
> > |
42 |
> > return 1 |
43 |
> > } |
44 |
> |
45 |
> perhaps if it had a better name and were in a common location (eclass) |
46 |
> -mike |
47 |
|
48 |
So give it a better name. :-) In this case 'ls' shouldn't hurt anybody, |
49 |
but such function solves problem in much more elegant manner - |
50 |
regardless it's definied in an ebuild or eclass. |
51 |
-- |
52 |
Amadeusz Żołnowski |
53 |
|
54 |
PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5 |