tools: deprecate old ndnsec command aliases
These are: ndnsec-certgen, ndnsec-dump-certificate,
ndnsec-install-cert, ndnsec-keygen, ndnsec-ls-identity
Change-Id: I0fbc65d2a08f8e7812fd7e62cf6618ffe62671de
diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp
index 9c8e64e..024e5d5 100644
--- a/tools/ndnsec/main.cpp
+++ b/tools/ndnsec/main.cpp
@@ -50,6 +50,14 @@
Try 'ndnsec COMMAND --help' for more information on each command.)STR";
+const std::map<std::string, std::string> deprecatedCommands{
+ {"certgen", "cert-gen"},
+ {"dump-certificate", "cert-dump"},
+ {"install-cert", "cert-install"},
+ {"keygen", "key-gen"},
+ {"ls-identity", "list"},
+};
+
int
main(int argc, char* argv[])
{
@@ -58,6 +66,12 @@
std::string command;
if (basename.rfind("ndnsec-", 0) == 0) {
command = basename.substr(std::strlen("ndnsec-"));
+ auto it = deprecatedCommands.find(command);
+ if (it != deprecatedCommands.end()) {
+ std::cerr << "DEPRECATION NOTICE: ndnsec-" << it->first << " is deprecated. "
+ << "Please use 'ndnsec " << it->second << "' instead.\n";
+ command = it->second;
+ }
}
else if (argc >= 2) {
command = argv[1];
@@ -68,6 +82,7 @@
std::cerr << NDNSEC_HELP_TEXT << std::endl;
return 2;
}
+
NDN_LOG_TRACE("Command: " << command);
try {
diff --git a/tools/ndnsec/wscript b/tools/ndnsec/wscript
index caac9fc..55f557f 100644
--- a/tools/ndnsec/wscript
+++ b/tools/ndnsec/wscript
@@ -14,7 +14,11 @@
source=['main.cpp'],
use='tool-ndnsec-objects')
+ # create convenience symlinks
for cmd in ('list', 'get-default', 'set-default', 'delete',
'key-gen', 'sign-req', 'cert-gen', 'cert-install',
- 'cert-dump', 'export', 'import', 'unlock-tpm'):
+ 'cert-dump', 'export', 'import', 'unlock-tpm',
+ # deprecated aliases
+ 'certgen', 'dump-certificate', 'install-cert',
+ 'keygen', 'ls-identity'):
bld.symlink_as('${BINDIR}/ndnsec-%s' % cmd, 'ndnsec')
diff --git a/tools/wrapper/ndnsec-certgen.sh b/tools/wrapper/ndnsec-certgen.sh
deleted file mode 100644
index c31d1b2..0000000
--- a/tools/wrapper/ndnsec-certgen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-gen "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-dump-certificate.sh b/tools/wrapper/ndnsec-dump-certificate.sh
deleted file mode 100644
index c0e7c08..0000000
--- a/tools/wrapper/ndnsec-dump-certificate.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-dump "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-install-cert.sh b/tools/wrapper/ndnsec-install-cert.sh
deleted file mode 100644
index e89744a..0000000
--- a/tools/wrapper/ndnsec-install-cert.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-install "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-keygen.sh b/tools/wrapper/ndnsec-keygen.sh
deleted file mode 100644
index 6dd142d..0000000
--- a/tools/wrapper/ndnsec-keygen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec key-gen "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-ls-identity.sh b/tools/wrapper/ndnsec-ls-identity.sh
deleted file mode 100644
index 4f173bf..0000000
--- a/tools/wrapper/ndnsec-ls-identity.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec list "$@"
\ No newline at end of file
diff --git a/tools/wscript b/tools/wscript
index b8c2358..8223ab2 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -43,13 +43,3 @@
target=top + 'bin/%s' % name,
source=[mainFile],
use='ndn-cxx ' + srcObjects)
-
- # Tool wrappers
- wrapperFiles = bld.path.ant_glob('wrapper/*.sh')
- bld(name='tool-wrappers',
- features='subst',
- source=wrapperFiles,
- target=[top + 'bin/%s' % node.change_ext('', '.sh').path_from(bld.path.find_dir('wrapper').get_bld())
- for node in wrapperFiles],
- install_path='${BINDIR}',
- chmod=Utils.O755)