summaryrefslogtreecommitdiff
path: root/functions.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'functions.zsh')
-rw-r--r--functions.zsh30
1 files changed, 30 insertions, 0 deletions
diff --git a/functions.zsh b/functions.zsh
new file mode 100644
index 0000000..b068b3c
--- /dev/null
+++ b/functions.zsh
@@ -0,0 +1,30 @@
+if [[ ${UID} = 0 ]]; then
+ return
+fi
+
+if [[ -f /lib/gentoo/functions.sh ]]; then
+ source /lib/gentoo/functions.sh
+fi
+
+wl-clear() {
+ wl-copy --clear
+ wl-copy --primary --clear
+}
+
+with-userns() {
+ if [[ ${1} =~ '^[0-9]+$' ]]; then
+ local id="${1}"
+ shift
+ else
+ local id="0"
+ fi
+ unshare --keep-caps --map-auto -S "${id}" -G "${id}" "$@"
+}
+
+eunpack() {
+ env PORTAGE_USERNAME=${USER} \
+ PORTAGE_GRPNAME=${USER} \
+ FEATURES="unprivileged" \
+ PORTAGE_TMPDIR="${2:-.}" \
+ ebuild $(equery which "${1}") clean unpack
+}