On 2013/10/30 12:24, David Coppa wrote: > On Wed, 30 Oct 2013, Stuart Henderson wrote: > > > On 2013/10/30 11:50, Robert Peichaer wrote: > > > (comments about slim.rc shell style in my previous mail) > > > > I didn't see that (off-list?) but there's no need to call out to /bin/expr, > > we can use "i=$((i+1))". > > New diff, after feedback from rpe@
Ah, just realised something: that's fine for VT arches... > If you're on an arch which doesn't handle virtual terminals (like > -macppc, sparc, sparc64, TGA-based alpha, hp300 or vax), you will have to > +sparc, sparc64, TGA-based alpha, hp300 or vax), you will have to > explicitely set getty off on ttyC0 in /etc/ttys to avoid input > conflicts: ...but for those others, the pgrep loop isn't going to work very well. > > Index: pkg/slim.rc > =================================================================== > RCS file: /cvs/ports/x11/slim/pkg/slim.rc,v > retrieving revision 1.3 > diff -u -p -u -p -r1.3 slim.rc > --- pkg/slim.rc 17 Dec 2011 22:01:14 -0000 1.3 > +++ pkg/slim.rc 30 Oct 2013 11:24:01 -0000 > @@ -9,7 +9,14 @@ daemon="${TRUEPREFIX}/bin/slim -d" > rc_reload=NO > > rc_start() { > - (sleep 5; ${rcexec} "${daemon} ${daemon_flags}")& > + ( i=0 > + while [ $i -le 10 ]; do > + pgrep -qf "^/usr/libexec/getty " && break > + sleep 1 > + i=$((i+1)) > + done > + [ $i -gt 10 ] && return 1 > + ${rcexec} "${daemon} ${daemon_flags}" ) & > } > > rc_cmd $1