[devel-distro] [PATCH 1/2] live: add use/live/runapp

Антон Мидюков midyukov-anton at ya.ru
Mon Sep 12 19:09:50 MSK 2022


12.09.2022 00:33, Michael Shigorin пишет:
> Add the possibility to directly configure the desktop app
> for livecd kiosk mode to start.
> 
> This should have been done as soon as livecd-runapp
> hit the streets -- livecd-{0ad,fgfs} definitely must go
> as adding a line into config is trivially done near
> the only place that requires them (conf.d/live.mk).
> 
> TODO: might be more generally useful for vm/* too,
>       take this out into a separate feature then.
> ---
>  features.in/live/README                         |  5 +++++
>  features.in/live/config.mk                      |  5 +++++
>  features.in/live/live/image-scripts.d/50-runapp | 16 ++++++++++++++++
>  3 files changed, 26 insertions(+)
>  create mode 100755 features.in/live/live/image-scripts.d/50-runapp
> 
> diff --git a/features.in/live/README b/features.in/live/README
> index 72975f5c9..58302a182 100644
> --- a/features.in/live/README
> +++ b/features.in/live/README
> @@ -19,3 +19,8 @@
>  ** перечисляет префиксы каталогов драйвров ядра для удаления
>  ** значение: пусто (по умолчанию) или список через пробел
>  ** см. config.mk
> +
> +* LIVE_RUNAPP_BINARY
> +** указывает имя программы для запуска в режиме киоска
> +** значение: пусто (по умолчанию) или путь (из $PATH или полный)
> +** см. тж. пакеты livecd-0ad, livecd-fgfs и сам livecd-runapp
> diff --git a/features.in/live/config.mk b/features.in/live/config.mk
> index e6d762285..59e65b9eb 100644
> --- a/features.in/live/config.mk
> +++ b/features.in/live/config.mk
> @@ -99,6 +99,11 @@ else
>  use/live/suspend: use/live; @:
>  endif
>  
> +# for kiosks
> +use/live/runapp: use/live;
> +	@$(call add,LIVE_PACKAGES,livecd-runapp)
> +	@$(call xport,LIVE_RUNAPP_BINARY)
> +
>  # deny network/local drive access for security reasons
>  use/live/privacy: use/services use/memclean use/deflogin \
>  	use/stage2/ata use/stage2/drm use/stage2/hid \
> diff --git a/features.in/live/live/image-scripts.d/50-runapp b/features.in/live/live/image-scripts.d/50-runapp
> new file mode 100755
> index 000000000..3da410108
> --- /dev/null
> +++ b/features.in/live/live/image-scripts.d/50-runapp
> @@ -0,0 +1,16 @@
> +#!/bin/sh -efu
> +# see also live-0ad
> +

Не надо выполнять, если нет пакета livecd-runapp или не задана переменная LIVE_RUNAPP_BINARY:

+[ rpm -q livecd-runapp ] || exit 0
+[ -n "$GLOBAL_LIVE_RUNAPP_BINARY" ] || exit 0

так как иначе в live будет ничейный файл /etc/sysconfig/livecd-runapp либо файл с бессмысленным содержимым:

# mkimage-profiles live 50-runapp hook
BINARY=

что тоже нехорошо.

> +CONFIG=/etc/sysconfig/livecd-runapp
> +
> +if [ -s "$CONFIG" ]; then
> +	echo "$CONFIG exists, not overriding (from $(rpm -qf "$CONFIG"))"
> +	exit 0
> +fi
> +
> +mkdir -p "$(dirname "$CONFIG")"
> +cat >> "$CONFIG" << _EOF_
> +# mkimage-profiles live 50-runapp hook
> +BINARY=$GLOBAL_LIVE_RUNAPP_BINARY
> +_EOF_
> +:

-- 
С уважением, Антон Мидюков <antohami �� altlinux.org>



More information about the devel-distro mailing list