1#!/bin/bash
2
3# Adds the missing links for uClibc or musl, if needed
4
5check() {
6	return 0
7}
8
9depends() {
10	return 0
11}
12
13install() {
14	# Despite of the fact that the listed dependency (reported by readelf -d)
15	# is purely /lib/libc.so, the musl symlink is needed anyway.
16	musl_link="$(find "${dracutsysrootdir?}/lib/" -name "ld-musl-*.so*")"
17	if [ -n "${musl_link}" ] ; then
18		ln -s libc.so "${initdir?}/lib/${musl_link##*/}"
19	fi
20
21	# Same for uClibc, the listed dependency
22	# is ld-uClibc.so.1, the loader needs the ld-uClibc.so.0, too
23	uclibc_link="$(find "${dracutsysrootdir?}/lib/" -name "ld-uClibc-*.so*")"
24	if [ -n "$uclibc_link" ] ; then
25		ln -s ld-uClibc.so.1 "${initdir?}/lib/ld-uClibc.so.0"
26	fi
27}
28