diff options
Diffstat (limited to 'repenme')
-rw-r--r-- | repenme | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ | |||
1 | #!/bin/sh | ||
2 | [ "$(id -u)" = 0 ] || exec sudo -- "$0" "$@" || exit | ||
3 | set -ex | ||
4 | |||
5 | a=/root/.ssh/authorized_keys | ||
6 | b=$a~penme | ||
7 | c=$b~repen | ||
8 | |||
9 | [ -f "$a" -a -f "$b" ] | ||
10 | [ -r "$a" -a -r "$b" ] | ||
11 | |||
12 | mv -f -- "$a" "$c" | ||
13 | mv -- "$b" "$a" | ||
14 | mv -- "$c" "$b" | ||
15 | if [ -t 1 ] | ||
16 | then | ||
17 | diff "$b" "$a" | ||
18 | fi | ||