]>
Git — Sourcephile - julm/julm-nix.git/blob - hosts/gpg2cred-local.sh
10 SECRET
=$(mktemp /dev/shm/credential.secret.XXXXXXX)
11 trap 'chmod 600 $SECRET; shred --remove=unlink $SECRET' EXIT
12 gpg
--yes --output "$SECRET" --decrypt "credential.secret.gpg"
14 gpg
--decrypt "$gpg" |
15 sudo unshare
--mount sh
-xc "
16 mount --bind '$SECRET' /var/lib/systemd/credential.secret &&
17 chmod 400 /var/lib/systemd/credential.secret &&
18 mount --bind machine-id.clear /etc/machine-id &&
19 systemd-creds encrypt --with-key=host ${name:+--name "$name"} - - |
20 install -m 400 -o '$USER' -g users /dev/stdin '$base.cred'