| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-backup/tsm/tsm-6.2.2.0-r1.ebuild,v 1.6 2012/07/12 14:16:32 axs Exp $
|
| 4 |
|
| 5 |
EAPI=3
|
| 6 |
|
| 7 |
inherit versionator multilib eutils rpm pax-utils user
|
| 8 |
|
| 9 |
DESCRIPTION="Tivoli Storage Manager (TSM) Backup/Archive (B/A) Client and API"
|
| 10 |
HOMEPAGE="http://www.tivoli.com/"
|
| 11 |
|
| 12 |
MY_PV_MAJOR=$(get_major_version)
|
| 13 |
MY_PV_MINOR=$(get_version_component_range 2)
|
| 14 |
MY_PV_TINY=$(get_version_component_range 3)
|
| 15 |
|
| 16 |
MY_PV_NODOTS="${MY_PV_MAJOR}${MY_PV_MINOR}${MY_PV_TINY}"
|
| 17 |
MY_PVR_ALLDOTS=${PV}
|
| 18 |
|
| 19 |
BASE_URI="ftp://ftp.software.ibm.com/storage/tivoli-storage-management/maintenance/client/v${MY_PV_MAJOR}r${MY_PV_MINOR}/Linux/LinuxX86/v${MY_PV_NODOTS}/"
|
| 20 |
SRC_TAR="${MY_PVR_ALLDOTS}-TIV-TSMBAC-LinuxX86.tar"
|
| 21 |
SRC_URI="${BASE_URI}${SRC_TAR}"
|
| 22 |
|
| 23 |
RESTRICT="strip" # Breaks libPiIMG.ss and libPiSNAP.so
|
| 24 |
LICENSE="as-is Apache-1.1 JDOM gSOAP GPL-2"
|
| 25 |
SLOT="0"
|
| 26 |
KEYWORDS="~x86 ~amd64"
|
| 27 |
IUSE="hsm"
|
| 28 |
|
| 29 |
MY_LANGS="cs:CS_CZ de:DE_DE es:ES_ES fr:FR_FR hu:HU_HU it:IT_IT
|
| 30 |
ja:JA_JP ko:KO_KR pl:PL_PL pt:PT_BR ru:RU_RU zh:ZH_CN zh_TW:ZH_TW"
|
| 31 |
MY_LANG_PV="$(get_version_component_range 1-3)-"
|
| 32 |
for lang in ${MY_LANGS}; do
|
| 33 |
IUSE="${IUSE} linguas_${lang%:*}"
|
| 34 |
SRC_URI="${SRC_URI} linguas_${lang%:*}? ( ${BASE_URI}TIVsm-msg.${lang#*:}.i386.rpm -> ${MY_LANG_PV}TIVsm-msg.${lang#*:}.i386.rpm )"
|
| 35 |
done
|
| 36 |
unset lang
|
| 37 |
|
| 38 |
DEPEND=""
|
| 39 |
RDEPEND="sys-libs/libstdc++-v3"
|
| 40 |
|
| 41 |
S="${WORKDIR}"
|
| 42 |
|
| 43 |
pkg_setup() {
|
| 44 |
enewgroup tsm
|
| 45 |
}
|
| 46 |
|
| 47 |
src_unpack() {
|
| 48 |
local rpm rpms lang
|
| 49 |
unpack ${SRC_TAR}
|
| 50 |
|
| 51 |
for rpm in *.rpm; do
|
| 52 |
case ${rpm} in
|
| 53 |
gsk*64-*|*API64*)
|
| 54 |
use amd64 && rpms="${rpms} ./${rpm}"
|
| 55 |
;;
|
| 56 |
*HSM*)
|
| 57 |
use hsm && rpms="${rpms} ./${rpm}"
|
| 58 |
;;
|
| 59 |
*)
|
| 60 |
rpms="${rpms} ./${rpm}"
|
| 61 |
;;
|
| 62 |
esac
|
| 63 |
done
|
| 64 |
for rpm in ${A}; do
|
| 65 |
case ${rpm} in
|
| 66 |
*.rpm)
|
| 67 |
rpms="${rpms} ${rpm}"
|
| 68 |
;;
|
| 69 |
esac
|
| 70 |
done
|
| 71 |
|
| 72 |
rpm_unpack ${rpms}
|
| 73 |
|
| 74 |
# Avoid strange error messages caused by read-only files
|
| 75 |
chmod -R u+w "${S}"
|
| 76 |
}
|
| 77 |
|
| 78 |
src_prepare() {
|
| 79 |
# Avoid unnecessary dependency on ksh
|
| 80 |
sed -i 's:^#!/usr/bin/ksh:#!/bin/bash:' \
|
| 81 |
opt/tivoli/tsm/client/ba/bin/dsmj
|
| 82 |
}
|
| 83 |
|
| 84 |
src_install() {
|
| 85 |
cp -a opt "${D}"
|
| 86 |
cp -a usr "${D}"
|
| 87 |
|
| 88 |
# The RPM files contain postinstall scripts which can be extracted
|
| 89 |
# e.g. using https://bugs.gentoo.org/attachment.cgi?id=234663 .
|
| 90 |
# Below we try to mimic the behaviour of these scripts.
|
| 91 |
# We don't deal with SELinux compliance (yet), though.
|
| 92 |
local RPM_INSTALL_PREFIX CLIENTDIR TIVINV_DIR TIVINVFILE i
|
| 93 |
RPM_INSTALL_PREFIX=/opt
|
| 94 |
CLIENTDIR=$RPM_INSTALL_PREFIX/tivoli/tsm/client
|
| 95 |
|
| 96 |
# We don't bother setting timestamps to build dates.
|
| 97 |
# But we should delete the corresponding files.
|
| 98 |
rm -f "${D}"$CLIENTDIR/api/bin*/.buildDate
|
| 99 |
rm -f "${D}"$CLIENTDIR/ba/bin*/.buildDate
|
| 100 |
rm -f "${D}"$CLIENTDIR/lang/.buildDate
|
| 101 |
|
| 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/bin/${i}
|
| 106 |
use amd64 && dosym ../../lang/${i} $CLIENTDIR/api/bin64/${i}
|
| 107 |
done
|
| 108 |
|
| 109 |
# Mimic TIVsm-API and -API64 postinstall script
|
| 110 |
for i in libgpfs.so libdmapi.so; do
|
| 111 |
dosym ../..$CLIENTDIR/api/bin/${i} /usr/lib
|
| 112 |
done
|
| 113 |
dosym ../..$CLIENTDIR/ba/bin/libzephyr.so /usr/lib/libTSMNetAppzephyr.so
|
| 114 |
|
| 115 |
# Mimic TIVsm-BA postinstall script
|
| 116 |
for i in /etc/adsm{,/SpaceMan,/config,/status}; do
|
| 117 |
keepdir ${i}
|
| 118 |
fowners bin:bin ${i}
|
| 119 |
fperms 2775 ${i}
|
| 120 |
done
|
| 121 |
TIVINV_DIR="/opt/tivoli/tsm/tivinv"
|
| 122 |
TIVINVFILE="TIVTSMBAC0602.SYS2"
|
| 123 |
dodir $TIVINV_DIR
|
| 124 |
echo " " \
|
| 125 |
> "${D}$TIVINV_DIR/$TIVINVFILE"
|
| 126 |
fperms 555 $TIVINV_DIR/$TIVINVFILE
|
| 127 |
|
| 128 |
# Haven't ported the TIVsm-HSM postinstall script (yet).
|
| 129 |
if use hsm; then
|
| 130 |
ewarn "This ebuild doesn't mimic the HSM postinstall script."
|
| 131 |
fi
|
| 132 |
|
| 133 |
# The gscrypt{32|64} postinstall script only deals with s390[x] SELinux.
|
| 134 |
|
| 135 |
# Mimic gskssl32 postinstall script
|
| 136 |
for i in acmeidup valn km cms p11 dbfl kicc ssl sys ldap drld iccs; do
|
| 137 |
dosym ../local/ibm/gsk8/lib/libgsk8${i}.so /usr/lib/libgsk8${i}.so
|
| 138 |
done
|
| 139 |
for i in capicmd ver; do
|
| 140 |
dosym ../local/ibm/gsk8/bin/gsk8${i} /usr/bin/${i}
|
| 141 |
done
|
| 142 |
|
| 143 |
# Mimic gskssl64 postinstall script
|
| 144 |
if use amd64; then
|
| 145 |
for i in sys p11 km ssl drld kicc ldap cms acmeidup valn dbfl iccs; do
|
| 146 |
dosym ../local/ibm/gsk8_64/lib64/libgsk8${i}_64.so \
|
| 147 |
/usr/lib64/libgsk8${i}_64.so
|
| 148 |
done
|
| 149 |
for i in capicmd ver; do
|
| 150 |
dosym ../local/ibm/gsk8_64/bin/gsk8${i}_64 /usr/bin/${i}_64
|
| 151 |
done
|
| 152 |
fi
|
| 153 |
|
| 154 |
# Done with the postinstall scripts as the RPMs contain them.
|
| 155 |
# Now on to some more Gentoo-specific installation.
|
| 156 |
|
| 157 |
use amd64 && mv "${D}usr/lib" "${D}usr/lib32"
|
| 158 |
|
| 159 |
fowners -R :tsm /opt/tivoli
|
| 160 |
fperms -R g+rX,o-rX /opt/tivoli # Allow only tsm group users to access TSM tools
|
| 161 |
fperms 4710 /opt/tivoli/tsm/client/ba/bin/dsmtca
|
| 162 |
|
| 163 |
keepdir /var/log/tsm
|
| 164 |
fowners :tsm /var/log/tsm
|
| 165 |
fperms 2770 /var/log/tsm
|
| 166 |
insinto /etc/logrotate.d
|
| 167 |
newins "${FILESDIR}/tsm.logrotate" tsm
|
| 168 |
|
| 169 |
keepdir /etc/tivoli
|
| 170 |
|
| 171 |
cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.sys.smp" "${D}/etc/tivoli/dsm.sys"
|
| 172 |
echo ' PasswordDir "/etc/tivoli/"' >> ${D}/etc/tivoli/dsm.sys
|
| 173 |
echo ' PasswordAccess generate' >> ${D}/etc/tivoli/dsm.sys
|
| 174 |
|
| 175 |
# Added the hostname to be more friendly, the admin will need to edit this file anyway
|
| 176 |
echo ' NodeName' `hostname` >> ${D}/etc/tivoli/dsm.sys
|
| 177 |
echo ' ErrorLogName "/var/log/tsm/dsmerror.log"' >> ${D}/etc/tivoli/dsm.sys
|
| 178 |
echo ' SchedLogName "/var/log/tsm/dsmsched.log"' >> ${D}/etc/tivoli/dsm.sys
|
| 179 |
dosym ../../../../../../etc/tivoli/dsm.sys /opt/tivoli/tsm/client/ba/bin/dsm.sys
|
| 180 |
|
| 181 |
cp -a "${S}/opt/tivoli/tsm/client/ba/bin/dsm.opt.smp" "${D}/etc/tivoli/dsm.opt"
|
| 182 |
dosym ../../../../../../etc/tivoli/dsm.opt /opt/tivoli/tsm/client/ba/bin/dsm.opt
|
| 183 |
|
| 184 |
# Setup the env
|
| 185 |
dodir /etc/env.d
|
| 186 |
ENV_FILE="${D}/etc/env.d/80tivoli"
|
| 187 |
echo 'DSM_CONFIG="/etc/tivoli/dsm.opt"' >> ${ENV_FILE}
|
| 188 |
echo 'DSM_DIR="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
|
| 189 |
echo 'DSM_LOG="/var/log/tsm"' >> ${ENV_FILE}
|
| 190 |
echo 'ROOTPATH="/opt/tivoli/tsm/client/ba/bin"' >> ${ENV_FILE}
|
| 191 |
|
| 192 |
newconfd "${FILESDIR}/dsmc.conf.d" dsmc
|
| 193 |
newinitd "${FILESDIR}/dsmc.init.d" dsmc
|
| 194 |
newinitd "${FILESDIR}/dsmcad.init.d" dsmcad
|
| 195 |
|
| 196 |
elog
|
| 197 |
elog "Note that you have to be either root or member of the group tsm to be able to use the"
|
| 198 |
elog "Tivoli Storage Manager client."
|
| 199 |
elog
|
| 200 |
|
| 201 |
}
|
| 202 |
|
| 203 |
pkg_postinst() {
|
| 204 |
local i
|
| 205 |
for i in /var/log/tsm/dsm{error,sched,j,webcl}.log; do
|
| 206 |
if [[ ! -e $i ]]; then
|
| 207 |
touch $i
|
| 208 |
chown :tsm $i
|
| 209 |
chmod 0660 $i
|
| 210 |
fi
|
| 211 |
done
|
| 212 |
}
|
| 213 |
|
| 214 |
pkg_postinst()
|
| 215 |
{
|
| 216 |
pax-mark psme /opt/tivoli/tsm/client/ba/bin/dsmc
|
| 217 |
# most likely some of the other executables (e.g. dsm) need this as well, but I
|
| 218 |
# cannot test it at the moment. - dilfridge
|
| 219 |
}
|