1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 DESCRIPTION="Binary component required by the LastPass Password Manager browser extension"
7 HOMEPAGE="https://helpdesk.lastpass.com/downloading-and-installing/#h5"
8 # sadly, upstream has no versioned distfiles
9 SRC_URI="https://download.cloud.lastpass.com/linux/lplinux.tar.bz2 -> ${P}.tar.bz2"
13 KEYWORDS="-* ~amd64 ~x86"
14 RESTRICT="strip mirror" # We can't mirror it, but we can fetch it
16 LASTPASS_EXEDIR=/opt/lastpass/
19 ${LASTPASS_EXEDIR}nplastpass*
25 # This is based on the upstream installer script that's in the tarball
27 use amd64 && bin="${bin}64"
28 exeinto ${LASTPASS_EXEDIR}
31 # Generate the policy file for Chrome/Chromium/Opera
32 cat >"${T}"/lastpass_policy.json <<-EOF || die
34 "ExtensionInstallSources": [
35 "https://lastpass.com/*",
36 "https://*.lastpass.com/*",
37 "https://d1jxck0p3rkj0.cloudfront.net/lastpass/*"
41 # Install the policy file for Chrome/Chromium/Opera
42 for d in /etc/chromium /etc/opt/chrome; do
43 insinto ${d}/policies/managed
44 doins "${T}"/lastpass_policy.json
47 # Generate the app manifest for Chrome/Opera
48 cat >"${T}"/com.lastpass.nplastpass.json <<-EOF || die
50 "name": "com.lastpass.nplastpass",
51 "description": "LastPass",
52 "path": "${LASTPASS_EXEDIR}${bin}",
55 "chrome-extension://hdokiejnpimakedhajhdlcegeplioahd/",
56 "chrome-extension://debgaelkhoipmbjnhpoblmbacnmmgbeg/",
57 "chrome-extension://hnjalnkldgigidggphhmacmimbdlafdo/",
58 "chrome-extension://hgnkdfamjgnljokmokheijphenjjhkjc/"
62 # Install the app manifest for Chrome/Opera
63 # https://developer.chrome.com/apps/nativeMessaging
64 # https://dev.opera.com/extensions/message-passing/
65 insinto /etc/opt/chrome/native-messaging-hosts
66 doins "${T}"/com.lastpass.nplastpass.json
68 # Generate the app manifest for Chromium
69 cat >"${T}"/com.lastpass.nplastpass.json <<-EOF || die
71 "name": "com.lastpass.nplastpass",
72 "description": "LastPass",
73 "path": "${LASTPASS_EXEDIR}${bin}",
76 "chrome-extension://hdokiejnpimakedhajhdlcegeplioahd/",
77 "chrome-extension://debgaelkhoipmbjnhpoblmbacnmmgbeg/",
78 "chrome-extension://hgnkdfamjgnljokmokheijphenjjhkjc/"
82 # Install the app manifest for Chromium
83 # https://developer.chrome.com/apps/nativeMessaging
84 insinto /etc/chromium/native-messaging-hosts/
85 doins "${T}"/com.lastpass.nplastpass.json
87 # Generate the app manifest for Firefox
88 cat >"${T}"/com.lastpass.nplastpass.json <<-EOF || die
90 "name": "com.lastpass.nplastpass",
91 "description": "LastPass",
92 "path": "${LASTPASS_EXEDIR}${bin}",
94 "allowed_extensions": [
95 "support@lastpass.com"
99 # Install the app manifest for Firefox
100 # https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_manifests#Manifest_location
101 insinto /usr/lib/mozilla/native-messaging-hosts/
102 doins "${T}"/com.lastpass.nplastpass.json
106 einfo "This package only installs the components required by the browser extension."
107 einfo "Visit the links below for your browser to install the extension itself:"
108 einfo "Chrome/Chromium: https://lastpass.com/dl/inline/?full=1"
109 einfo "Firefox: https://lastpass.com/lastpassffx/"
110 einfo "Opera: https://lastpass.com/dl/"
112 einfo "Chrome, Chromium and Opera users need to manually enable the binary component."
113 einfo "For more info, visit: https://lastpass.com/support.php?cmd=showfaq&id=5576"