diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 5b321c98d..025e49773 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -21,7 +21,13 @@ try: except subprocess.CalledProcessError: pass -key_file = os.getenv('KEY_FILE', '/root/.ssh/authorized_keys') +key_file = os.getenv('KEY_FILE', None) +if os.path.isfile('/home/ec2-user/.ssh/authorized_keys'): + key_file = '/home/ec2-user/.ssh/authorized_keys' +elif os.path.isfile('/home/ubuntu/.ssh/authorized_keys'): + key_file = '/home/ubuntu/.ssh/authorized_keys' +else: + key_file = '/root/.ssh/authorized_keys' admin_keys = [] if os.path.isfile(key_file): @@ -72,6 +78,7 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): content = PAGE.replace('{VERSION}', VERSION) content = content.replace('{HOSTNAME}', hostname) + content = content.replace('{AUTHORIZED_KEYS_LOCATION}', key_file) content = content.replace('{ADMIN_KEYS}', "\n".join(admin_keys)) self.send_response(200) self.end_headers() @@ -212,33 +219,91 @@ PAGE = """