diff options
author | Miroslav Šulc <fordfrog@gentoo.org> | 2007-01-14 13:17:59 +0000 |
---|---|---|
committer | Miroslav Šulc <fordfrog@gentoo.org> | 2007-01-14 13:17:59 +0000 |
commit | 247a5e463efa313554ae2b4c3b05ffca2114a01a (patch) | |
tree | 81e6f3a51ba9791e5877db2de3d152b4f5c74748 /eclass | |
parent | Version bump, this version has some significant changes in deps, I also added... (diff) | |
download | java-247a5e463efa313554ae2b4c3b05ffca2114a01a.tar.gz java-247a5e463efa313554ae2b4c3b05ffca2114a01a.tar.bz2 java-247a5e463efa313554ae2b4c3b05ffca2114a01a.zip |
eclass for Netbeans 5.5 packs
svn path=/migrated-java-experimental-overlay/; revision=3533
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/netbeans-5.5-pack.eclass | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/eclass/netbeans-5.5-pack.eclass b/eclass/netbeans-5.5-pack.eclass new file mode 100644 index 00000000..fe7cb58c --- /dev/null +++ b/eclass/netbeans-5.5-pack.eclass @@ -0,0 +1,118 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# +# Original Author: fordfrog +# Purpose: Provide unified framework for installing Netbeans 5.5 extra packs +# + +ECLASS="netbeans-5.5-pack" +INHERITED="$INHERITED $ECLASS" + +IUSE="" +SLOT="5.5" + +DEPEND="=dev-util/netbeans-${SLOT}*" +RDEPEND="=dev-util/netbeans-${SLOT}*" + +# You can override these variables if needed +MY_PV="$(replace_all_version_separators '_' ${PV})" +MY_P="${PN}-${MY_PV}" +BIN_FILE="${MY_P}-linux.bin" + +# Some netbeans packs install all the files into current directory whereas +# some other packs install the files into extra directory (like 'cnd1/<files>'). +# If you are creating ebuild for such pack then you must specify the UNPACK_DIR +# so the pack is installed correctly. +UNPACK_DIR="." + +NB_DIR="/usr/share/netbeans-${SLOT}" +CLUSTER_FILE="${NB_DIR}/etc/netbeans.clusters" +PRODUCTID_FILE="${NB_DIR}/nb${SLOT}/config/productid" + +EXPORT_FUNCTIONS src_unpack src_install pkg_postinst pkg_postrm + + +# standard src_unpack() for netbeans extra packs +# TODO: it would be better to get rid of addwrite functions (ie move the home to T or +# something else that would work) +netbeans-5.5-pack_src_unpack() { + # Walk-around: copy installer to working-directory + cp ${DISTDIR}/${BIN_FILE} ${WORKDIR}/ + chmod u+x ${WORKDIR}/${BIN_FILE} + + # allow the installer to write stupid files (illusion) + if [ "${LOGNAME}" = "root" ]; then + addwrite /root + else + addwrite /home/${LOGNAME} + fi + + # execute installer + # We must change user HOME dir so the installer does not cause sandbox violation + ${WORKDIR}/${BIN_FILE} -silent + + # Walk-around: remove installer again + rm ${WORKDIR}/${BIN_FILE} + + # remove unnecessary uninstall informations + rm -R ${UNPACK_DIR}/_uninst +} + + +# standard src_install() for netbeans extra packs +netbeans-5.5-pack_src_install() { + # install everything into netbeans subfolders + netbeans-5.5-pack_check-cluster + insinto ${NB_DIR}/${CLUSTER} + doins -r ${WORKDIR}/${UNPACK_DIR}/* +} + + +# standard pkg_postinst() for netbeans extra packs +netbeans-5.5-pack_pkg_postinst () { + einfo "Updating Netbeans ${SLOT} configuration" + netbeans-5.5-pack_check-cluster + netbeans-5.5-pack_check-productid + + if [ -z "$(grep ${CLUSTER} ${CLUSTER_FILE})" ]; then + echo "${CLUSTER}" >> ${CLUSTER_FILE} + fi + + if [ ! -f ${PRODUCTID_FILE} ]; then + echo NB_PROF > ${PRODUCTID_FILE} + elif [ -z "$(grep NB_PROF ${PRODUCTID_FILE})" ]; then + echo NB_PROF >> ${PRODUCTID_FILE} + fi + eend +} + + +# standard pkg_postrm() for netbeans extra packs +netbeans-5.5-pack_pkg_postrm() { + einfo "Updating Netbeans ${SLOT} configuration" + netbeans-5.5-pack_check-cluster + netbeans-5.5-pack_check-productid + sed -i -e "s/${CLUSTER}//" ${CLUSTER_FILE} + sed -i -e "s/${PRODUCTID}//" ${PRODUCTID_FILE} + eend +} + + +# check whether CLUSTER variable is set and issues error if it is empty +netbeans-5.5-pack_check-cluster() { + # CLUSTER must be set + if [ -z "${CLUSTER}" ]; then + eerror "CLUSTER variable must be set in the ebuild" + fi +} + + +# check whether PRODUCTID variable is set and issues error if it is empty +netbeans-5.5-pack_check-productid() { + # PRODUCTID must be set + if [ -z "${PRODUCTID}" ]; then + eerror "PRODUCTID variable must be set in the ebuild" + fi +} |