# Distributed under the terms of the GNU General Public License v2 # $Header: MY_P=${P/netbackup/NetBackup} DESCRIPTION="Veritas NetBackup" HOMEPAGE="http://www.symantec.com/business/netbackup" SRC_URI="${MY_P/-/_}_CLIENTS2.tar.gz doc? (${MY_P/-/_}_Docs.tar.gz)" DOWNLOAD_URL="https://fileconnect.symantec.com" LICENSE="commersial" SLOT="0" IUSE="" KEYWORDS="-amd64 ~ia64 x86" IUSE="java doc" RESTRICT="fetch" #strip #I dont see why we would need the xorg crap DEPEND="sys-libs/lib-compat virtual/libstdc++ sys-apps/xinetd virtual/jre" RDEPEND="${DEPEND}" QA_TEXTRELS="opt/openv/netbackup/lib/* opt/openv/netbackup/bin/*" QA_EXECSTACK="opt/openv/netbackup/lib/* opt/openv/netbackup/bin/*" pkg_nofetch() { einfo "The following files need to be aquired from ${DOWNLOAD_URL}" einfo "and place the file in ${DISTDIR}" einfo "\t${MY_P/-/_}_CLIENTS2.tar.gz" if use doc ; then einfo "\t${MY_P/-/_}_Docs.tar.gz" fi } src_unpack() { elog ${CONFIG_PROTECT} # FIXME Use sed to clean off that date at the end of the folder? MY_WORKDIR="${WORKDIR}/NB_${PV/./}_CLIENTS2_20070723" if [ ! -d ${MY_S} ] ; then die "Expected extraction directory does not exist." fi unpack "${MY_P/-/_}_CLIENTS2.tar.gz" if use doc ; then unpack ${MY_P/-/_}_Docs.tar.gz fi if use x86 ; then # Maybe amd64 useing bin 32 libs. cd "${MY_WORKDIR}/NBClients/anb/Clients/usr/openv/netbackup/client/Linux/RedHat2.6" tar xzf "client_bin.tar.Z" -C ${WORKDIR} elif use ia64 ; then cd "${MY_WORKDIR}/NBClients/anb/Clients/usr/openv/netbackup/client/Linux-IA64/RedHat2.6" tar xzf "client_bin.tar.Z" -C ${WORKDIR} else die "Unknwon archicture" fi cp -f version ${WORKDIR}/openv cp -f tar ${WORKDIR}/openv if use java; then cd "${MY_WORKDIR}/NBClients/anb/Clients/usr/openv" tar xzf "NB-Java.tar.Z" -C ${WORKDIR}/openv fi # Do Help cp -Rf netbackup/help ${WORKDIR}/openv/netbackup } src_install() { #DEST_PREFIX="/usr/openv" DEST_PREFIX="/opt/openv" # Do Help insinto ${DEST_PREFIX}/netbackup/help/ doins openv/netbackup/help/* # Handle all of the bins # FIXME Should probably move 500 exec to sbin into ${DEST_PREFIX}/netbackup/ newbin openv/netbackup/bin/bpcd_new bpcd rm -f openv/netbackup/bin/bpcd_new openv/netbackup/bin/bpcd # FIXME Can we use app-arch/tar ? dobin openv/tar # Fix what looks like another compatibility issue dosym ${DESTTREE}bin/bpbackup ${DESTTREE}bin/bparchive dosym ${DESTTREE}bin/bp.kill_all ${DESTTREE}bin/goodies/bp.kill_all for file in openv/netbackup/bin/*; do if [ ! -d ${file} ]; then dobin ${file} fi done for file in openv/netbackup/bin/goodies/*; do if [ ! -d ${file} ]; then dobin ${file} fi done for file in openv/netbackup/bin/private/*; do if [ ! -d ${file} ]; then dobin ${file} fi done for file in openv/netbackup/bin/support/*; do if [ ! -d ${file} ]; then dobin ${file} fi done # Do Java stuff if use java; then insinto ${DEST_PREFIX}/java/ insopts -m0644 doins openv/java/*.jar doins openv/java/*.properties doins openv/java/*.txt doins openv/java/*.conf doins openv/java/Xenv insopts -m0500 doins openv/java/nonroot_admin_nbjava insopts -m0555 doins openv/java/FSA doins openv/java/get_trace doins openv/java/jbpSA doins openv/java/jnbSA # Fix more compatibility issues dosym ${INSDESTTREE}jbpSA ${DESTTREE}bin/goodies/jbpSA dosym ${INSDESTTREE}jnbSA ${DESTTREE}bin/goodies/jnbSA for file in `find openv/java/vrts/* -print`; do # We are still -m0555 doins ${file} done fi # Do conf files # FIXME prevent overwrite if file exists, such as the etc-update or such ;) insinto ${DEST_PREFIX}/netbackup/ insopts -m0644 sed -e s/YYYYY/"so"/ openv/netbackup/nblog.conf.template > openv/netbackup/nblog.conf doins openv/netbackup/nblog.conf.template doins openv/netbackup/nblog.conf export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSDESTTREE}nblog.conf" # Do bp.conf echo "SERVER = " >> openv/netbackup/bp.conf echo "CLIENT_NAME = `hostname`" >> openv/netbackup/bp.conf echo "SERVER_SENDS_MAIL = YES" >> openv/netbackup/bp.conf echo "SERVER = root@`hostname`" >> openv/netbackup/bp.conf doins openv/netbackup/bp.conf export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSDESTTREE}bp.conf" # Do exclude_list echo "/mnt" >> openv/netbackup/exclude_list doins openv/netbackup/exclude_list export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSDESTTREE}exclude_list" # Copy version to netbackup client folder insinto ${DEST_PREFIX}/netbackup/bin/ insopts -m0444 doins openv/version # Copy resouce data to openv folder insinto ${DEST_PREFIX}/resources/ insopts -m0444 doins openv/resources/* # Copy msg data to openv folder insinto ${DEST_PREFIX}/msg/ insopts -m0555 doins openv/msg/.conf # Do openv bin files # FIXME Should probably move 500 exec to sbin into ${DEST_PREFIX}/ newbin openv/bin/vnetd_new vnetd rm -f openv/bin/vnetd_new openv/bin/vnetd for file in openv/bin/*; do if [ ! -d ${file} ]; then dobin ${file} fi done # Handle the var folders insinto ${DEST_PREFIX}/var/auth/ insopts -m0444 doins openv/var/auth/template.*.txt insopts -m0644 for template in openv/var/auth/template.*.txt do tmp=openv/var/auth/${template/template./} newins ${template} ${tmp##*/} done insinto ${DEST_PREFIX}/var/vnetd/ insopts -m0444 doins openv/var/vnetd/*.txt # chmod 700 ${D}/usr/openv/var/vnetd # Create init scripts newinitd "${FILESDIR}"/nbclient.initd nbclient insinto /etc/xinetd.d newins "${FILESDIR}"/bpcd.xinetd bpcd newins "${FILESDIR}"/bpjava-msvc.xinetd bpjava-msvc newins "${FILESDIR}"/vnetd.xinetd vnetd newins "${FILESDIR}"/vopied.xinetd vopied # Work out all the libraries into ${DEST_PREFIX}/netbackup/ for lib in openv/lib/*.so_new do newlib=${lib##*/} newlib=${newlib/_new/} newlib.so ${lib} ${newlib} done # ACE libraries are versioned. Need a different loop for them. # VxUL libraries are now versioned. Need a different loop for them. for lib in openv/lib/*.so.?_new do newlib=${lib##*/} newlib=${newlib/_new/} newlib.so ${lib} ${newlib} done # The rest of the libraries for lib in openv/lib/*.so do newlib=${lib##*/} newlib=${newlib/_new/} newlib.so ${lib} ${newlib} done for lib in openv/lib/*.so.? do newlib=${lib##*/} newlib=${newlib/_new/} newlib.so ${lib} ${newlib} done # Scheduling broke backward compatibility as far as the JNI # library name. Create a symbolic link as a workaround. #into lib/openv dosym ${DESTTREE}lib/libvxSigScheduleJNI2.so ${DESTTREE}lib/libSigScheduleJNI.so # Add the following to /etc/ld.so.conf and then run ldconfig echo "LDPATH=\"${DESTTREE}/lib\"" >> 99netbackup echo "CONFIG_PROTECT=\"${CONFIG_PROTECT}\"" >> 99netbackup elog ${CONFIG_PROTECT} doenvd 99netbackup # Setup some destionation dirs dodir ${DEST_PREFIX}/netbackup/dbext dodir ${DEST_PREFIX}/netbackup/hardlink_info/root dodir ${DEST_PREFIX}/netbackup/baremetal/client/data dodir ${DEST_PREFIX}/netbackup/tir_info dodir ${DEST_PREFIX}/netbackup/logs dodir ${DEST_PREFIX}/netbackup/logs/user_ops dodir ${DEST_PREFIX}/share dodir ${DEST_PREFIX}/tmp dodir ${DEST_PREFIX}/logs dodir ${DEST_PREFIX}/var/global dodir ${DEST_PREFIX}/var/vxss dodir ${DEST_PREFIX}/var/vxss/credentials } pkg_config() { einfo "Updating /etc/services" { grep -v ^bpcd /etc/services | grep -v ^vopied | grep -v nbdb | grep -v nomdb ; echo -e "bpcd\t\t13782/tcp\t\t\t# VERITAS NetBackup" ; echo -e "bpcd\t\t13782/udp\t\t\t# VERITAS NetBackup" ; echo -e "vopied\t\t13783/tcp\t\t\t# VOPIED Protocol" ; echo -e "vopied\t\t13783/udp\t\t\t# VOPIED Protocol" ; echo -e "nbdb\t\t13785/tcp\t\t\t# NetBackup Database" ; echo -e "nbdb\t\t13785/udp\t\t\t# NetBackup Database" ; echo -e "nomdb\t\t13786/tcp\t\t\t# Veritas-nomdb" ; echo -e "nomdb\t\t13786/udp\t\t\t# Veritas-nomdb" } > /etc/services } pkg_postinst() { einfo "Please check the following files and enable the ones you need." einfo "\t/etc/xinetd.d/bpcd" einfo "\t/etc/xinetd.d/bpjava-msvc" einfo "\t/etc/xinetd.d/vnetd" einfo "\t/etc/xinetd.d/vopied" }