summarylogtreecommitdiffstats
path: root/mkinitcpio-sign-install
blob: 9d0942895aa7747b29a266597a6520b0d89f46cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash -e

pushd /usr/lib/initcpio/sign
gpg-connect-agent --homedir . reloadagent /bye
keys=(`gpg --homedir . --list-keys --with-colons | awk -F: '/^pub:/ { print $5 }' | tr '\n' ' '`)

if [[ $keys != "" ]]; then
  echo "found $keys"
else
  gpg --homedir . --gen-key
  [ $? -ne 0 ] && 1>&2 echo "failed to generate a GPG keypair in /usr/lib/initcpio/sign" && exit 1
  gpg --homedir . --export > ~/boot.key
fi

if [ ! -f ./passphrase ] && `read pass`; then
  echo "$pass" > passphrase
fi

chmod 600 passphrase 2>&1 1>/dev/null

if (( ${#args[@]} )); then
    mkinitcpio "${args[@]}"
fi