libc-links-module-setup.sh 701 B

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