Patches look good. Only found one tiny nit. We should come up with a better name though, feels wrong that the name is very generic (and clashes with other uses), whilst the usage is quite specific (limited to "testing", "staging", "production").
Cheers, Tom On Tue, Jul 8, 2014 at 2:38 AM, Jóhann B. Guðmundsson <johan...@gmail.com> wrote: > --- > src/hostname/hostnamectl.c | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c > index 267cd74..e164086 100644 > --- a/src/hostname/hostnamectl.c > +++ b/src/hostname/hostnamectl.c > @@ -67,6 +67,7 @@ typedef struct StatusInfo { > char *pretty_hostname; > char *icon_name; > char *chassis; > + char *environment; > char *kernel_name; > char *kernel_release; > char *os_pretty_name; > @@ -92,9 +93,11 @@ static void print_status_info(StatusInfo *i) { > printf("Transient hostname: %s\n", i->hostname); > > printf(" Icon name: %s\n" > - " Chassis: %s\n", > + " Chassis: %s\n" > + " Environment: %s\n", > strna(i->icon_name), > - strna(i->chassis)); > + strna(i->chassis), > + strna(i->environment)); > > r = sd_id128_get_machine(&mid); > if (r >= 0) > @@ -157,6 +160,7 @@ static int show_all_names(sd_bus *bus) { > { "PrettyHostname", "s", NULL, offsetof(StatusInfo, > pretty_hostname) }, > { "IconName", "s", NULL, offsetof(StatusInfo, > icon_name) }, > { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) > }, > + { "Environment", "s", NULL, offsetof(StatusInfo, > environment) }, > { "KernelName", "s", NULL, offsetof(StatusInfo, > kernel_name) }, > { "KernelRelease", "s", NULL, offsetof(StatusInfo, > kernel_release) }, > { "OperatingSystemPrettyName", "s", NULL, > offsetof(StatusInfo, os_pretty_name) }, > @@ -194,6 +198,7 @@ fail: > free(info.pretty_hostname); > free(info.icon_name); > free(info.chassis); > + free(info.environment); > free(info.kernel_name); > free(info.kernel_release); > free(info.os_pretty_name); > @@ -309,6 +314,13 @@ static int set_chassis(sd_bus *bus, char **args, > unsigned n) { > return set_simple_string(bus, "SetChassis", args[1]); > } > > +static int set_environment(sd_bus *bus, char **args, unsigned n) { > + assert(args); > + assert(n == 2); > + > + return set_simple_string(bus, "SetEnvironment", args[1]); > +} > + > static int help(void) { > > printf("%s [OPTIONS...] COMMAND ...\n\n" > @@ -325,7 +337,8 @@ static int help(void) { > " status Show current hostname settings\n" > " set-hostname NAME Set system hostname\n" > " set-icon-name NAME Set icon name for host\n" > - " set-chassis NAME Set chassis type for host\n", > + " set-chassis NAME Set chassis type for host\n" > + " set-environment NAME Set environment for host\n", > program_invocation_short_name); > > return 0; > @@ -423,6 +436,7 @@ static int hostnamectl_main(sd_bus *bus, int argc, char > *argv[]) { > { "set-hostname", EQUAL, 2, set_hostname }, > { "set-icon-name", EQUAL, 2, set_icon_name }, > { "set-chassis", EQUAL, 2, set_chassis }, > + { "set-environment", EQUAL, 2, set_environment }, > }; > > int left; > -- > 1.9.3 > > _______________________________________________ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/systemd-devel _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel