OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
4.0 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: package/.../runit/djb-config
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. # e.g. $1: admin mail net ...
  17. # $2: $sbindir $bindir
  18. #
  19. pkg_djb_hierarchy=$1
  20. pkg_djb_altdir=${2:-$bindir}
  21. # $logdir
  22. if [ "${localstatedir%$pkg}" != "$localstatedir" ]; then
  23. logdir=$localstatedir/log
  24. else
  25. logdir=$localstatedir/log/$pkg
  26. fi
  27. # $sysconfdir
  28. if [ "${sysconfdir%$pkg}" == "$sysconfdir" ]; then
  29. sysconfdir=$sysconfdir/$pkg
  30. fi
  31. if [ -z "$pkg_djb_hierarchy" ]; then
  32. abort "djb-config: must specify hierarchy /package/\$hierarchy."
  33. fi
  34. srcdir="$pkg_djb_hierarchy/$pkg-$ver"
  35. if [ "$createdocs" != "0" ]; then
  36. createdocs=0
  37. hook_add postdoc 2 'pkg_djb_installdoc $pkg_djb_hierarchy'
  38. fi
  39. # custmain
  40. #
  41. custmain="pkg_djb_main"
  42. pkg_djb_main() {
  43. hook_eval premake
  44. ./package/compile
  45. hook_eval inmake
  46. pkg_djb_installpackage $pkg_djb_hierarchy $pkg_djb_altdir
  47. hook_eval postmake
  48. }
  49. pkg_djb_safecopy() {
  50. local source="$( echo "${1#$root}/$3" | tr -s '/' ) "
  51. local target="$( echo "${2#$root}/$3" | tr -s '/' ) "
  52. echo "'$source' -> '$target'"
  53. cp -vfp $source ${root}$target
  54. }
  55. pkg_djb_safelink() {
  56. local source="$( echo "${1#$root}/$3" | tr -s '/' ) "
  57. local target="$( echo "${2#$root}/$3" | tr -s '/' ) "
  58. echo "create symbolic link '$source' to '$target'"
  59. ln -snvf $source ${root}$target
  60. }
  61. pkg_djb_substitute() {
  62. sed \
  63. -e "s,D_commanddir,$pkg_djb_commanddir,g" \
  64. -e "s,D_servicedir,$pkg_djb_servicedir,g" \
  65. -e "s,D_logdir,$logdir,g" \
  66. $1
  67. }
  68. # installs the package in DJB way if requested
  69. #
  70. pkg_djb_installpackage() {
  71. # requires ./package/commands
  72. # and files in ./command
  73. local x= y=
  74. local package=$1
  75. local altdir=$2
  76. if [ "$pkg_djb_packagedir" ]; then
  77. echo 'Copying commands to package directory...'
  78. mkdir -p $pkg_djb_packagedir/$package/$pkg-$ver/command
  79. for x in `cat ./package/commands`; do
  80. pkg_djb_safecopy ./command \
  81. $pkg_djb_packagedir/$package/$pkg-$ver/command $x
  82. done
  83. echo "Creating symlink $pkg -> $pkg-$ver..."
  84. ln -svnf $pkg-$ver $pkg_djb_packagedir/$package/$pkg
  85. fi
  86. if [ "$pkg_djb_commanddir" ]; then
  87. echo "Making command links in $pkg_djb_commanddir..."
  88. y=pkg_djb_safelink
  89. else
  90. echo 'Copying commands to $altdir...'
  91. pkg_djb_commanddir=$altdir
  92. y=pkg_djb_safecopy
  93. fi
  94. mkdir -p $pkg_djb_commanddir
  95. for x in `cat package/commands`; do
  96. $y $pkg_djb_packagedir/$package/$pkg-$ver/command \
  97. $pkg_djb_commanddir $x
  98. done
  99. # usr/local is evil :)
  100. #if [ "$pkg_djb_compatdir" ]; then
  101. # echo "Making compatibility links in $pkg_djb_compatdir..."
  102. # mkdir -p $pkg_djb_compatdir
  103. # for i in `cat package/commands`; do
  104. # pkg_djb_safelink $pkg_djb_packagedir/$package/$pkg-$ver/command \
  105. # $pkg_djb_compatdir $i
  106. # done
  107. #fi
  108. }
  109. # installs documentation to package directory or $docdir as requested
  110. #
  111. pkg_djb_installdoc() {
  112. local x package=$1
  113. local docpkg
  114. echo 'Copying documentation....'
  115. if [ "$pkg_djb_packagedir" ]; then
  116. docpkg=$pkg_djb_packagedir/$package/$pkg-$ver/package
  117. docdir=$pkg_djb_packagedir/$package/$pkg-$ver/doc
  118. else
  119. # $pkg_djb_* includes $root, $docdir doesn't.
  120. docpkg=$root/$docdir
  121. fi
  122. mkdir -p $docpkg $docdir
  123. # ./package
  124. for x in `ls ./package`; do
  125. case $x in
  126. compile|install*|upgrade)
  127. /bin/true ;;
  128. *) cp -vf ./package/$x $docpkg ;;
  129. esac
  130. done
  131. # ./doc
  132. if [ -d doc ]; then
  133. cp -rLv ./doc/* $docdir
  134. fi
  135. # ./man
  136. if [ -d man ]; then
  137. echo "Installing man pages ... "
  138. for x in $( cd man; ls -1 *.[1-9] | sed -e 's,.*\.\([1-9]\),\1,g' | sort -u ); do
  139. gzip -9 ./man/*.$x
  140. cp -vf ./man/*.$x.gz $root/$mandir/man$x/
  141. done
  142. fi
  143. }