Revision 22897,
1.2 KB
checked in by tabbott, 16 years ago
(diff) |
Initial checkin of ktconvert Debian packaging.
* athena/etc/ktconvert/ktconvert.sh: Remove athena from paths.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[20276] | 1 | #!/bin/sh |
---|
| 2 | # $Id: ktconvert.sh,v 1.1 2004-03-14 22:39:24 zacheiss Exp $ |
---|
| 3 | # |
---|
[22897] | 4 | # Convert /etc/srvtab to /etc/krb5.keytab, removing the srvtab |
---|
[20276] | 5 | # when we're done. |
---|
| 6 | |
---|
| 7 | usage="Usage: ktconvert [ -r ] |
---|
[22897] | 8 | -r indicates /etc/krb5.keytab should be converted back into /etc/srvtab." |
---|
[20276] | 9 | |
---|
[22897] | 10 | fromfile=/etc/srvtab |
---|
[20276] | 11 | tofile=/etc/krb5.keytab |
---|
| 12 | readop=rst |
---|
| 13 | writeop=wkt |
---|
| 14 | |
---|
| 15 | while getopts r opt; do |
---|
| 16 | case "$opt" in |
---|
| 17 | r) |
---|
| 18 | fromfile=/etc/krb5.keytab |
---|
[22897] | 19 | tofile=/etc/srvtab |
---|
[20276] | 20 | readop=rkt |
---|
| 21 | writeop=wst |
---|
| 22 | ;; |
---|
| 23 | \?) |
---|
| 24 | echo "$usage" >&2 |
---|
| 25 | exit 1 |
---|
| 26 | ;; |
---|
| 27 | esac |
---|
| 28 | done |
---|
| 29 | |
---|
| 30 | case `id` in |
---|
| 31 | "uid=0("*) |
---|
| 32 | ;; |
---|
| 33 | *) |
---|
| 34 | echo "You are not root. This script must be run as root." |
---|
| 35 | exit 1 |
---|
| 36 | ;; |
---|
| 37 | esac |
---|
| 38 | |
---|
| 39 | if [ ! -f $fromfile ]; then |
---|
| 40 | echo "$fromfile does not exist." |
---|
| 41 | exit 1 |
---|
| 42 | fi |
---|
| 43 | |
---|
| 44 | if [ -f $tofile ]; then |
---|
| 45 | echo "$tofile already exists." |
---|
| 46 | exit 1 |
---|
| 47 | fi |
---|
| 48 | |
---|
| 49 | # We redirect stderr below because libreadline spews warnings |
---|
| 50 | # we don't care about. |
---|
[22897] | 51 | /usr/sbin/ktutil <<EOF >/dev/null 2>&1 |
---|
[20276] | 52 | $readop $fromfile |
---|
| 53 | $writeop $tofile |
---|
| 54 | quit |
---|
| 55 | EOF |
---|
| 56 | |
---|
| 57 | if [ $? != 0 ]; then |
---|
| 58 | echo "Failed to run ktutil." |
---|
| 59 | exit 1 |
---|
| 60 | fi |
---|
| 61 | |
---|
| 62 | # Ensure file we're removing is writable so saferm will remove it. |
---|
| 63 | chmod 600 $fromfile |
---|
[22897] | 64 | /bin/saferm -z $fromfile |
---|
[20276] | 65 | |
---|
| 66 | if [ $? != 0 ]; then |
---|
| 67 | echo "saferm failed to remove $fromfile." |
---|
| 68 | exit 1 |
---|
| 69 | fi |
---|
| 70 | |
---|
| 71 | echo "Converted $fromfile to $tofile." |
---|
| 72 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.