recipe 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. # Build recipe for os-prober.
  2. #
  3. # Copyright (c) 2019, 2021 Matias Fonzo, <selk@dragora.org>.
  4. # Copyright (c) 2022 Matias Fonzo, <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Exit immediately on any error
  18. set -e
  19. program=os-prober
  20. version=1.81
  21. release=1
  22. # Define a category for the output of the package name
  23. pkgcategory=boot
  24. tarname=${program}_${version}.tar.xz
  25. # Remote source(s)
  26. fetch=https://deb.debian.org/debian/pool/main/o/os-prober/$tarname
  27. description="
  28. Utility to detect other OSes on a set of drives.
  29. This package detects other OSes available on a system and outputs
  30. the results in a generic machine-readable format.
  31. "
  32. homepage=https://joeyh.name/code/os-prober/
  33. license=GPLv2+
  34. # Source documentation
  35. docs="README TODO debian/changelog debian/copyright"
  36. docsdir="${docdir}/${program}-${version}"
  37. build()
  38. {
  39. unpack "${tardir}/$tarname"
  40. cd "$srcdir"
  41. # Import patches from Fedora to make os-prober more reliable
  42. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-no-dummy-mach-kernel.patch"
  43. # Sent upstream
  44. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-mdraidfix.patch"
  45. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-btrfsfix.patch"
  46. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-bootpart-name-fix.patch"
  47. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-mounted-partitions-fix.patch"
  48. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-factor-out-logger.patch"
  49. # To be sent upstream
  50. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-factored-logger-efi-fix.patch"
  51. patch -Np1 -i "${worktree}/patches/os-prober/os-prober-umount-fix.patch"
  52. # Use 'libsuffix' if defined
  53. if test -n "$libSuffix"
  54. then
  55. find . -type f -exec sed -i -e "s|usr/lib|usr/lib${libSuffix}|g" {} \;
  56. fi
  57. # Set sane permissions
  58. chmod -R u+w,go-w,a+rX-s .
  59. make -j${jobs} V=1 CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static"
  60. mkdir -p "${destdir}/usr/bin"
  61. cp -p linux-boot-prober "${destdir}/usr/bin"
  62. cp -p os-prober "${destdir}/usr/bin"
  63. chmod 755 "${destdir}/usr/bin"/*
  64. mkdir -p "${destdir}/usr/lib${libSuffix}/os-prober"
  65. cp -p newns "${destdir}/usr/lib${libSuffix}/os-prober"
  66. chmod 755 "${destdir}/usr/lib${libSuffix}/os-prober/newns"
  67. # linux-boot-probes
  68. mkdir -p "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted"
  69. cd linux-boot-probes
  70. for file in mounted/common/* mounted/x86/*
  71. do
  72. test -f "$file" || continue
  73. echo "Copying linux-boot-probes/${file} ..."
  74. cp -p $file \
  75. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted/"
  76. chmod 755 \
  77. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/mounted/${file##*/}"
  78. done
  79. unset -v file
  80. cp -p common/50mounted-tests \
  81. "${destdir}/usr/lib${libSuffix}/linux-boot-probes"
  82. chmod 755 \
  83. "${destdir}/usr/lib${libSuffix}/linux-boot-probes/50mounted-tests"
  84. cd ..
  85. # End of linux-boot-probes
  86. # os-probes
  87. mkdir -p "${destdir}/usr/lib${libSuffix}/os-probes/mounted/efi"
  88. cd os-probes
  89. for file in mounted/common/* mounted/x86/*
  90. do
  91. test -f "$file" || continue
  92. echo "Copying os-probes/${file} ..."
  93. cp -p $file \
  94. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/"
  95. chmod 755 \
  96. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/${file##*/}"
  97. done
  98. unset -v file
  99. cp -p mounted/x86/efi/* \
  100. "${destdir}/usr/lib${libSuffix}/os-probes/mounted/efi"
  101. mkdir -p "${destdir}/usr/lib${libSuffix}/os-probes/init"
  102. cp -p init/common/* "${destdir}/usr/lib${libSuffix}/os-probes/init"
  103. cp -p common/50mounted-tests \
  104. "${destdir}/usr/lib${libSuffix}/os-probes"
  105. chmod 755 \
  106. "${destdir}/usr/lib${libSuffix}/os-probes/50mounted-tests"
  107. cp -p mounted/powerpc/20macosx \
  108. "${destdir}/usr/lib${libSuffix}/os-probes/mounted"
  109. chmod 755 "${destdir}/usr/lib${libSuffix}/os-probes/mounted/20macosx"
  110. cd ..
  111. # End of os-probes
  112. mkdir -p "${destdir}/usr/share/os-prober"
  113. cp -p common.sh "${destdir}/usr/share/os-prober"
  114. chmod 755 "${destdir}/usr/share/os-prober/common.sh"
  115. # Create local state directory
  116. mkdir -p "${destdir}/var/lib/os-prober"
  117. # Copy documentation
  118. mkdir -p "${destdir}/$docsdir"
  119. cp -p $docs "${destdir}/$docsdir"
  120. }