1 parent
665c59261d
commit
3a9e71b16b
4 files changed
+88
-8
No files matched your search
Binary file not shown.
@@ -238,14 +238,32 @@ clone under whichever it picks, and writes `env.sh` exporting
|
||||
one line to each host's *local* `~/.bashrc` (only on hosts where that
|
||||
backend is actually reachable for this account — neither mount is
|
||||
guaranteed reachable from literally everywhere; e.g. confirmed missing
|
||||
on `saresb-cons-04` for `gac-bernina`'s `~/network_drives`):
|
||||
on `saresb-cons-04` for `gac-bernina`'s `~/network_drives`) — put it
|
||||
**near the top, before any "not interactive? return" guard**, so it also
|
||||
reaches non-interactive invocations (cron, systemd units) and not just
|
||||
interactive shells:
|
||||
|
||||
```bash
|
||||
echo 'source <the ROOT_DIR printed by the script>/env.sh' >> ~/.bashrc
|
||||
source <the ROOT_DIR printed by the script>/env.sh
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Works fine most of the time, but the very first `gopass`/`gpg` command
|
||||
in a brand-new terminal/session sometimes fails** (`not a recipient`,
|
||||
`password-store is not initialized`, or similar), and simply retrying
|
||||
(or running `gopass sync` first) makes it work: `~/network_drives`
|
||||
(SMB, "Partially Shared Home") is mounted per login session,
|
||||
asynchronously - on a session that isn't already warm (e.g. you don't
|
||||
normally stay logged into that particular host), the mount can still be
|
||||
settling when your first command runs, so it silently falls back to
|
||||
this host's own empty local store instead. `env.sh` (written by
|
||||
`gopass_bernina_setup.sh`/`gopass_bernina_service_setup.sh`) waits up
|
||||
to 5s for this before exporting `GNUPGHOME`/`GOPASS_HOMEDIR` - re-run
|
||||
the setup script to regenerate an older `env.sh` that predates this
|
||||
fix. This looked at first like a host-specific bug (worked on one
|
||||
console, not another) but was really about how warm/cold that host's
|
||||
session was, not the host itself.
|
||||
- **`gopass clone` hangs forever** (stuck after "Gathering information
|
||||
for the git repository ..." with no error, no progress, and no child
|
||||
process doing visible work): a confirmed `gopass` bug/deadlock in its
|
||||
|
||||
@@ -196,7 +196,33 @@ fi
|
||||
|
||||
# --- 4. write env.sh ----------------------------------------------------------
|
||||
log "Step 4/5: writing ${ENV_FILE}"
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
if [[ "${BACKEND}" == "network_drives" ]]; then
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
# Source this from ~/.bashrc (LOCAL to each host - not shared) to make
|
||||
# ${ACCOUNT}'s gopass access work the same everywhere this account runs,
|
||||
# regardless of whether \$HOME is shared. Generated by
|
||||
# gopass_bernina_service_setup.sh - see gopass.md for what each of these
|
||||
# does and why.
|
||||
#
|
||||
# ~/network_drives (SMB, "Partially Shared Home") is mounted per login
|
||||
# session, asynchronously - on a freshly started session it can take a
|
||||
# moment to appear. Without this wait, the first gopass command of a new
|
||||
# session can race the automount and silently fall back to an empty
|
||||
# LOCAL store instead of erroring. Wait briefly (up to 5s) here instead,
|
||||
# once per shell. See gopass.md Troubleshooting.
|
||||
__gopass_wait_n=0
|
||||
while [ ! -d "${GNUPG_DIR}" ] && [ "\${__gopass_wait_n}" -lt 20 ]; do
|
||||
sleep 0.25
|
||||
__gopass_wait_n=\$((__gopass_wait_n + 1))
|
||||
done
|
||||
unset __gopass_wait_n
|
||||
|
||||
export GOPASS_HOMEDIR="${GOPASS_HOME_DIR}"
|
||||
export GNUPGHOME="${GNUPG_DIR}"
|
||||
export GIT_SSH_COMMAND="ssh -i ${SSH_DIR}/id_ed25519 -o IdentitiesOnly=yes"
|
||||
EOF
|
||||
else
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
# Source this from ~/.bashrc (LOCAL to each host - not shared) to make
|
||||
# ${ACCOUNT}'s gopass access work the same everywhere this account runs,
|
||||
# regardless of whether \$HOME is shared. Generated by
|
||||
@@ -206,6 +232,7 @@ export GOPASS_HOMEDIR="${GOPASS_HOME_DIR}"
|
||||
export GNUPGHOME="${GNUPG_DIR}"
|
||||
export GIT_SSH_COMMAND="ssh -i ${SSH_DIR}/id_ed25519 -o IdentitiesOnly=yes"
|
||||
EOF
|
||||
fi
|
||||
log " done"
|
||||
|
||||
# --- 5. root store + clone/mount the store using the new env -----------------
|
||||
@@ -263,9 +290,13 @@ echo
|
||||
echo "======================================================================"
|
||||
echo "Done for THIS shell. To make it stick on every host this account runs"
|
||||
echo "on, add ONE line to that host's LOCAL ~/.bashrc (not shared — do this"
|
||||
echo "once per host, and only where ${BACKEND} is reachable for this account):"
|
||||
echo "once per host, and only where ${BACKEND} is reachable for this account)."
|
||||
echo "Put it NEAR THE TOP - before any '[are we interactive?] || return'"
|
||||
echo "guard - so it also reaches non-interactive invocations of this account"
|
||||
echo "(cron, systemd units, etc.), which would otherwise silently fall back"
|
||||
echo "to this host's own empty local gopass store instead of erroring:"
|
||||
echo
|
||||
echo " echo 'source ${ENV_FILE}' >> ~/.bashrc"
|
||||
echo " source ${ENV_FILE}"
|
||||
echo
|
||||
echo "Then open a fresh shell (or 'source ~/.bashrc') and confirm:"
|
||||
echo " gopass mounts # should show '${STORE_ALIAS}' with no error"
|
||||
|
||||
+34
-3
@@ -298,13 +298,40 @@ log " mounted and verified OK"
|
||||
|
||||
# --- 6. env.sh + export pubkey + tell them what's left -----------------------
|
||||
log "Step 6/6: writing ${ENV_FILE} and exporting your GPG public key"
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
if [[ "${BACKEND}" == "network_drives" ]]; then
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
# Source this from ~/.bashrc (LOCAL to each host) to make your gopass
|
||||
# access to '${STORE_ALIAS}' work the same on every host where ${ROOT_DIR}
|
||||
# is reachable. Generated by gopass_bernina_setup.sh - see gopass.md.
|
||||
#
|
||||
# ~/network_drives (SMB, "Partially Shared Home") is mounted per login
|
||||
# session, asynchronously - on a freshly opened terminal/session it can
|
||||
# take a moment to appear. Without this wait, the first gopass command of
|
||||
# a new session can race the automount and silently fall back to an
|
||||
# empty LOCAL store (this host's own \$HOME, not the shared one) - looks
|
||||
# like "not a recipient" or "password-store is not initialized" for no
|
||||
# obvious reason, and typically "fixes itself" on retry a moment later.
|
||||
# Wait briefly (up to 5s) here instead, once per shell, so the first real
|
||||
# command doesn't lose that race. See gopass.md Troubleshooting.
|
||||
__gopass_wait_n=0
|
||||
while [ ! -d "${GNUPG_DIR}" ] && [ "\${__gopass_wait_n}" -lt 20 ]; do
|
||||
sleep 0.25
|
||||
__gopass_wait_n=\$((__gopass_wait_n + 1))
|
||||
done
|
||||
unset __gopass_wait_n
|
||||
|
||||
export GNUPGHOME="${GNUPG_DIR}"
|
||||
export GOPASS_HOMEDIR="${GOPASS_HOME_DIR}"
|
||||
EOF
|
||||
else
|
||||
cat > "${ENV_FILE}" <<EOF
|
||||
# Source this from ~/.bashrc (LOCAL to each host) to make your gopass
|
||||
# access to '${STORE_ALIAS}' work the same on every host where ${ROOT_DIR}
|
||||
# is reachable. Generated by gopass_bernina_setup.sh - see gopass.md.
|
||||
export GNUPGHOME="${GNUPG_DIR}"
|
||||
export GOPASS_HOMEDIR="${GOPASS_HOME_DIR}"
|
||||
EOF
|
||||
fi
|
||||
|
||||
PUBKEY_FILE="${ROOT_DIR}/${USERNAME}-gopass-pubkey.asc"
|
||||
gpg --armor --export "${EMAIL}" > "${PUBKEY_FILE}"
|
||||
@@ -322,9 +349,13 @@ fi
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "Add ONE line to this host's LOCAL ~/.bashrc (not shared - do this once"
|
||||
echo "per host, or replace any older GNUPGHOME/GOPASS_HOMEDIR exports there):"
|
||||
echo "per host, or replace any older GNUPGHOME/GOPASS_HOMEDIR exports there)."
|
||||
echo "Put it NEAR THE TOP - before any '[are we interactive?] || return'"
|
||||
echo "guard - so it also reaches non-interactive shells (VS Code Remote-SSH,"
|
||||
echo "cron, some Jupyter kernels), which would otherwise silently fall back"
|
||||
echo "to this host's own empty local gopass store instead of erroring:"
|
||||
echo
|
||||
echo " echo 'source ${ENV_FILE}' >> ~/.bashrc"
|
||||
echo " source ${ENV_FILE}"
|
||||
echo
|
||||
if [[ "${ALREADY_RECIPIENT}" -eq 1 ]]; then
|
||||
echo "You're already an authorized recipient of '${STORE_ALIAS}' (${EMAIL}) -"
|
||||
|
||||
Reference in new issue
Block a user