ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/ccs/admin/chsh.py
Revision: 593
Committed: 2009-10-14T01:23:17-07:00 (15 years, 8 months ago) by douglas
Content type: text/x-python
File size: 930 byte(s)
Log Message:
passwd!

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 593 import ldap
12 douglas 587 import re
13    
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 douglas 592
37     admin.run(common.chsh_all(user, shell, shells))
38 douglas 593 except ldap.LDAPError, error:
39     admin.error(error)
40 douglas 587 except (EOFError, KeyboardInterrupt):
41 douglas 592 admin.eof()

Properties

Name Value
svn:executable *
svn:keywords Id