Debian Codegraph @

lib/ssh-addonce

raw symbols SCIP
1 #!/bin/sh
2
3 # apt-dater - terminal-based remote package update manager
4 #
5 # Authors:
6 # Thomas Liske <[email protected]>
7 #
8 # Copyright Holder:
9 # 2009-2015 (C) IBH IT-Service GmbH [https://www.ibh.de/apt-dater/]
10 #
11 # License:
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this package; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #
26
27 if [ "$#" = "0" ]; then
28 echo "Usage: $0 <keyfile> ..." 1>&2
29 exit 1
30 fi
31
32 for KEYFN in $@; do
33 if [ ! -r "$KEYFN" ]; then
34 echo "Identity '$KEYFN' is not readable!" 1>&2
35 else
36 ssh-keygen -l -f "$KEYFN" | cut '-d ' -f1,2 | while read keyid; do
37 o=$(ssh-add -l | grep "^$keyid ")
38 if [ -z "$o" ]; then
39 exec ssh-add "$KEYFN"
40 else
41 echo "Identity found: $KEYFN"
42 fi
43 done
44 fi
45 done