recipe 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # Build recipe for os-prober.
  2. #
  3. # Copyright (c) 2019 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. program=os-prober
  17. version=1.77
  18. release=1
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/boot"
  21. tarname=${program}_${version}.tar.xz
  22. # Remote source(s)
  23. fetch=http://deb.debian.org/debian/pool/main/o/os-prober/$tarname
  24. description="
  25. Utility to detect other OSes on a set of drives.
  26. This package detects other OSes available on a system and outputs
  27. the results in a generic machine-readable format.
  28. "
  29. homepage=http://joeyh.name/code/os-prober/
  30. license=GPLv2+
  31. # Source documentation
  32. docs="README TODO debian/changelog debian/copyright"
  33. docsdir="${docdir}/${program}-${version}"
  34. build()
  35. {
  36. set -e
  37. unpack "${tardir}/$tarname"
  38. cd "$srcdir"
  39. # Import patches from Fedora to make os-prober more reliable
  40. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-no-dummy-mach-kernel.patch"
  41. # Sent upstream
  42. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-mdraidfix.patch"
  43. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-btrfsfix.patch"
  44. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-bootpart-name-fix.patch"
  45. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-mounted-partitions-fix.patch"
  46. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-factor-out-logger.patch"
  47. # To be sent upstream
  48. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-factored-logger-efi-fix.patch"
  49. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-umount-fix.patch"
  50. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-grub2-parsefix.patch"
  51. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-grepfix.patch"
  52. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-gentoo-fix.patch"
  53. # Use 'libsuffix' if defined
  54. if test -n "$libSuffix"
  55. then
  56. find . -type f -exec sed -i -e "s|usr/lib|usr/lib${libSuffix}|g" {} \;
  57. fi
  58. # Set sane permissions
  59. chmod -R u+w,go-w,a+rX-s .
  60. make -j${jobs} V=1 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static"
  61. mkdir -p "${destdir}/usr/bin"
  62. cp -p linux-boot-prober "${destdir}/usr/bin"
  63. cp -p os-prober "${destdir}/usr/bin"
  64. chmod 755 "${destdir}/usr/bin"/*
  65. mkdir -p "${destdir}/usr/lib${libSuffix}/os-prober"
  66. cp -p newns "${destdir}/usr/lib${libSuffix}/os-prober"
  67. chmod 755 "${destdir}/usr/lib${libSuffix}/os-prober/newns"
  68. # linux-boot-probes
  69. mkdir -p "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted"
  70. cd linux-boot-probes
  71. for file in mounted/common/* mounted/x86/*
  72. do
  73. test -f "$file" || continue
  74. echo "Copying linux-boot-probes/${file} ..."
  75. cp -p $file \
  76. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted/"
  77. chmod 755 \
  78. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted/${file##*/}"
  79. done
  80. unset file
  81. cp -p common/50mounted-tests \
  82. "${destdir}/usr/lib${libSuffix}/linux-boot-probes"
  83. chmod 755 \
  84. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/50mounted-tests"
  85. cd ..
  86. # End of linux-boot-probes
  87. # os-probes
  88. mkdir -p "${destdir}/usr/lib${libSuffix}/os-probes/mounted/efi"
  89. cd os-probes
  90. for file in mounted/common/* mounted/x86/*
  91. do
  92. test -f "$file" || continue
  93. echo "Copying os-probes/${file} ..."
  94. cp -p $file \
  95. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/"
  96. chmod 755 \
  97. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/${file##*/}"
  98. done
  99. unset file
  100. cp -p mounted/x86/efi/* \
  101. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/efi"
  102. mkdir -p "${destdir}/usr/lib${libSuffix}/os-probes/init"
  103. cp -p init/common/* "${destdir}/usr/lib${libSuffix}/os-probes/init"
  104. cp -p common/50mounted-tests \
  105. "${destdir}/usr/lib${libSuffix}/os-probes"
  106. chmod 755 \
  107. "${destdir}/usr/lib${libSuffix}/os-probes/50mounted-tests"
  108. cp -p mounted/powerpc/20macosx \
  109. "${destdir}/usr/lib${libSuffix}/os-probes/mounted"
  110. chmod 755 "${destdir}/usr/lib${libSuffix}/os-probes/mounted/20macosx"
  111. cd ..
  112. # End of os-probes
  113. mkdir -p "${destdir}/usr/share/os-prober"
  114. cp -p common.sh "${destdir}/usr/share/os-prober"
  115. chmod 755 "${destdir}/usr/share/os-prober/common.sh"
  116. # Create local state directory
  117. mkdir -p "${destdir}/var/lib/os-prober"
  118. # Copy documentation
  119. mkdir -p "${destdir}${docsdir}"
  120. cp -p $docs "${destdir}${docsdir}"
  121. }