3 # (c) Thomas Lange, 2022, lange@debian.org
5 # Add public ssh key for user root to get login access
7 error
=0; trap 'error=$(($?>$error?$?:$error))' ERR
# save maximum error code
9 SSHDIR
=$target/root
/.
ssh
10 AUKEY
=$SSHDIR/authorized_keys
12 # reverse order of classes
14 revclasses
="$c $revclasses"
17 for c
in $revclasses; do
18 if [ -f $FAI/files
/root-ssh-key
/$c ]; then
19 if [ -f $AUKEY ]; then
20 cmp -s $FAI/files
/root-ssh-key
/$c $AUKEY
25 if [ ! -d $SSHDIR ]; then
28 cp -v $FAI/files
/root-ssh-key
/$c $AUKEY
29 chown root
:root
$AUKEY