3 # Copyright (C) 2014 Simo Sorce <simo@redhat.com>
5 # see file 'COPYING' for use and warranty information
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 from ipsilon.login.common import LoginMgrsInstall
21 from ipsilon.providers.common import ProvidersInstall
28 'Login Managers': LoginMgrsInstall().plugins,
29 'Auth Providers': ProvidersInstall().plugins
34 def parse_args(plugins):
35 parser = argparse.ArgumentParser(description='Ipsilon Install Options')
36 parser.add_argument('--version',
37 action='version', version='%(prog)s 0.1')
38 parser.add_argument('-o', '--login-managers-order', dest='lm_order',
39 help='Comma separated list of login managers')
40 parser.add_argument('--ipa', choices=['yes', 'no'], default='yes',
41 help='Detect and use an IPA server for authentication')
45 for plugin_group in plugins:
46 group = parser.add_argument_group(plugin_group)
47 for plugin_name in plugins[plugin_group]:
48 plugin = plugins[plugin_group][plugin_name]
49 if plugin.ptype == 'login':
50 lms.append(plugin.name)
51 plugin.install_args(group)
53 args = vars(parser.parse_args())
55 if args['lm_order'] is None:
58 if args[name] == 'yes':
59 args['lm_order'].append(name)
61 args['lm_order'] = args['lm_order'].split(',')
63 if len(args['lm_order']) == 0:
64 #force the basic pam provider if nothing else is selected
68 args['lm_order'] = ['pam']
73 if __name__ == '__main__':
74 found_plugins = find_plugins()
75 opts = parse_args(found_plugins)