Hello Michael, On Tue, Jun 06, 2017 at 06:49:08PM +0200, Michael Olbrich wrote: > On Tue, Jun 06, 2017 at 06:25:09PM +0200, Uwe Kleine-König wrote: > > On Tue, Jun 06, 2017 at 06:00:51PM +0200, Michael Olbrich wrote: > > > On Tue, Jun 06, 2017 at 05:28:48PM +0200, Gavin Schenk wrote: > > > > rc-once ist based on systemd offline update mechanism. > > > > https://www.freedesktop.org/software/systemd/man/systemd.offline-updates > > > > > > > > To make it possible to have multiple update services beside rc-once the > > > > script should check where the link /system-update points to. > > > > > > > > rc-once will only run if the link points to etc/rc-once.d or > > > > /etc/rc-once.d. > > > > > > > > Signed-off-by: Gavin Schenk <g.sch...@eckelmann.de> > > > > --- > > > > projectroot/usr/lib/init/rc-once.sh | 5 +++++ > > > > rules/rc-once.in | 3 +++ > > > > 2 files changed, 8 insertions(+) > > > > > > > > diff --git a/projectroot/usr/lib/init/rc-once.sh > > > > b/projectroot/usr/lib/init/rc-once.sh > > > > index 8689a32bc..d225ad5c2 100644 > > > > --- a/projectroot/usr/lib/init/rc-once.sh > > > > +++ b/projectroot/usr/lib/init/rc-once.sh > > > > @@ -6,6 +6,11 @@ STAMP="$DONE_DIR/rc-once" > > > > > > > > run_rc_once() { > > > > failed=0 > > > > + UPDATE_TARGET=$(readlink -f /system-update) > > > > > > This needs quotes in case the link target contains spaces. > > > > I think that's wrong. It only needs quoting when being used: > > > > $ cat test.sh > > #!/bin/sh > > > > tmpdir=$(mktemp -d) > > > > touch "$tmpdir/file with spaces"; > > > > FILE=$(ls $tmpdir) > > > > echo "$FILE" > > > > rm -rf $tmpdir > > > > $ bash test.sh | hexdump -C > > 00000000 66 69 6c 65 20 77 69 74 68 09 73 70 61 63 65 73 |file > > with.spaces| > > 00000010 0a |.| > > 00000011 > > > > That being said, quotes don't hurt either. > > This is strange. I see the same thing, but the bash man-page says: > "If the substitution appears within double quotes, word splitting and > pathname expansion are not performed on the results." > So I'd assume, that word splitting and pathname expansion are performed if > no quotes are used, but that doesn't seem to happen.
They are, but only if these are applied in the current context. For variable assignment we have: A variable may be assigned to by a statement of the form name=[value] [...] All values undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal [...]. The quotes are indeed important if you do: somecommand $(ls $tmpdir) which in the setup of my script above would pass three arguments to somecommand while somecommand "$(ls $tmpdir)" would only result in a single argument. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de