Read signing key from 1pw
This commit is contained in:
1 parent
94c779d028
commit
abbd9eda34
2 files changed
+41
-7
No files matched your search
@@ -28,7 +28,7 @@ Run `./bin/omarchy-iso-boot [release/omarchy.iso]`.
|
|||||||
|
|
||||||
## Signing the ISO
|
## Signing the ISO
|
||||||
|
|
||||||
Run `./bin/omarchy-iso-sign [gpg-user] [release/omarchy.iso]`.
|
Run `./bin/omarchy-iso-sign [release/omarchy.iso]`. The signing key is retrieved from the shared Omarchy vault with the 1Password CLI.
|
||||||
|
|
||||||
## Uploading the ISO
|
## Uploading the ISO
|
||||||
|
|
||||||
|
|||||||
+40
-6
@@ -1,14 +1,48 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
echo "usage: omarchy-iso-sign [release/omarchy.iso]"
|
echo "usage: omarchy-iso-sign [release/omarchy.iso]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pacman -Q gnupg >/dev/null; then
|
iso="$1"
|
||||||
sudo pacman -S --noconfirm --needed --quiet gnupg
|
key_ref="op://Shared/Omarchy GPG Private Key/omarchy-private.asc"
|
||||||
echo "You'll need to import key with: gpg --import path/to/signing-key.asc"
|
|
||||||
|
if [[ ! -f $iso ]]; then
|
||||||
|
echo "ISO not found: $iso" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gnupg_user_key=$(gpg --list-secret-keys --keyid-format=long | awk '/^[[:space:]]/{print $1; exit}')
|
if ! command -v op >/dev/null; then
|
||||||
gpg --local-user "$gnupg_user_key" --output $1.sig --detach-sig $1
|
echo "1Password CLI is required to retrieve the signing key." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! pacman -Q gnupg >/dev/null 2>&1; then
|
||||||
|
sudo pacman -S --noconfirm --needed --quiet gnupg
|
||||||
|
fi
|
||||||
|
|
||||||
|
gnupg_home="$(mktemp -d)"
|
||||||
|
chmod 700 "$gnupg_home"
|
||||||
|
trap 'rm -rf "$gnupg_home"' EXIT
|
||||||
|
|
||||||
|
op read "$key_ref" --account Omarchy |
|
||||||
|
gpg --batch --homedir "$gnupg_home" --import >/dev/null
|
||||||
|
|
||||||
|
signing_key="$(
|
||||||
|
gpg --batch --homedir "$gnupg_home" --with-colons --list-secret-keys |
|
||||||
|
awk -F: '$1 == "fpr" { print $10; exit }'
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [[ -z $signing_key ]]; then
|
||||||
|
echo "No private signing key found in $key_ref" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gpg --batch --yes \
|
||||||
|
--homedir "$gnupg_home" \
|
||||||
|
--local-user "$signing_key" \
|
||||||
|
--output "$iso.sig" \
|
||||||
|
--detach-sig "$iso"
|
||||||
Reference in new issue
Block a user