tsm-7.1.4.4.ebuild 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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 pax-utils
  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. # not available (yet?)
  33. #MY_LANGS="cs:CS_CZ de:DE_DE es:ES_ES fr:FR_FR hu:HU_HU it:IT_IT ja:JA_JP
  34. # ko:KO_KR pl:PL_PL pt-BR:PT_BR ru:RU_RU zh-CN:ZH_CN zh-TW:ZH_TW"
  35. MY_LANG_PV="${MY_PVR_ALLDOTS}-"
  36. for lang in ${MY_LANGS}; do
  37. IUSE="${IUSE} l10n_${lang%:*}"
  38. SRC_URI="${SRC_URI} l10n_${lang%:*}? ( \
  39. ${BASE_URI}TIVsm-msg.${lang#*:}.x86_64.rpm -> \
  40. ${MY_LANG_PV}TIVsm-msg.${lang#*:}.x86_64.rpm )"
  41. done
  42. unset lang
  43. DEPEND=""
  44. RDEPEND="
  45. dev-libs/expat
  46. dev-libs/libxml2
  47. =sys-fs/fuse-2*
  48. acl? ( sys-apps/acl )
  49. java? ( virtual/jre:1.7 )
  50. "
  51. S="${WORKDIR}/bacli"
  52. pkg_setup() {
  53. enewgroup tsm
  54. DOC_CONTENTS="
  55. Note that you have to be either root or member of the group tsm to
  56. be able to use the Tivoli Storage Manager client."
  57. }
  58. src_unpack() {
  59. local rpm rpms lang
  60. unpack ${SRC_TAR}
  61. cd "${S}"
  62. for rpm in *.rpm; do
  63. case ${rpm} in
  64. TIVsm-APIcit.*|TIVsm-BAcit.*)
  65. use tsm_cit && rpms="${rpms} ./${rpm}"
  66. ;;
  67. TIVsm-BAhdw.*)
  68. use tsm_hw && rpms="${rpms} ./${rpm}"
  69. ;;
  70. TIVsm-JBB.*|*-filepath-*)
  71. # "journal based backup" for all filesystems
  72. # requires a kernel module.
  73. # "Linux Filepath source code" available
  74. # by request from vendor
  75. ;;
  76. *)
  77. rpms="${rpms} ./${rpm}"
  78. ;;
  79. esac
  80. done
  81. for rpm in ${A}; do
  82. case ${rpm} in
  83. *.rpm)
  84. rpms="${rpms} ${rpm}"
  85. ;;
  86. esac
  87. done
  88. rpm_unpack ${rpms}
  89. # Avoid strange error messages caused by read-only files
  90. chmod -R u+w "${S}" || die
  91. }
  92. src_install(){
  93. cp -a opt "${D}" || die
  94. cp -a usr "${D}" || die
  95. # The RPM files contain postinstall scripts which can be extracted
  96. # e.g. using https://bugs.gentoo.org/attachment.cgi?id=234663 .
  97. # Below we try to mimic the behaviour of these scripts.
  98. # We don't deal with SELinux compliance (yet), though.
  99. local RPM_INSTALL_PREFIX CLIENTDIR i
  100. RPM_INSTALL_PREFIX=/opt
  101. CLIENTDIR=$RPM_INSTALL_PREFIX/tivoli/tsm/client
  102. # Create links for messages; this is spread over several postin scripts.
  103. #for i in $(cd "${D}"${CLIENTDIR}/lang; ls -1d ??_??); do
  104. # dosym ../../lang/${i} $CLIENTDIR/ba/bin/${i}
  105. # dosym ../../lang/${i} $CLIENTDIR/api/bin64/${i}
  106. #done
  107. # Mimic TIVsm-API64 postinstall script
  108. for i in libgpfs.so libdmapi.so; do
  109. dosym ../..$CLIENTDIR/api/bin64/${i} /usr/lib64/${i}
  110. done
  111. # The TIVsm-BA postinstall script only does messages and ancient upgrades
  112. # The gscrypt64 postinstall script only deals with s390[x] SELinux
  113. # and the symlink for the iccs library which we handle in the loop below.
  114. # Move stuff from /usr/local to /opt, #452332
  115. mv "${D}"/usr/local/ibm "${D}"/opt/ || die
  116. rmdir "${D}"/usr/local || die
  117. # Mimic gskssl64 postinstall script
  118. for i in sys p11 km ssl drld kicc ldap cms acmeidup valn dbfl iccs; do
  119. dosym ../../opt/ibm/gsk8_64/lib64/libgsk8${i}_64.so \
  120. /usr/lib64/libgsk8${i}_64.so
  121. done
  122. for i in capicmd ver; do
  123. dosym ../../opt/ibm/gsk8_64/bin/gsk8${i}_64 /usr/bin/gsk${i}_64
  124. done
  125. # Done with the postinstall scripts as the RPMs contain them.
  126. # Now on to some more Gentoo-specific installation.
  127. [[ -d "${D}usr/lib" ]] && die "Using 32bit lib dir in 64bit only system"
  128. # Avoid "QA Notice: Found an absolute symlink in a library directory"
  129. local target
  130. find "${D}"usr/lib* -lname '/*' | while read i; do
  131. target=$(readlink "${i}")
  132. rm -v "${i}" || die
  133. dosym "../..${target}" "${i#${D}}"
  134. done
  135. fowners :tsm /opt/tivoli/tsm/client/ba/bin/dsmtca
  136. fperms 4710 /opt/tivoli/tsm/client/ba/bin/dsmtca
  137. keepdir /var/log/tsm
  138. insinto /etc/logrotate.d
  139. newins "${FILESDIR}/tsm.logrotate" tsm
  140. keepdir /etc/tivoli
  141. cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.sys.smp" "${D}/etc/tivoli/dsm.sys" || die
  142. echo ' PasswordDir "/etc/tivoli/"' >> ${D}/etc/tivoli/dsm.sys
  143. echo ' PasswordAccess generate' >> ${D}/etc/tivoli/dsm.sys
  144. # Added the hostname to be more friendly, the admin will need to edit this file anyway
  145. echo ' NodeName' `hostname` >> ${D}/etc/tivoli/dsm.sys
  146. echo ' ErrorLogName "/var/log/tsm/dsmerror.log"' >> ${D}/etc/tivoli/dsm.sys
  147. echo ' SchedLogName "/var/log/tsm/dsmsched.log"' >> ${D}/etc/tivoli/dsm.sys
  148. dosym ../../../../../../etc/tivoli/dsm.sys /opt/tivoli/tsm/client/ba/bin/dsm.sys
  149. cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.opt.smp" "${D}/etc/tivoli/dsm.opt"
  150. dosym ../../../../../../etc/tivoli/dsm.opt /opt/tivoli/tsm/client/ba/bin/dsm.opt
  151. # Setup the env
  152. dodir /etc/env.d
  153. ENV_FILE="${D}/etc/env.d/80tivoli"
  154. echo 'DSM_CONFIG="/etc/tivoli/dsm.opt"' >> ${ENV_FILE}
  155. echo 'DSM_DIR="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
  156. echo 'DSM_LOG="/var/log/tsm"' >> ${ENV_FILE}
  157. echo 'ROOTPATH="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
  158. newconfd "${FILESDIR}/dsmc.conf.d" dsmc
  159. newinitd "${FILESDIR}/dsmc.init.d" dsmc
  160. newinitd "${FILESDIR}/dsmcad.init.d-r1" dsmcad
  161. # Need this for hardened, otherwise a cryptic "connection to server lost" message appears
  162. pax-mark -m "${D}/opt/tivoli/tsm/client/ba/bin/dsmc"
  163. systemd_dounit "${FILESDIR}/dsmc.service"
  164. systemd_dounit "${FILESDIR}/dsmcad.service"
  165. readme.gentoo_create_doc
  166. }
  167. pkg_postinst() {
  168. local i dirs
  169. for i in /var/log/tsm/dsm{error,sched,j,webcl}.log; do
  170. if [[ ! -e $i ]]; then
  171. touch $i || die
  172. chown :tsm $i || die
  173. chmod 0660 $i || die
  174. fi
  175. done
  176. # Bug #375041: the log directory itself should not be world writable.
  177. # Have to do this in postinst due to bug #141619
  178. chown root:tsm /var/log/tsm || die
  179. chmod 0750 /var/log/tsm || die
  180. # Bug 508052: directories used to be too restrictive, have to widen perms.
  181. dirs=( /opt/tivoli $(find /opt/tivoli/tsm -type d) )
  182. chown root:root "${dirs[@]}" || die
  183. chmod 0755 "${dirs[@]}" || die
  184. readme.gentoo_print_elog
  185. }