ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/ccs/admin/chfn.py
Revision: 591
Committed: 2009-10-13T06:47:12-07:00 (15 years, 8 months ago) by douglas
Content type: text/x-python
Original Path: admin/chsh.py
File size: 955 byte(s)
Log Message:
chsh!

File Contents

# User Rev Content
1 douglas 587 #!/usr/bin/env python
2     # CCS Computer Science
3     # Change Shell
4     #
5     # Douglas Thrift
6     #
7     # $Id$
8    
9 douglas 591 import admin
10 douglas 590 import common
11 douglas 587 import re
12 douglas 591 import sys
13 douglas 587
14     if __name__ == '__main__':
15 douglas 591 user = common.user()
16    
17 douglas 587 try:
18 douglas 590 shells = map(lambda shells: shells[0], common.SHELLS)
19 douglas 587 shell = None
20    
21     while shell not in shells:
22     shell = raw_input('Shell (%s): ' % ', '.join(shells))
23    
24     if shell == 'custom':
25 douglas 591 shells = dict(common.SHELLS)[shell]
26 douglas 587 path = re.compile('^/.*[^/]$')
27    
28 douglas 590 for system in common.SYSTEMS:
29 douglas 587 while shells[system] is None or path.match(shells[system]) is None:
30     shells[system] = raw_input((system.capitalize() if not system.endswith('bsd') else system[:-3].capitalize() + 'BSD') + ': ')
31 douglas 591 else:
32     shells = None
33    
34     if admin.master():
35     admin.chsh(user, shell, shells)
36     else:
37     for host, exception in common.chsh_all(user, shell, shells).iteritems():
38     print '%s: %s' % (host, exception)
39 douglas 587 except (EOFError, KeyboardInterrupt):
40 douglas 591 print
41    
42     sys.exit(1)

Properties

Name Value
svn:executable *
svn:keywords Id