From ac823e0e7c59f3697b487ea414130912c77106b2 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 8 Nov 2019 15:34:14 +0100 Subject: [slx-addon] support for pre-gen. ld.so.cache --- builder/modules.d/slx-addons/scripts/setup-addons.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'builder/modules.d/slx-addons/scripts/setup-addons.sh') diff --git a/builder/modules.d/slx-addons/scripts/setup-addons.sh b/builder/modules.d/slx-addons/scripts/setup-addons.sh index ed12d6c7..1fff2810 100644 --- a/builder/modules.d/slx-addons/scripts/setup-addons.sh +++ b/builder/modules.d/slx-addons/scripts/setup-addons.sh @@ -36,8 +36,8 @@ fi # This just activates the ldconfig service to run during the sysinit target # Since addons are likely to install libs, this is necessary to garantee # that the live system "sees" the libraries. -prepare_ldconfig() { - local service_path="/opt/openslx/services/post-addon-ldconfig.service" +activate_stage4_ldconfig() { + local service_path="/opt/openslx/services/ldconfig.service" [ -e "$service_path" ] || return 1 local target_dir="${NEWROOT}/etc/systemd/system/sysinit.target.wants" mkdir -p "$target_dir" @@ -77,11 +77,24 @@ setup_addon() { cd - &>/dev/null } +active=() for addon in "${NEWROOT}/opt/openslx/addons/"*; do if setup_addon "$addon"; then + active+=("$addon") info "Activated '$addon' (@ $(date +%s))" - prepare_ldconfig fi done +# if only one addon was installed, use its pre-generated ld.so.cache +# if more than one were installed, make sure ldconfig is called in stage4 +if [ "${#active[@]}" -eq 1 ]; then + addon_cache="${NEWROOT}/opt/openslx/etc/${active[0]}.ld.so.cache" + if [ -e "$addon_cache" ]; then + mv -f -- "$addon_cache" "${NEWROOT}/etc/ld.so.cache" + exit 0 + fi +elif [ "${#active[@]}" -gt 1 ]; then + activate_stage4_ldconfig +fi + : -- cgit v1.2.3-55-g7522