ebuild-activate: tweaks; add more aliases; mark time

Signed-off-by: Maciej Barć <xgqt@riseup.net>
This commit is contained in:
Maciej Barć 2021-07-05 14:13:02 +02:00
parent 5db7afa3d5
commit 82a583f00d
No known key found for this signature in database
GPG Key ID: 031C9FE65BED714A
1 changed files with 30 additions and 3 deletions

View File

@ -21,6 +21,7 @@
# Exit if script is not sourced # Exit if script is not sourced
case ${-} case ${-}
in in
*i* ) *i* )
@ -35,11 +36,28 @@ in
esac esac
# Set variables for ebuild development # Internal
_timest="$(date +%Y-%m-%d_%H:%M:%S || echo 'null')"
_tmpdir='/tmp/edev' _tmpdir='/tmp/edev'
_toplevel="$(git rev-parse --show-toplevel || echo '/dev/null')" _toplevel="$(git rev-parse --show-toplevel || echo '/dev/null')"
# Mark time when user entered environment for given repository
if mkdir -p "${_tmpdir}"
then
if cd "${_tmpdir}"
then
ln -fs "${_toplevel}" "${_timest}"
cd - ||
echo 'Bug?'
fi
fi
# Set variables for ebuild development
ACCEPT_LICENSE='*' ACCEPT_LICENSE='*'
export ACCEPT_LICENSE export ACCEPT_LICENSE
@ -73,20 +91,29 @@ fi
if [ -e "${_toplevel}/profiles/repo_name" ] if [ -e "${_toplevel}/profiles/repo_name" ]
then then
PORTDIR="${_toplevel}" PORTDIR="${_toplevel}"
export PORTDIR export PORTDIR
fi fi
PS1="(ebuild) ${PS1}" PS1="(ebuild) ${PS1}"
# Some helpful aliases
alias cd-edev='cd ${_tmpdir}' alias cd-edev='cd ${_tmpdir}'
alias cd-repo='cd ${_toplevel}' alias cd-repo='cd ${_toplevel}'
alias cd-dist='cd ${DISTDIR}'
alias cd-elog='cd ${PORTAGE_LOGDIR}'
alias clean-edev='rm -r ${_tmpdir}' alias clean-edev='rm -r ${_tmpdir}'
alias clean-dist='rm -r ${DISTDIR}'
alias clean-elog='rm -r ${PORTAGE_LOGDIR}'
alias ls-edev='ls -ahl ${_tmpdir}'
alias ls-repo='ls -ahl ${_toplevel}'
alias ls-dist='ls -ahl ${DISTDIR}' alias ls-dist='ls -ahl ${DISTDIR}'
alias ls-elog='ls -ahl ${PORTAGE_LOGDIR}' alias ls-elog='ls -ahl ${PORTAGE_LOGDIR}'
clear
echo ">>> Entering Ebuild development environment" echo ">>> Entering Ebuild development environment"