nspawn: add --version
This commit is contained in:
parent
6a17986542
commit
acbeb42770
|
@ -138,6 +138,13 @@
|
||||||
text and exits.</para></listitem>
|
text and exits.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--version</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Prints a version string
|
||||||
|
and exits.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--directory=</option></term>
|
<term><option>--directory=</option></term>
|
||||||
<term><option>-D</option></term>
|
<term><option>-D</option></term>
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "sd-id128.h"
|
#include "sd-id128.h"
|
||||||
#include "dev-setup.h"
|
#include "dev-setup.h"
|
||||||
#include "fdset.h"
|
#include "fdset.h"
|
||||||
|
#include "build.h"
|
||||||
|
|
||||||
typedef enum LinkJournal {
|
typedef enum LinkJournal {
|
||||||
LINK_NO,
|
LINK_NO,
|
||||||
|
@ -102,6 +103,7 @@ static int help(void) {
|
||||||
printf("%s [OPTIONS...] [PATH] [ARGUMENTS...]\n\n"
|
printf("%s [OPTIONS...] [PATH] [ARGUMENTS...]\n\n"
|
||||||
"Spawn a minimal namespace container for debugging, testing and building.\n\n"
|
"Spawn a minimal namespace container for debugging, testing and building.\n\n"
|
||||||
" -h --help Show this help\n"
|
" -h --help Show this help\n"
|
||||||
|
" --version Print version string\n"
|
||||||
" -D --directory=NAME Root directory for the container\n"
|
" -D --directory=NAME Root directory for the container\n"
|
||||||
" -b --boot Boot up full system (i.e. invoke init)\n"
|
" -b --boot Boot up full system (i.e. invoke init)\n"
|
||||||
" -u --user=USER Run the command under specified user or uid\n"
|
" -u --user=USER Run the command under specified user or uid\n"
|
||||||
|
@ -120,7 +122,8 @@ static int help(void) {
|
||||||
static int parse_argv(int argc, char *argv[]) {
|
static int parse_argv(int argc, char *argv[]) {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARG_PRIVATE_NETWORK = 0x100,
|
ARG_VERSION = 0x100,
|
||||||
|
ARG_PRIVATE_NETWORK,
|
||||||
ARG_UUID,
|
ARG_UUID,
|
||||||
ARG_READ_ONLY,
|
ARG_READ_ONLY,
|
||||||
ARG_CAPABILITY,
|
ARG_CAPABILITY,
|
||||||
|
@ -129,6 +132,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
|
{ "version", no_argument, NULL, ARG_VERSION },
|
||||||
{ "directory", required_argument, NULL, 'D' },
|
{ "directory", required_argument, NULL, 'D' },
|
||||||
{ "user", required_argument, NULL, 'u' },
|
{ "user", required_argument, NULL, 'u' },
|
||||||
{ "controllers", required_argument, NULL, 'C' },
|
{ "controllers", required_argument, NULL, 'C' },
|
||||||
|
@ -154,6 +158,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
help();
|
help();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case ARG_VERSION:
|
||||||
|
puts(PACKAGE_STRING);
|
||||||
|
puts(SYSTEMD_FEATURES);
|
||||||
|
return 0;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
free(arg_directory);
|
free(arg_directory);
|
||||||
arg_directory = canonicalize_file_name(optarg);
|
arg_directory = canonicalize_file_name(optarg);
|
||||||
|
|
Loading…
Reference in a new issue