Commit fd89e862 authored by Likun Zhang's avatar Likun Zhang
Browse files

Move usermgr from "trunk/tools/" to "trunk/src/bin" according Jeremy's...

Move usermgr from "trunk/tools/" to "trunk/src/bin" according Jeremy's suggestion. usermgr can be installed now.  

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1272 e5f2f494-b856-4b98-b285-d166d9295462
parent 05b22ab2
......@@ -206,6 +206,7 @@ AC_CONFIG_FILES([Makefile
src/bin/msgq/Makefile
src/bin/auth/Makefile
src/bin/xfrin/Makefile
src/bin/usermgr/Makefile
src/lib/Makefile
src/lib/cc/Makefile
src/lib/python/Makefile
......@@ -235,6 +236,8 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
src/bin/bindctl/unittest/bindctl_test
src/bin/loadzone/run_loadzone
src/bin/loadzone/b10-loadzone.py
src/bin/usermgr/run_b10-cmdctl-usermgr.sh
src/bin/usermgr/b10-cmdctl-usermgr.py
src/bin/msgq/msgq.py
src/bin/msgq/msgq_test
src/bin/msgq/run_msgq.sh
......@@ -252,9 +255,10 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
chmod +x src/bin/bindctl/unittest/bindctl_test
chmod +x src/bin/bindctl/bindctl
chmod +x src/bin/loadzone/run_loadzone
chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
chmod +x src/bin/msgq/run_msgq.sh
chmod +x src/bin/msgq/msgq_test
chmod +x src/lib/dns/gen-rdatacode.py
chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
chmod +x src/lib/dns/gen-rdatacode.py
chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
])
AC_OUTPUT
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin usermgr
pkglibexecdir = $(libexecdir)/@PACKAGE@
pkglibexec_SCRIPTS = b10-cmdctl-usermgr
b10_cmdctl_usermgrdir = $(DESTDIR)$(pkgdatadir)
CLEANFILES= b10-cmdctl-usermgr
# TODO: does this need $$(DESTDIR) also?
# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
b10-cmdctl-usermgr: b10-cmdctl-usermgr.py
$(SED) "s|@@PYTHONPATH@@|@pyexecdir@|" b10-cmdctl-usermgr.py >$@
chmod a+x $@
Create new account by running the following command:
b10-cmdctl-usermgr -f filename
If parameter '-f' is specified, new accounts will be appended to that file if it exists, or else the accounts will be saved in default file 'cmdctl-accounts.csv'.
#!@PYTHON@
# Copyright (C) 2010 Internet Systems Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
......@@ -15,7 +17,7 @@
'''
This file implements user management program. The user name and
its password is appended in csv file.
its password is appended to csv file.
'''
import random
from hashlib import sha1
......@@ -25,7 +27,7 @@ import getopt
import sys
VERSION_NUMBER = 'bind10'
DEFAULT_FILE = 'passwd.csv'
DEFAULT_FILE = 'cmdctl-accounts.csv'
def gen_password_hash(password):
salt = "".join(chr(random.randint(33, 127)) for x in range(64))
......@@ -55,7 +57,7 @@ def save_userinfo(username, pw, salt, filename):
writer = csv.writer(csvfile)
writer.writerow([username, pw, salt])
csvfile.close()
print("add user success!")
print("\n create new account successfully! \n")
def usage():
print('''Usage: usermgr [options]
......@@ -103,7 +105,7 @@ def main():
salt, pw = gen_password_hash(pwd1)
save_userinfo(name, pw, salt, filename)
inputdata = input('continue by input \'y\' or \'Y\':')
inputdata = input('continue to create new account by input \'y\' or \'Y\':')
if inputdata not in ['y', 'Y']:
break
......
#! /bin/sh
PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
export PYTHON_EXEC
MYPATH_PATH=@abs_top_builddir@/src/bin/usermgr
cd ${MYPATH_PATH}
${PYTHON_EXEC} b10-cmdctl-usermgr
Create user and its password by running the following command:
python3 usermgr.py [-f filename]
If no filename is specified in command line, the user and its password are saved in default file 'passwd.csv'.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment