You are not logged in.

#1 2012-03-11 12:04:38

Shelly
Member
Registered: 2012-03-10
Posts: 9

[SOLVED] Pacman keyring

Hy girls and guys,

I want to sign the keys with a bash script. Here's the code:

keys=(6AC6A4C2 824B18E8 4C7EA887 CDFD6BB0 FFF979E7)
for value in ${keys[*]}
do
	pacman-key -r $value
	pacman-key --edit-key $value
	echo 'lsign'
	echo 'y'
	echo 'trust'
	echo '3'
	echo 'save'
	echo 'q'
done

.. but it stops at:

gpg> 

Does anybody have a solution?

Last edited by Shelly (2012-03-11 12:34:19)

Offline

#2 2012-03-11 12:18:06

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Offline

#3 2012-03-11 12:27:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Pacman keyring

As a more general comment on bash scripting, `echo` prints its parameters to stdout, this never reaches the stdin of another running process (unless redirected).  In your script pacman-key is waiting for input, and until it gets it those echo lines will never execute.  Even if pacman-key was backgrounded, those echos would only go to the screen, not to pacman-key.

In general you can do something like this

cat <<EOF | process-that-requires-input
lsign
y
trust
3
save
q
EOF

I say in general as this should work with programs and processes that read from the standard input in 'normal' ways.  I suspect, but cannot confirm, that pacman-key would fall into that category.

EDIT: there are a few different ways of redirecting blocks of 'text'.  Each one has their caveats.  The above is a rough example of one of them, and undoubtedly could have issues.

Last edited by Trilby (2012-03-11 12:29:34)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2012-03-11 12:33:28

Shelly
Member
Registered: 2012-03-10
Posts: 9

Re: [SOLVED] Pacman keyring

That was fast. Thanks for the link and the explanation wink

Offline

Board footer

Powered by FluxBB