01-hierarchyfs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Build script for the filesystem layout (Dragora).
  2. #
  3. # Copyright (c) 2014-2018 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # These steps here are to satisfy "13-symlinks", the complete
  17. # steps are done from "recipes/config/hierarchyfs".
  18. echo "Creating minimal structure of directories for 'rootdir' ..."
  19. mkdir -p -- \
  20. "${rootdir}/tmp" "${rootdir}/usr/bin" "${rootdir}/etc" "${rootdir}/var/log"
  21. (
  22. cd -- "${rootdir}"
  23. chmod 1777 tmp
  24. ln -sf usr/bin bin
  25. )
  26. # Handle lib<equal> directory for the multi directory support
  27. if test -n "$libSuffix"
  28. then
  29. echo "Handling lib<equal> for ${rootdir}/usr/lib${libSuffix} ..."
  30. (
  31. cd -- "${rootdir}"/usr
  32. mkdir -p lib${libSuffix}
  33. ln -s -f lib${libSuffix} lib
  34. )
  35. # Make symlink of compatibility for / at $rootdir
  36. cd -- "$rootdir"
  37. rm -f lib
  38. ln -s usr/lib${libSuffix} lib
  39. echo "Making compatibility for ${rootdir}/tools/lib${libSuffix} ..."
  40. cd tools
  41. mkdir -p lib${libSuffix}
  42. ln -s -f lib${libSuffix} lib
  43. else
  44. mkdir -p -- "${rootdir}/lib" "${rootdir}/tools/lib" "${rootdir}/usr/lib"
  45. fi
  46. # Save the value of 'libSuffix'
  47. if test -n "$libSuffix"
  48. then
  49. mkdir -p /tools/etc
  50. echo "$libSuffix" > /tools/etc/stage1_is-multi-directory
  51. fi