recipe 4.9 KB

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