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.

> +     if [ "$UPDATE_TARGET" != '/etc/rc.once.d' -a "$UPDATE_TARGET" != 
> 'etc/rc.once.d' ]; then

I'm quite sure that 'readlink -f' always returns an absolute path. So
either remove the '-f' (and the select below) or the second check.

Michael

> +             echo "skipping rc.once.d services..."
> +             return $failed
> +     fi
>       echo "running rc.once.d services..."
>       cd "$RC_ONCE_DIR" || exit 1
>       mkdir -p "$DONE_DIR"
> diff --git a/rules/rc-once.in b/rules/rc-once.in
> index 849c71f06..6db4a02fc 100644
> --- a/rules/rc-once.in
> +++ b/rules/rc-once.in
> @@ -3,6 +3,9 @@
>  config RC_ONCE
>       tristate
>       prompt "rc.once"
> +     select BUSYBOX_FEATURE_READLINK_FOLLOW  if BUSYBOX_READLINK
> +     select COREUTILS                        if !BUSYBOX_READLINK
> +     select COREUTILS_READLINK               if !BUSYBOX_READLINK
>       help
>         Some services need a one time initialization when the system starts
>         up the first time after creating and installing the root filesystem.
> -- 
> 2.13.0
> 
> 
> Eckelmann AG
> Vorstand: Dipl.-Ing. Peter Frankenbach (Sprecher) Dipl.-Wi.-Ing. Philipp 
> Eckelmann
> Dr.-Ing. Marco Münchhof Dr.-Ing. Frank Uhlemann
> Vorsitzender des Aufsichtsrats: Hubertus G. Krossa
> Stv. Vorsitzender des Aufsichtsrats: Dr.-Ing. Gerd Eckelmann
> Sitz der Gesellschaft: Berliner Str. 161, 65205 Wiesbaden, Amtsgericht 
> Wiesbaden HRB 12636
> http://www.eckelmann.de 
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to