Add EPREFIX and ED support in all ebuild helpers.
[portage.git] / bin / ebuild-helpers / dosym
1 #!/bin/bash
2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
6
7 if [[ $# -ne 2 ]] ; then
8         helpers_die "${0##*/}: two arguments needed"
9         exit 1
10 fi
11
12 case "$EAPI" in 0|1|2) ED=${D} ;; esac
13
14 if [[ ${2} == */ ]] || \
15         [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
16         # implicit basename not allowed by PMS (bug #379899)
17         eqawarn "QA Notice: dosym target omits basename: '${2}'"
18 fi
19
20 destdir=${2%/*}
21 [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
22
23 ln -snf "$1" "${ED}$2"
24 ret=$?
25 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
26 exit $ret