summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/slx-addons/scripts/setup-addons.sh
diff options
context:
space:
mode:
Diffstat (limited to 'builder/modules.d/slx-addons/scripts/setup-addons.sh')
-rw-r--r--builder/modules.d/slx-addons/scripts/setup-addons.sh19
1 files changed, 16 insertions, 3 deletions
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
+
: