recipe 4.2 KB

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