Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / fixrhosts
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         fixrhosts
5 # Description:  Generates a new ~/.rhosts file
6 # Author:       Andrew@DeFaria.com
7 # Created:      Fri Apr 30 14:13:56 PDT 1999
8 # Modifications:
9 # Language:     Korn Shell
10 #
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 # Set me to command name
15 me=$(basename $0)
16
17 # Set adm_base
18 adm_base=${adm_base:-//sonscentral/Corporate/Software/adm}
19
20 # Set adm_fpath
21 adm_fpath=${adm_fpath:-$adm_base/functions}
22
23 # Source functions
24 . $adm_fpath/common
25
26 # Source in tmpfiles function
27 tmpprefix=${TMPDIR:-/tmp}/$me.$$
28 . $adm_fpath/tmpfiles
29 trap cleanup INT EXIT ERR
30
31 # Check if root
32 if is_root; then
33   error "You should not run the script as root!" 1
34 fi
35
36 rhosts=$HOME/.rhosts
37 rhosts_loc=$HOME/.rhosts.loc
38
39 # Generate new $rhosts
40
41 if [ -f $rhosts_loc ]; then
42   cp $rhosts_loc $rhosts
43 else
44   rm -f $rhosts
45 fi
46
47 # Add netgroup
48 print "+@all-machines $LOGNAME" >> .rhosts
49
50 # Insure proper permissions
51 chmod 600 $rhosts
52
53 # Tell user of this scripts demise
54 display "\t\t\t*** NOTICE ***"
55 display
56 display "Since the lab now users NIS we are employing a different solution"
57 display "to the issue of providing passwordless logins to sets of machines"
58 display "via rlogin/remsh. This solution adds the following to $rhosts:"
59 display
60 display "\t+@all-machines $LOGNAME"
61 display
62 display "Thereafter running $me is unnecessary."
63 display
64 display "I'd like to take this opportunity to thank you for your support"
65 display "of $me! :-) <Andrew@DeFaria.com>"