tsm-7.1.2.0.ebuild 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit versionator multilib eutils readme.gentoo rpm systemd user
  5. DESCRIPTION="Tivoli Storage Manager (TSM) Backup/Archive (B/A) Client and API"
  6. HOMEPAGE="http://www.tivoli.com/"
  7. MY_PV_MAJOR=$(get_major_version)
  8. MY_PV_MINOR=$(get_version_component_range 2)
  9. MY_PV_TINY=$(get_version_component_range 3)
  10. MY_PV_PATCH=$(get_version_component_range 4)
  11. MY_PV_NODOTS="${MY_PV_MAJOR}${MY_PV_MINOR}${MY_PV_TINY}"
  12. MY_PVR_ALLDOTS=${PV}
  13. if [[ ${MY_PV_PATCH} == 0 ]]; then
  14. MY_RELEASE_PATH=maintenance
  15. else
  16. MY_RELEASE_PATH=patches
  17. fi
  18. BASE_URI="ftp://ftp.software.ibm.com/storage/tivoli-storage-management/"
  19. BASE_URI+="${MY_RELEASE_PATH}/client/v${MY_PV_MAJOR}r${MY_PV_MINOR}/"
  20. BASE_URI+="Linux/LinuxX86/BA/v${MY_PV_NODOTS}/"
  21. SRC_TAR="${MY_PVR_ALLDOTS}-TIV-TSMBAC-LinuxX86.tar"
  22. SRC_URI="${BASE_URI}${SRC_TAR}"
  23. RESTRICT="strip" # Breaks libPiIMG.so and libPiSNAP.so
  24. LICENSE="Apache-1.1 Apache-2.0 JDOM BSD-2 CC-PD Boost-1.0 MIT CPL-1.0 HPND Exolab
  25. dom4j EPL-1.0 FTL icu unicode IBM Info-ZIP LGPL-2 LGPL-2.1 openafs-krb5-a
  26. ZLIB MPL-1.0 MPL-1.1 NPL-1.1 openssl OPENLDAP RSA public-domain W3C
  27. || ( BSD GPL-2+ ) gSOAP libpng tsm"
  28. SLOT="0"
  29. KEYWORDS="~amd64 -*"
  30. IUSE="acl java +tsm_cit +tsm_hw"
  31. QA_PREBUILT="*"
  32. MY_LANGS="cs:CS_CZ de:DE_DE es:ES_ES fr:FR_FR hu:HU_HU it:IT_IT ja:JA_JP
  33. ko:KO_KR pl:PL_PL pt-BR:PT_BR ru:RU_RU zh-CN:ZH_CN zh-TW:ZH_TW"
  34. MY_LANG_PV="${MY_PVR_ALLDOTS}-"
  35. for lang in ${MY_LANGS}; do
  36. IUSE="${IUSE} l10n_${lang%:*}"
  37. SRC_URI="${SRC_URI} l10n_${lang%:*}? ( \
  38. ${BASE_URI}TIVsm-msg.${lang#*:}.x86_64.rpm -> \
  39. ${MY_LANG_PV}TIVsm-msg.${lang#*:}.x86_64.rpm )"
  40. done
  41. unset lang
  42. DEPEND=""
  43. RDEPEND="
  44. dev-libs/expat
  45. dev-libs/libxml2
  46. =sys-fs/fuse-2*
  47. acl? ( sys-apps/acl )
  48. java? ( virtual/jre:1.7 )
  49. "
  50. S="${WORKDIR}"
  51. pkg_setup() {
  52. enewgroup tsm
  53. DOC_CONTENTS="
  54. Note that you have to be either root or member of the group tsm to
  55. be able to use the Tivoli Storage Manager client."
  56. }
  57. src_unpack() {
  58. local rpm rpms lang
  59. unpack ${SRC_TAR}
  60. for rpm in *.rpm; do
  61. case ${rpm} in
  62. TIVsm-APIcit.*|TIVsm-BAcit.*)
  63. use tsm_cit && rpms="${rpms} ./${rpm}"
  64. ;;
  65. TIVsm-BAhdw.*)
  66. use tsm_hw && rpms="${rpms} ./${rpm}"
  67. ;;
  68. TIVsm-JBB.*|*-filepath-*)
  69. # "journal based backup" for all filesystems
  70. # requires a kernel module.
  71. # "Linux Filepath source code" available
  72. # by request from vendor
  73. ;;
  74. *)
  75. rpms="${rpms} ./${rpm}"
  76. ;;
  77. esac
  78. done
  79. for rpm in ${A}; do
  80. case ${rpm} in
  81. *.rpm)
  82. rpms="${rpms} ${rpm}"
  83. ;;
  84. esac
  85. done
  86. rpm_unpack ${rpms}
  87. # Avoid strange error messages caused by read-only files
  88. chmod -R u+w "${S}" || die
  89. }
  90. src_prepare() {
  91. # Avoid unnecessary dependency on ksh
  92. sed -i 's:^#!/usr/bin/ksh:#!/bin/bash:' \
  93. opt/tivoli/tsm/client/ba/bin/dsmj || die
  94. }
  95. src_install() {
  96. cp -a opt "${D}" || die
  97. cp -a usr "${D}" || die
  98. # The RPM files contain postinstall scripts which can be extracted
  99. # e.g. using https://bugs.gentoo.org/attachment.cgi?id=234663 .
  100. # Below we try to mimic the behaviour of these scripts.
  101. # We don't deal with SELinux compliance (yet), though.
  102. local RPM_INSTALL_PREFIX CLIENTDIR i
  103. RPM_INSTALL_PREFIX=/opt
  104. CLIENTDIR=$RPM_INSTALL_PREFIX/tivoli/tsm/client
  105. # We don't bother setting timestamps to build dates.
  106. # But we should delete the corresponding files.
  107. rm -f "${D}"$CLIENTDIR/api/bin*/.buildDate || die
  108. rm -f "${D}"$CLIENTDIR/ba/bin*/.buildDate || die
  109. rm -f "${D}"$CLIENTDIR/lang/.buildDate || die
  110. # Create links for messages; this is spread over several postin scripts.
  111. for i in $(cd "${D}"${CLIENTDIR}/lang; ls -1d ??_??); do
  112. dosym ../../lang/${i} $CLIENTDIR/ba/bin/${i}
  113. dosym ../../lang/${i} $CLIENTDIR/api/bin64/${i}
  114. done
  115. # Mimic TIVsm-API64 postinstall script
  116. for i in libgpfs.so libdmapi.so; do
  117. dosym ../..$CLIENTDIR/api/bin64/${i} /usr/lib64/${i}
  118. done
  119. # The TIVsm-BA postinstall script only does messages and ancient upgrades
  120. # The gscrypt64 postinstall script only deals with s390[x] SELinux
  121. # and the symlink for the iccs library which we handle in the loop below.
  122. # Move stuff from /usr/local to /opt, #452332
  123. mv "${D}"/usr/local/ibm "${D}"/opt/ || die
  124. rmdir "${D}"/usr/local || die
  125. # Mimic gskssl64 postinstall script
  126. for i in sys p11 km ssl drld kicc ldap cms acmeidup valn dbfl iccs; do
  127. dosym ../../opt/ibm/gsk8_64/lib64/libgsk8${i}_64.so \
  128. /usr/lib64/libgsk8${i}_64.so
  129. done
  130. for i in capicmd ver; do
  131. dosym ../../opt/ibm/gsk8_64/bin/gsk8${i}_64 /usr/bin/gsk${i}_64
  132. done
  133. # Done with the postinstall scripts as the RPMs contain them.
  134. # Now on to some more Gentoo-specific installation.
  135. [[ -d "${D}usr/lib" ]] && die "Using 32bit lib dir in 64bit only system"
  136. # Avoid "QA Notice: Found an absolute symlink in a library directory"
  137. local target
  138. find "${D}"usr/lib* -lname '/*' | while read i; do
  139. target=$(readlink "${i}")
  140. rm -v "${i}" || die
  141. dosym "../..${target}" "${i#${D}}"
  142. done
  143. # Install symlinks for sonames of libraries, bug #416503
  144. dosym libvixMntapi.so.1.1.0 $CLIENTDIR/ba/bin/libvixMntapi.so.1
  145. dosym libvixDiskLibVim.so.6.0.0 $CLIENTDIR/ba/bin/libvixDiskLibVim.so.6
  146. dosym libvixDiskLib.so.6.0.0 $CLIENTDIR/ba/bin/libvixDiskLib.so.6
  147. fowners :tsm /opt/tivoli/tsm/client/ba/bin/dsmtca
  148. fperms 4710 /opt/tivoli/tsm/client/ba/bin/dsmtca
  149. keepdir /var/log/tsm
  150. insinto /etc/logrotate.d
  151. newins "${FILESDIR}/tsm.logrotate" tsm
  152. keepdir /etc/tivoli
  153. cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.sys.smp" "${D}/etc/tivoli/dsm.sys" || die
  154. echo ' PasswordDir "/etc/tivoli/"' >> ${D}/etc/tivoli/dsm.sys
  155. echo ' PasswordAccess generate' >> ${D}/etc/tivoli/dsm.sys
  156. # Added the hostname to be more friendly, the admin will need to edit this file anyway
  157. echo ' NodeName' `hostname` >> ${D}/etc/tivoli/dsm.sys
  158. echo ' ErrorLogName "/var/log/tsm/dsmerror.log"' >> ${D}/etc/tivoli/dsm.sys
  159. echo ' SchedLogName "/var/log/tsm/dsmsched.log"' >> ${D}/etc/tivoli/dsm.sys
  160. dosym ../../../../../../etc/tivoli/dsm.sys /opt/tivoli/tsm/client/ba/bin/dsm.sys
  161. cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.opt.smp" "${D}/etc/tivoli/dsm.opt"
  162. dosym ../../../../../../etc/tivoli/dsm.opt /opt/tivoli/tsm/client/ba/bin/dsm.opt
  163. # Setup the env
  164. dodir /etc/env.d
  165. ENV_FILE="${D}/etc/env.d/80tivoli"
  166. echo 'DSM_CONFIG="/etc/tivoli/dsm.opt"' >> ${ENV_FILE}
  167. echo 'DSM_DIR="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
  168. echo 'DSM_LOG="/var/log/tsm"' >> ${ENV_FILE}
  169. echo 'ROOTPATH="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
  170. newconfd "${FILESDIR}/dsmc.conf.d" dsmc
  171. newinitd "${FILESDIR}/dsmc.init.d" dsmc
  172. newinitd "${FILESDIR}/dsmcad.init.d-r1" dsmcad
  173. systemd_dounit "${FILESDIR}/dsmc.service"
  174. systemd_dounit "${FILESDIR}/dsmcad.service"
  175. readme.gentoo_create_doc
  176. }
  177. pkg_postinst() {
  178. local i dirs
  179. for i in /var/log/tsm/dsm{error,sched,j,webcl}.log; do
  180. if [[ ! -e $i ]]; then
  181. touch $i || die
  182. chown :tsm $i || die
  183. chmod 0660 $i || die
  184. fi
  185. done
  186. # Bug #375041: the log directory itself should not be world writable.
  187. # Have to do this in postinst due to bug #141619
  188. chown root:tsm /var/log/tsm || die
  189. chmod 0750 /var/log/tsm || die
  190. # Bug 508052: directories used to be too restrictive, have to widen perms.
  191. dirs=( /opt/tivoli $(find /opt/tivoli/tsm -type d) )
  192. chown root:root "${dirs[@]}" || die
  193. chmod 0755 "${dirs[@]}" || die
  194. readme.gentoo_print_elog
  195. }