summarylogtreecommitdiffstats
path: root/mkinitcpio-sign-install
diff options
context:
space:
mode:
authorsharethewisdom2019-12-07 03:12:08 +0100
committersharethewisdom2019-12-07 03:42:05 +0100
commitff88eb86eb43451af81b6bd41d0431fd6748e014 (patch)
tree9bf43c0837645671d14787be2e804a19a91e8b00 /mkinitcpio-sign-install
downloadaur-ff88eb86eb43451af81b6bd41d0431fd6748e014.tar.gz
initial commit
Diffstat (limited to 'mkinitcpio-sign-install')
-rw-r--r--mkinitcpio-sign-install23
1 files changed, 23 insertions, 0 deletions
diff --git a/mkinitcpio-sign-install b/mkinitcpio-sign-install
new file mode 100644
index 000000000000..4bacd2fe0071
--- /dev/null
+++ b/mkinitcpio-sign-install
@@ -0,0 +1,23 @@
+#!/bin/bash -e
+
+pushd /usr/lib/initcpio/sign
+gpg-agent --daemon --max-cache-ttl 1
+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 "you need to generate a GPG keypair to use for signing 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