Skip to content

Instantly share code, notes, and snippets.

@rhenium
Created January 20, 2023 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhenium/bf8d1cf5997718fb1a458009a0452841 to your computer and use it in GitHub Desktop.
Save rhenium/bf8d1cf5997718fb1a458009a0452841 to your computer and use it in GitHub Desktop.
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop xdg
DESCRIPTION="1password"
HOMEPAGE="https://1password.com"
SRC_URI="amd64? ( https://downloads.1password.com/linux/tar/stable/x86_64/${P}.x64.tar.gz )"
S="${WORKDIR}"
LICENSE=""
SLOT="0"
KEYWORDS="amd64"
DEPEND="
x11-misc/xdg-utils
sys-auth/polkit
acct-group/onepassword"
RDEPEND="${DEPEND}"
BDEPEND=""
src_install() {
cd "${WORKDIR}/${P}.x64" || dir
insinto /opt/1Password
doins -r *
fperms +x /opt/1Password/1password
dosym /opt/1Password/1password /usr/bin/1password
fperms +x /opt/1Password/op-ssh-sign
fperms +x /opt/1Password/chrome_crashpad_handler
fowners :onepassword /opt/1Password/1Password-KeyringHelper
fperms 6755 /opt/1Password/1Password-KeyringHelper
fowners :onepassword /opt/1Password/1Password-BrowserSupport
fperms 2755 /opt/1Password/1Password-BrowserSupport
fperms 4711 /opt/1Password/chrome-sandbox
domenu resources/1password.desktop
for res in 32 64 256 512; do
newicon -s ${res} resources/icons/hicolor/${res}x${res}/apps/1password.png ${PN}.png
done
# RHE: This does seem bad. How do I this correctly?
# Fill in policy kit file with a list of (the first 10) human users of the system.
export POLICY_OWNERS
POLICY_OWNERS="$(cut -d: -f1,3 /etc/passwd | grep -E ':[0-9]{4}$' | cut -d: -f1 | head -n 10 | sed 's/^/unix-user:/' | tr '\n' ' ')"
eval "cat <<EOF
$(cat ./com.1password.1Password.policy.tpl)
EOF" > ./com.1password.1Password.policy
# Install policy kit file for system unlock
insinto /usr/share/polkit-1/actions
doins com.1password.1Password.policy
# Install examples
dodoc resources/custom_allowed_browsers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment