recipe 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # Build recipe for perp.
  2. #
  3. # Copyright (c) 2016-2019, 2021 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=perp
  19. version=2.07
  20. release=8
  21. # Define a category for the output of the package name
  22. pkgcategory=boot
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch="
  26. https://dragora.mirror.garr.it/current/sources/$tarname
  27. https://b0llix.net/perp/distfiles/$tarname
  28. "
  29. description="
  30. A persistent process supervisor and service managment framework.
  31. The perp package provides a set of daemons and utilities to reliably
  32. start, monitor, log, and control a collection of persistent processes.
  33. A \"persistent process\" is any program intended to be long-running,
  34. highly available, and purpose critical. Also known and often described
  35. as a service, a persistent process normally provides some essential,
  36. on-demand system service. Programs that serve email, domain name
  37. queries, and http requests are all examples of services that are
  38. normally run as persistent processes.
  39. These are the programs that you want to start at system boot, and to
  40. continue running for as long as the system itself. These are the
  41. programs you need running in uninterrupted service, day and night,
  42. forever and ever.
  43. perp helps make sure that they do.
  44. "
  45. homepage=https://b0llix.net/perp
  46. license=Custom
  47. # Source documentation
  48. docs="CHANGES LICENSE README THANKS"
  49. docsdir="${docdir}/${program}-${version}"
  50. build()
  51. {
  52. unpack "${tardir}/$tarname"
  53. cd "$srcdir"
  54. # Set sane permissions
  55. chmod -R u+w,go-w,a+rX-s .
  56. # Apply patches in order to refresh perp-2.07
  57. # See: https://github.com/michaelforney/perp/commits/master
  58. patch -Np1 -i "${worktree}/patches/perp/perp-patches"
  59. # Apply patches from Dragora
  60. patch -Np1 -i "${worktree}/patches/perp/runchoom-use-oom_score_adj"
  61. patch -Np0 -i "${worktree}/patches/perp/flags-conf.mk.diff"
  62. make -j${jobs} CC="cc -static" \
  63. CPPFLAGS="$QICPPFLAGS" QICFLAGS="$QICFLAGS"
  64. make -j${jobs} V=1 strip
  65. make -j${jobs} DESTDIR="$destdir" install
  66. # Automatic installation setup
  67. DESTDIR="$destdir" ./perp/perp-setup /etc/perp
  68. # Create "the blessed" /var/run/perp directory
  69. mkdir -p "${destdir}/var/run/perp"
  70. chmod 700 "${destdir}/var/run/perp"
  71. # Include our config file for tinylog(8)
  72. cp -p "${worktree}/archive/perp/etc/tinylog.conf" \
  73. "${destdir}/etc/"
  74. chmod 644 "${destdir}/etc/tinylog.conf"
  75. # Include our custom essential perp init scripts
  76. cp -p "${worktree}/archive/perp/etc/rc.log-boot" \
  77. "${destdir}/etc/perp/.boot/rc.log"
  78. cp -p "${worktree}/archive/perp/etc/rc.perp-boot" \
  79. "${destdir}/etc/perp/.boot/rc.perp"
  80. chmod 755 "${destdir}/etc/perp/.boot/rc.log" \
  81. "${destdir}/etc/perp/.boot/rc.perp"
  82. # Include profile file
  83. mkdir -p "${destdir}/etc/profile.d"
  84. cp -p "${worktree}/archive/perp/etc/profile.d/perp.sh" \
  85. "${destdir}/etc/profile.d/"
  86. chmod 644 "${destdir}/etc/profile.d/perp.sh"
  87. # To handle config file(s)
  88. touch "${destdir}/etc/.graft-config" \
  89. "${destdir}/etc/perp/.boot/.graft-config" \
  90. "${destdir}/etc/profile.d/.graft-config"
  91. # We don't include perp-setup*
  92. rm -f "${destdir}/usr/sbin/perp-setup" \
  93. "${destdir}/${mandir}/man8/perp-setup.8"
  94. # Compress and link man pages (if needed)
  95. if test -d "${destdir}/$mandir"
  96. then
  97. (
  98. cd "${destdir}/$mandir"
  99. find . -type f -exec lzip -9 {} +
  100. find . -type l | while read -r file
  101. do
  102. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  103. rm -- "$file"
  104. done
  105. )
  106. fi
  107. # Copy documentation
  108. mkdir -p "${destdir}/$docsdir"
  109. cp -p $docs "${destdir}/$docsdir"
  110. }