From 76220d811d9cc1136fea8b3aa0628195c3faa5b4 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 31 Oct 2018 14:16:03 +0100 Subject: [PATCH] Allow to set HDD password via command line --- 00-install.sh | 3 ++- basic/srv/vm/cli.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/00-install.sh b/00-install.sh index 1bedce6..9135204 100755 --- a/00-install.sh +++ b/00-install.sh @@ -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 diff --git a/basic/srv/vm/cli.py b/basic/srv/vm/cli.py index aec08c8..fe3327e 100755 --- a/basic/srv/vm/cli.py +++ b/basic/srv/vm/cli.py @@ -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)