Allow to set HDD password via command line

This commit is contained in:
Disassembler 2018-10-31 14:16:03 +01:00
parent 5919719f3e
commit 76220d811d
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
2 changed files with 10 additions and 1 deletions

View File

@ -10,5 +10,6 @@ cd $(realpath $(dirname "${0}"))
rm -rf /var/cache/apk/*
# Remove root settings
find /root -mindepth 1 -maxdepth 1 | xargs rm -rf
# Change root password
# Change passwords
vmmgr change-password
passwd

View File

@ -14,6 +14,9 @@ subparsers = parser.add_subparsers()
parser_install = subparsers.add_parser('install')
parser_install.set_defaults(action='install')
parser_change_password = subparsers.add_parser('change-password')
parser_change_password.set_defaults(action='change-password')
parser_update_login = subparsers.add_parser('update-login')
parser_update_login.set_defaults(action='update-login')
parser_update_login.add_argument('app', help='Application name')
@ -49,6 +52,11 @@ if args.action == 'install':
# Used during VM installation
mgr.rebuild_nginx()
mgr.create_selfsigned_cert()
elif args.action == 'change-password':
# Used during VM packaging
oldpassword = getpass.getpass('Old password: ')
newpassword = getpass.getpass('New password: ')
mgr.update_password(oldpassword, newpassword)
elif args.action == 'update-login':
# Used by app install scripts
mgr.update_login(args.app, args.login, args.password)