Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions prefix_retain.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The environment variables that should be kept when entering prefix
# Example:
#
# WAYLAND_DISPLAY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make these default.

# XDG_RUNTIME_DIR
#
# This will keep WAYLAND_DISPLAY and XDG_RUNTIME_DIR environment variables

8 changes: 8 additions & 0 deletions startprefix
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export SHELL

# give a small notice
echo "Starting Gentoo Prefix shell ${SHELL}"
echo "Edit ${EPREFIX}/etc/prefix_retain.conf to add environment variables to keep"
echo "[exit the shell to deactivate Gentoo Prefix]"
# start the login shell, clean the entire environment but what's needed
RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
Expand All @@ -69,6 +70,13 @@ if [[ -d /proc/registry ]]; then # we're on Cygwin
# some Windows programs (e.g. devenv.exe) need TMP or TEMP
[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
fi

# Load user defined RETAIN variables
while IFS= read -r key; do
[[ -z "$key" || "$key" == \#* ]] && continue
RETAIN+=" $key=${!key}"
done < ${EPREFIX}/etc/prefix_retain.conf

# do it!
if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
Expand Down