recipe 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Build recipe for udevil.
  2. #
  3. # Copyright (c) 2019-2020, 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. # Exit immediately on any error
  17. set -e
  18. program=udevil
  19. version=20150504_ce9f1c5
  20. release=5
  21. # Define a category for the output of the package name
  22. pkgcategory=tools
  23. tarname=${program}-${version}.tar.lz
  24. # Remote source(s)
  25. fetch="
  26. https://dragora.mirror.garr.it/current/sources/$tarname
  27. rsync://rsync.dragora.org/current/sources/$tarname
  28. "
  29. description="
  30. Mounts and unmounts devices without password.
  31. udevil is a command line GNU/Linux program which mounts and unmounts
  32. removable devices without a password, shows device info, and monitors
  33. device changes. It can also mount ISO files, nfs://, smb://,
  34. ftp://, ssh:// and WebDAV URLs, and tmpfs/ramfs filesystems.
  35. "
  36. homepage=https://github.com/ignorantguru/udevil
  37. license=GPLv3+
  38. # Source documentation
  39. docs="AUTHORS COPYING ChangeLog NEWS README"
  40. docsdir="${docdir}/${program}-${version}"
  41. build()
  42. {
  43. unpack "${tardir}/$tarname"
  44. cd "$srcdir"
  45. # Update for hosts based on musl
  46. cp -f "${worktree}/archive/common/config.guess" config.guess
  47. cp -f "${worktree}/archive/common/config.sub" config.sub
  48. # https://github.com/IgnorantGuru/udevil/issues/89
  49. patch -Np1 -i "${worktree}/patches/udevil/exfat-nonempty-mountoption.patch"
  50. # Set sane permissions
  51. chmod -R u+w,go-w,a+rX-s .
  52. ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  53. $configure_args \
  54. --libdir=/usr/lib${libSuffix} \
  55. --mandir=$mandir \
  56. --docdir=$docsdir \
  57. --disable-systemd \
  58. --build="$(gcc -dumpmachine)"
  59. make -j${jobs} V=1
  60. make -j${jobs} libdir=/usr/lib${libSuffix} \
  61. DESTDIR="$destdir" install-strip
  62. # Udev rule to enable kernel polling on removable devices
  63. install -p -m 644 \
  64. "${worktree}/archive/udevil/61-removable-storage-polling.rules" -D \
  65. "${destdir}/etc/udev/rules.d/61-removable-storage-polling.rules"
  66. # To handle (dot) .new files via graft(1)
  67. touch "${destdir}/etc/udevil/.graft-config"
  68. # Restrict execution of udevil to the 'plugdev' group
  69. chown root:plugdev "${destdir}/usr/bin/udevil"
  70. chmod u+s,go-s,o-x "${destdir}/usr/bin/udevil"
  71. # Install devmon (udevil) perp service
  72. mkdir -p "${destdir}/etc/perp/devmon"
  73. cp -p "${worktree}/archive/udevil/rc.log" \
  74. "${worktree}/archive/udevil/rc.main" \
  75. "${destdir}/etc/perp/devmon/"
  76. chmod 755 "${destdir}"/etc/perp/devmon/rc.*
  77. # Be an active service by default
  78. chmod +t "${destdir}/etc/perp/devmon"
  79. # To handle config file(s)
  80. touch "${destdir}/etc/perp/devmon/.graft-config"
  81. # Compress and link man pages (if needed)
  82. if test -d "${destdir}/$mandir"
  83. then
  84. (
  85. cd "${destdir}/$mandir"
  86. find . -type f -exec lzip -9 {} +
  87. find . -type l | while read -r file
  88. do
  89. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  90. rm -- "$file"
  91. done
  92. )
  93. fi
  94. # Copy documentation
  95. mkdir -p "${destdir}/$docsdir"
  96. cp -p $docs "${destdir}/$docsdir"
  97. }