01-hierarchyfs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Build script for the filesystem layout (Dragora).
  2. #
  3. # Copyright (c) 2014-2018, 2022 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 are to satisfy "19-symlinks", the final
  17. # steps are done from "recipes/data/hierarchyfs".
  18. echo "Making minimal directory layout on 'rootdir' ..."
  19. mkdir -p -- \
  20. "${rootdir}/etc" \
  21. "${rootdir}/root" \
  22. "${rootdir}/tmp" \
  23. "${rootdir}/usr/bin" \
  24. "${rootdir}/var/log"
  25. (
  26. cd -- "${rootdir}"
  27. chmod 0750 root; chmod 1777 tmp
  28. if test ! -L bin
  29. then
  30. rm -f bin
  31. ln -s -f usr/bin bin
  32. fi
  33. )
  34. # Handle lib<equal> directory for the multi directory support
  35. if test -n "$libSuffix"
  36. then
  37. echo "Handling lib<equal> for ${rootdir}/usr/lib${libSuffix} ..."
  38. (
  39. cd -- "${rootdir}/usr"
  40. mkdir -p lib${libSuffix}
  41. if test ! -L lib
  42. then
  43. rm -f lib
  44. ln -s -f lib${libSuffix} lib
  45. fi
  46. )
  47. # Make symlink of compatibility for / at $rootdir
  48. cd -- "$rootdir"
  49. echo "Handling lib<equal> for ${rootdir}/lib${libSuffix} ..."
  50. if test ! -L "lib${libSuffix}"
  51. then
  52. rm -f lib${libSuffix}
  53. ln -s -f usr/lib${libSuffix} lib${libSuffix}
  54. fi
  55. echo "Handling lib<equal> for ${rootdir}/lib ..."
  56. if test ! -L lib
  57. then
  58. rm -f lib
  59. ln -s -f lib${libSuffix} lib
  60. fi
  61. echo "Making compatibility for ${rootdir}/tools/lib${libSuffix} ..."
  62. cd tools
  63. mkdir -p lib${libSuffix}
  64. if test ! -L lib
  65. then
  66. rm -f lib
  67. ln -s -f lib${libSuffix} lib
  68. fi
  69. else
  70. mkdir -p -- "${rootdir}/lib" "${rootdir}/tools/lib" "${rootdir}/usr/lib"
  71. fi
  72. # Save the value of 'libSuffix'
  73. if test -n "$libSuffix"
  74. then
  75. mkdir -p /tools/etc
  76. echo "$libSuffix" > /tools/etc/stage1_is-multi-directory
  77. fi