1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit versionator multilib eutils readme.gentoo rpm systemd user
8 DESCRIPTION="Tivoli Storage Manager (TSM) Backup/Archive (B/A) Client and API"
9 HOMEPAGE="http://www.tivoli.com/"
11 MY_PV_MAJOR=$(get_major_version)
12 MY_PV_MINOR=$(get_version_component_range 2)
13 MY_PV_TINY=$(get_version_component_range 3)
14 MY_PV_PATCH=$(get_version_component_range 4)
16 MY_PV_NODOTS="${MY_PV_MAJOR}${MY_PV_MINOR}${MY_PV_TINY}"
19 if [[ ${MY_PV_PATCH} == 0 ]]; then
20 MY_RELEASE_PATH=maintenance
22 MY_RELEASE_PATH=patches
24 BASE_URI="ftp://ftp.software.ibm.com/storage/tivoli-storage-management/"
25 BASE_URI+="${MY_RELEASE_PATH}/client/v${MY_PV_MAJOR}r${MY_PV_MINOR}/"
26 BASE_URI+="Linux/LinuxX86/BA/v${MY_PV_NODOTS}/"
27 SRC_TAR="${MY_PVR_ALLDOTS}-TIV-TSMBAC-LinuxX86.tar"
28 SRC_URI="${BASE_URI}${SRC_TAR}"
30 RESTRICT="strip" # Breaks libPiIMG.so and libPiSNAP.so
31 LICENSE="Apache-1.1 Apache-2.0 JDOM BSD-2 CC-PD Boost-1.0 MIT CPL-1.0 HPND Exolab
32 dom4j EPL-1.0 FTL icu unicode IBM Info-ZIP LGPL-2 LGPL-2.1 openafs-krb5-a
33 ZLIB MPL-1.0 MPL-1.1 NPL-1.1 openssl OPENLDAP RSA public-domain W3C
34 || ( BSD GPL-2+ ) gSOAP libpng tsm"
38 IUSE="acl java +tsm_cit +tsm_hw"
41 MY_LANGS="cs:CS_CZ de:DE_DE es:ES_ES fr:FR_FR hu:HU_HU it:IT_IT ja:JA_JP
42 ko:KO_KR pl:PL_PL pt-BR:PT_BR ru:RU_RU zh-CN:ZH_CN zh-TW:ZH_TW"
43 MY_LANG_PV="${MY_PVR_ALLDOTS}-"
44 for lang in ${MY_LANGS}; do
45 IUSE="${IUSE} l10n_${lang%:*}"
46 SRC_URI="${SRC_URI} l10n_${lang%:*}? ( \
47 ${BASE_URI}TIVsm-msg.${lang#*:}.x86_64.rpm -> \
48 ${MY_LANG_PV}TIVsm-msg.${lang#*:}.x86_64.rpm )"
58 java? ( virtual/jre:1.7 )
66 Note that you have to be either root or member of the group tsm to
67 be able to use the Tivoli Storage Manager client."
76 TIVsm-APIcit.*|TIVsm-BAcit.*)
77 use tsm_cit && rpms="${rpms} ./${rpm}"
80 use tsm_hw && rpms="${rpms} ./${rpm}"
82 TIVsm-JBB.*|*-filepath-*)
83 # "journal based backup" for all filesystems
84 # requires a kernel module.
85 # "Linux Filepath source code" available
86 # by request from vendor
89 rpms="${rpms} ./${rpm}"
103 # Avoid strange error messages caused by read-only files
104 chmod -R u+w "${S}" || die
108 # Avoid unnecessary dependency on ksh
109 sed -i 's:^#!/usr/bin/ksh:#!/bin/bash:' \
110 opt/tivoli/tsm/client/ba/bin/dsmj || die
114 cp -a opt "${D}" || die
115 cp -a usr "${D}" || die
117 # The RPM files contain postinstall scripts which can be extracted
118 # e.g. using https://bugs.gentoo.org/attachment.cgi?id=234663 .
119 # Below we try to mimic the behaviour of these scripts.
120 # We don't deal with SELinux compliance (yet), though.
121 local RPM_INSTALL_PREFIX CLIENTDIR i
122 RPM_INSTALL_PREFIX=/opt
123 CLIENTDIR=$RPM_INSTALL_PREFIX/tivoli/tsm/client
125 # We don't bother setting timestamps to build dates.
126 # But we should delete the corresponding files.
127 rm -f "${D}"$CLIENTDIR/api/bin*/.buildDate || die
128 rm -f "${D}"$CLIENTDIR/ba/bin*/.buildDate || die
129 rm -f "${D}"$CLIENTDIR/lang/.buildDate || die
131 # Create links for messages; this is spread over several postin scripts.
132 for i in $(cd "${D}"${CLIENTDIR}/lang; ls -1d ??_??); do
133 dosym ../../lang/${i} $CLIENTDIR/ba/bin/${i}
134 dosym ../../lang/${i} $CLIENTDIR/api/bin64/${i}
137 # Mimic TIVsm-API64 postinstall script
138 for i in libgpfs.so libdmapi.so; do
139 dosym ../..$CLIENTDIR/api/bin64/${i} /usr/lib64/${i}
142 # The TIVsm-BA postinstall script only does messages and ancient upgrades
144 # The gscrypt64 postinstall script only deals with s390[x] SELinux
145 # and the symlink for the iccs library which we handle in the loop below.
147 # Move stuff from /usr/local to /opt, #452332
148 mv "${D}"/usr/local/ibm "${D}"/opt/ || die
149 rmdir "${D}"/usr/local || die
151 # Mimic gskssl64 postinstall script
152 for i in sys p11 km ssl drld kicc ldap cms acmeidup valn dbfl iccs; do
153 dosym ../../opt/ibm/gsk8_64/lib64/libgsk8${i}_64.so \
154 /usr/lib64/libgsk8${i}_64.so
156 for i in capicmd ver; do
157 dosym ../../opt/ibm/gsk8_64/bin/gsk8${i}_64 /usr/bin/gsk${i}_64
160 # Done with the postinstall scripts as the RPMs contain them.
161 # Now on to some more Gentoo-specific installation.
163 [[ -d "${D}usr/lib" ]] && die "Using 32bit lib dir in 64bit only system"
165 # Avoid "QA Notice: Found an absolute symlink in a library directory"
167 find "${D}"usr/lib* -lname '/*' | while read i; do
168 target=$(readlink "${i}")
170 dosym "../..${target}" "${i#${D}}"
173 # Install symlinks for sonames of libraries, bug #416503
174 dosym libvixMntapi.so.1.1.0 $CLIENTDIR/ba/bin/libvixMntapi.so.1
175 dosym libvixDiskLibVim.so.5.5.0 $CLIENTDIR/ba/bin/libvixDiskLibVim.so.5
176 dosym libvixDiskLib.so.5.5.0 $CLIENTDIR/ba/bin/libvixDiskLib.so.5
178 fowners :tsm /opt/tivoli/tsm/client/ba/bin/dsmtca
179 fperms 4710 /opt/tivoli/tsm/client/ba/bin/dsmtca
182 insinto /etc/logrotate.d
183 newins "${FILESDIR}/tsm.logrotate" tsm
187 cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.sys.smp" "${D}/etc/tivoli/dsm.sys" || die
188 echo ' PasswordDir "/etc/tivoli/"' >> ${D}/etc/tivoli/dsm.sys
189 echo ' PasswordAccess generate' >> ${D}/etc/tivoli/dsm.sys
191 # Added the hostname to be more friendly, the admin will need to edit this file anyway
192 echo ' NodeName' `hostname` >> ${D}/etc/tivoli/dsm.sys
193 echo ' ErrorLogName "/var/log/tsm/dsmerror.log"' >> ${D}/etc/tivoli/dsm.sys
194 echo ' SchedLogName "/var/log/tsm/dsmsched.log"' >> ${D}/etc/tivoli/dsm.sys
195 dosym ../../../../../../etc/tivoli/dsm.sys /opt/tivoli/tsm/client/ba/bin/dsm.sys
197 cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.opt.smp" "${D}/etc/tivoli/dsm.opt"
198 dosym ../../../../../../etc/tivoli/dsm.opt /opt/tivoli/tsm/client/ba/bin/dsm.opt
202 ENV_FILE="${D}/etc/env.d/80tivoli"
203 echo 'DSM_CONFIG="/etc/tivoli/dsm.opt"' >> ${ENV_FILE}
204 echo 'DSM_DIR="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
205 echo 'DSM_LOG="/var/log/tsm"' >> ${ENV_FILE}
206 echo 'ROOTPATH="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
208 newconfd "${FILESDIR}/dsmc.conf.d" dsmc
209 newinitd "${FILESDIR}/dsmc.init.d" dsmc
210 newinitd "${FILESDIR}/dsmcad.init.d-r1" dsmcad
212 systemd_dounit "${FILESDIR}/dsmc.service"
213 systemd_dounit "${FILESDIR}/dsmcad.service"
215 readme.gentoo_create_doc
220 for i in /var/log/tsm/dsm{error,sched,j,webcl}.log; do
221 if [[ ! -e $i ]]; then
228 # Bug #375041: the log directory itself should not be world writable.
229 # Have to do this in postinst due to bug #141619
230 chown root:tsm /var/log/tsm || die
231 chmod 0750 /var/log/tsm || die
233 # Bug 508052: directories used to be too restrictive, have to widen perms.
234 dirs=( /opt/tivoli $(find /opt/tivoli/tsm -type d) )
235 chown root:root "${dirs[@]}" || die
236 chmod 0755 "${dirs[@]}" || die
238 readme.gentoo_print_elog