#!/usr/bin/env bash set -euo pipefail if test "$(systemctl get-default)" != "graphical.target" ; then # server doesn't have access to 1Password exit fi echo "Installing 1Password..." sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\"https://downloads.1password.com/linux/keys/1password.asc\"" > /etc/yum.repos.d/1password.repo' if test "$(arch)" = "x86_64" ; then sudo dnf install -y git 1password-cli 1password else sudo dnf install -y git 1password-cli # cannot use RPM repo for desktop app, which is only packaged for x86_64 sudo mkdir --parents /opt/1Password curl -sS "https://downloads.1password.com/linux/tar/stable/$(arch)/1password-latest.tar.gz" \ | sudo tar xz --directory=/opt/1Password --strip-components=1 sudo /opt/1Password/after-install.sh # update via chezmoi on non-x86 machines # {{ if ne .chezmoi.arch "amd64" }} # update once a week: {{ output "date" "+%Y-%V" | trim }} # {{ end }} fi # {{ if false }} # skip initial login during chezmoi apply 1password &> /dev/null & disown %1 printf "Please login to 1Password, then press enter to continue." read -r _ < /dev/tty printf "Did you enable the SSH agent and CLI integration in the settings? :-)" read -r _ < /dev/tty # {{ end }}