summaryrefslogtreecommitdiff
path: root/unpenme
blob: 85fb7a3889ebcee83fcc1e17cfcef27f881e1a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
FORREALS=-i~penme
set -e
if [ "$(id -u)" -ne 0 ]
then
        exec sudo -- "$0" "$@"
fi
sedprog='/ penme host key @ .*/ d'
if [ "${0##*/}" = unpenyou ]
then
    [ "$1" ]
    ssh "$@" -- sed ${FORREALS} -E -e "'$sedprog'"  /root/.ssh/authorized_keys
else
    sed ${FORREALS} -E -e "$sedprog"  /root/.ssh/authorized_keys
    if [ -t 1 ]
    then
        diff /root/.ssh/authorized_keys${FORREALS#-i} /root/.ssh/authorized_keys
    fi
fi