logo

overlay

My (experimental) gentoo overlay
commit: 9746b0b306c401247b511bc9e2c08794d6a45557
parent: 9dca527e7d96282266f6f40deb0f05829465a72b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed,  4 Sep 2019 19:48:43 +0200

app-admin/pass: new

Diffstat:

Aapp-admin/pass/Manifest1+
Aapp-admin/pass/files/50pass-gentoo.el9+++++++++
Aapp-admin/pass/files/pass-1.7.3-Add support for wl-clipboard.patch110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aapp-admin/pass/metadata.xml28++++++++++++++++++++++++++++
Aapp-admin/pass/pass-1.7.3-r1.ebuild79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 227 insertions(+), 0 deletions(-)

diff --git a/app-admin/pass/Manifest b/app-admin/pass/Manifest @@ -0,0 +1 @@ +DIST password-store-1.7.3.tar.xz 63416 BLAKE2B 5931608e0208dfe6965b79f586c153a4930d1c3d3b74433d026ee0bc5889fcc29334c637ca4fb68308d0169bad7c8235b6632e9f80eda1e24f0f5721353f88e3 SHA512 89755a7b02f05d75055a9fc14fd3f456c0a49ec31bdffd097a027f91228c64a98b18c1e80017aeda811773ae3287ff1b9737532da8ded06799d8fe3979ca06f7 diff --git a/app-admin/pass/files/50pass-gentoo.el b/app-admin/pass/files/50pass-gentoo.el @@ -0,0 +1,9 @@ +(add-to-list 'load-path "@SITELISP@") +(autoload 'password-store-edit "password-store" nil t) +(autoload 'password-store-copy "password-store" nil t) +(autoload 'password-store-init "password-store" nil t) +(autoload 'password-store-insert "password-store" nil t) +(autoload 'password-store-generate "password-store" nil t) +(autoload 'password-store-remove "password-store" nil t) +(autoload 'password-store-rename "password-store" nil t) +(autoload 'password-store-version "password-store" nil t) diff --git a/app-admin/pass/files/pass-1.7.3-Add support for wl-clipboard.patch b/app-admin/pass/files/pass-1.7.3-Add support for wl-clipboard.patch @@ -0,0 +1,110 @@ +From b0b784b1a57c0b06936e6f5d6560712b4b810cd3 Mon Sep 17 00:00:00 2001 +From: Brett Cornwall <brett@i--b.com> +Date: Wed, 27 Feb 2019 00:08:33 -0700 +Subject: clip: Add support for wl-clipboard + +--- + README | 4 +++- + man/pass.1 | 5 +++++ + src/password-store.sh | 26 +++++++++++++++++++++----- + 3 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/README b/README +index 6b59965..1a46242 100644 +--- a/README ++++ b/README +@@ -19,8 +19,10 @@ Depends on: + http://www.gnupg.org/ + - git + http://www.git-scm.com/ +-- xclip ++- xclip (for X11 environments) + http://sourceforge.net/projects/xclip/ ++- wl-clipboard (for wlroots Wayland-based environments) ++ https://github.com/bugaevc/wl-clipboard + - tree >= 1.7.0 + http://mama.indstate.edu/users/ice/tree/ + - GNU getopt +diff --git a/man/pass.1 b/man/pass.1 +index 01a3fbe..a555dcb 100644 +--- a/man/pass.1 ++++ b/man/pass.1 +@@ -99,6 +99,8 @@ Decrypt and print a password named \fIpass-name\fP. If \fI--clip\fP or \fI-c\fP + is specified, do not print the password but instead copy the first (or otherwise specified) + line to the clipboard using + .BR xclip (1) ++or ++.BR wl-clipboard(1) + and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds. If \fI--qrcode\fP + or \fI-q\fP is specified, do not print the password but instead display a QR code using + .BR qrencode (1) +@@ -132,6 +134,8 @@ in generating passwords can be changed with the \fIPASSWORD_STORE_CHARACTER_SET\ + If \fI--clip\fP or \fI-c\fP is specified, do not print the password but instead copy + it to the clipboard using + .BR xclip (1) ++or ++.BR wl-clipboard(1) + and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds. If \fI--qrcode\fP + or \fI-q\fP is specified, do not print the password but instead display a QR code using + .BR qrencode (1) +@@ -466,6 +470,7 @@ The location of the text editor used by \fBedit\fP. + .BR tr (1), + .BR git (1), + .BR xclip (1), ++.BR wl-clipboard (1), + .BR qrencode (1). + + .SH AUTHOR +diff --git a/src/password-store.sh b/src/password-store.sh +index d89d455..284eabf 100755 +--- a/src/password-store.sh ++++ b/src/password-store.sh +@@ -152,16 +152,32 @@ check_sneaky_paths() { + # + + clip() { ++ if [[ -n $WAYLAND_DISPLAY ]]; then ++ local copy_cmd=( wl-copy ) ++ local paste_cmd=( wl-paste -n ) ++ if [[ $X_SELECTION == primary ]]; then ++ copy_cmd+=( --primary ) ++ paste_cmd+=( --primary ) ++ fi ++ local display_name="$WAYLAND_DISPLAY" ++ elif [[ -n $DISPLAY ]]; then ++ local copy_cmd=( xclip -selection "$X_SELECTION" ) ++ local paste_cmd=( xclip -o -selection "$X_SELECTION" ) ++ local display_name="$DISPLAY" ++ else ++ die "Error: No X11 or Wayland display detected" ++ fi ++ local sleep_argv0="password store sleep on display $display_name" ++ + # This base64 business is because bash cannot store binary data in a shell + # variable. Specifically, it cannot store nulls nor (non-trivally) store + # trailing new lines. +- local sleep_argv0="password store sleep on display $DISPLAY" + pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5 +- local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | $BASE64)" +- echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard" ++ local before="$("${paste_cmd[@]}" 2>/dev/null | $BASE64)" ++ echo -n "$1" | "${copy_cmd[@]}" || die "Error: Could not copy data to the clipboard" + ( + ( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" ) +- local now="$(xclip -o -selection "$X_SELECTION" | $BASE64)" ++ local now="$("${paste_cmd[@]}" | $BASE64)" + [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now" + + # It might be nice to programatically check to see if klipper exists, +@@ -173,7 +189,7 @@ clip() { + # so we axe it here: + qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null + +- echo "$before" | $BASE64 -d | xclip -selection "$X_SELECTION" ++ echo "$before" | $BASE64 -d | "${copy_cmd[@]}" + ) >/dev/null 2>&1 & disown + echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds." + } +-- +cgit v1.2.1-28-gf32c + diff --git a/app-admin/pass/metadata.xml b/app-admin/pass/metadata.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>zx2c4@gentoo.org</email> + <name>Jason A. Donenfeld</name> + </maintainer> + <longdescription> + Stores, retrieves, generates, and synchronizes passwords securely using gpg, pwgen, and git. + </longdescription> + <use> + <flag name="X"> + Use <pkg>x11-misc/xclip</pkg> to copy passwords to the clipboard. + </flag> + <flag name="git"> + Use <pkg>dev-vcs/git</pkg> for password revisions. + </flag> + <flag name="fish-completion"> + Enable fish completion support. + </flag> + <flag name="dmenu"> + Add support for x11-misc/dmenu with the 'passmenu' program. + </flag> + <flag name="importers"> + Allow importing passwords from other password managers using various contributed scripts. + </flag> + </use> +</pkgmetadata> diff --git a/app-admin/pass/pass-1.7.3-r1.ebuild b/app-admin/pass/pass-1.7.3-r1.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit bash-completion-r1 elisp-common + +DESCRIPTION="Stores, retrieves, generates, and synchronizes passwords securely" +HOMEPAGE="https://www.passwordstore.org/" +SRC_URI="https://git.zx2c4.com/password-store/snapshot/password-store-${PV}.tar.xz" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~x86-macos" +IUSE="+git wayland X zsh-completion fish-completion emacs dmenu importers elibc_Darwin" + +RDEPEND=" + app-crypt/gnupg + media-gfx/qrencode + >=app-text/tree-1.7.0 + git? ( dev-vcs/git ) + X? ( x11-misc/xclip ) + wayland? ( gui-apps/wl-clipboard ) + elibc_Darwin? ( app-misc/getopt ) + zsh-completion? ( app-shells/gentoo-zsh-completions ) + fish-completion? ( app-shells/fish ) + dmenu? ( x11-misc/dmenu x11-misc/xdotool ) + emacs? ( virtual/emacs >=app-emacs/f-0.11.0 >=app-emacs/s-1.9.0 >=app-emacs/with-editor-2.5.11 ) +" + +S="${WORKDIR}/password-store-${PV}" + +src_prepare() { + default + + use elibc_Darwin || return + # use coreutils' + sed -i -e 's/openssl base64/base64/g' src/platform/darwin.sh || die + # host getopt isn't cool, and we aren't brew (rip out brew reference) + sed -i -e '/^GETOPT=/s/=.*$/=getopt-long/' src/platform/darwin.sh || die + # make sure we can find "mount" + sed -i -e 's:mount -t:/sbin/mount -t:' src/platform/darwin.sh || die +} + +src_compile() { + use emacs && elisp-compile contrib/emacs/*.el +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + PREFIX="${EPREFIX}/usr" \ + BASHCOMPDIR="$(get_bashcompdir)" \ + WITH_BASHCOMP=yes \ + WITH_ZSHCOMP=$(usex zsh-completion) \ + WITH_FISHCOMP=$(usex fish-completion) + use dmenu && dobin contrib/dmenu/passmenu + if use emacs; then + elisp-install ${PN} contrib/emacs/*.{el,elc} + elisp-site-file-install "${FILESDIR}/50${PN}-gentoo.el" + fi + if use importers; then + exeinto /usr/share/${PN}/importers + doexe contrib/importers/* + fi +} + +pkg_postinst() { + use emacs && elisp-site-regen + if use importers; then + einfo "To import passwords from other password managers, you may use the" + einfo "various importer scripts found in:" + einfo " ${EROOT%/}/usr/share/${PN}/importers/" + fi +} + +pkg_postrm() { + use emacs && elisp-site-regen +}