summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-08-25 12:42:28 -0700
committerZac Medico <zmedico@gentoo.org>2012-08-25 12:42:28 -0700
commita60b86d4af93b066345c8c8cea5c5c91ab26ce44 (patch)
treeab03d147cdf40270621bb58e99e31ff8884ff6d4
parentebf5d1a64a4a40a0efeba3b038122eef375ace94 (diff)
downloadportage-a60b86d4af93b066345c8c8cea5c5c91ab26ce44.tar.gz
portage-a60b86d4af93b066345c8c8cea5c5c91ab26ce44.tar.bz2
portage-a60b86d4af93b066345c8c8cea5c5c91ab26ce44.zip
newins: become generic so new* can be symlinks
-rwxr-xr-xbin/ebuild-helpers/newins39
1 files changed, 20 insertions, 19 deletions
diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index b5b3ff6f4..345c2290b 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -4,35 +4,36 @@
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+helper=${0##*/}
+
if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
- helpers_die "${0##*/}: Need two arguments, old file and new file"
+ helpers_die "${helper}: Need two arguments, old file and new file"
exit 1
fi
if [ ! -e "$1" ] ; then
- helpers_die "!!! ${0##*/}: $1 does not exist"
+ helpers_die "!!! ${helper}: $1 does not exist"
exit 1
fi
(($#>2)) && \
- eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+ eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${@:3}"
+
+cp_args="-f"
+if [[ ${helper} == newins ]] ; then
+ case "${EAPI}" in
+ 0|1|2|3)
+ ;;
+ *)
+ cp_args+=" -P"
+ ;;
+ esac
+fi
-rm -rf "${T}/${2}" || exit $?
-case "$EAPI" in
- 0|1|2|3)
- cp "$1" "$T/$2" || exit $?
- ;;
- *)
- cp -P "$1" "$T/$2"
- ret=$?
- if [[ $ret -ne 0 ]] ; then
- helpers_die "${0##*/} failed"
- exit $ret
- fi
- ;;
-esac
-doins "${T}/${2}"
+rm -rf "${T}/$2" && \
+cp ${cp_args} "$1" "${T}/$2" && \
+do${helper#new} "${T}/$2"
ret=$?
rm -rf "${T}/${2}"
-[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
+[[ $ret -ne 0 ]] && helpers_die "${helper} failed"
exit $ret