#!/usr/bin/env sh
"exec" "`dirname $0`/usr/local/bin/python3" "$0" "$@"
#
# Copyright (c) 2011 Duo Security
# All Rights Reserved
#

# This import _must_ be first
import _fipscustomize # noqa: F401, isort:skip

import optparse
import os
import sys

from duoauthproxy.linux_installer.authproxy_installer import do_install


def main(argv):
    parser = optparse.OptionParser()
    parser.add_option('--install-dir', default=None,
                      help='(The directory to where you want to install the authentication proxy. Recommendation: \'/opt/duoauthproxy\' Default: prompt)')
    parser.add_option('--service-user', default=None,
                      help='(The name of the user account under which the Authentication Proxy should run. Recommendation: \'duo_authproxy_svc\' Default: prompt)')
    parser.add_option('--log-group', default=None,
                      help='(The name of the group under which the Authentication Proxy logs can be read. Recommendation: \'duo_authproxy_grp\' Default: prompt)')
    parser.add_option('--silent', action='store_true', help="Don't prompt for values, use defaults")
    parser.add_option('--create-init-script', choices=['yes', 'no'], default=None,
                      help='(Create an initialization script to run the proxy upon startup. Choices: [yes/no]) Default: prompt')
    parser.add_option('--enable-selinux', choices=['yes', 'no'], default=None,
                      help='Install the SELinux module. By default, the module will not be installed but once installed will be preserved during upgrades until explicitly removed by providing "no" to this option or its respective prompt.  Choices: [yes/no] Default: prompt')

    (options, args) = parser.parse_args()
    src_dir = os.path.dirname(os.path.abspath(__file__))
    return do_install(src_dir, options)

if __name__ == '__main__':
    sys.exit(main(sys.argv))
