chiark / gitweb /
.network/.netdev/.link: allow to match on architecture
[elogind.git] / src / hostname / hostnamectl.c
index 523177b27d4d412d54d7734c25130956a1aea4a4..e455249e9eee86e5067672ea3e9e194ecfd2c2c7 100644 (file)
@@ -39,6 +39,7 @@
 #include "strv.h"
 #include "sd-id128.h"
 #include "virt.h"
+#include "architecture.h"
 #include "fileio.h"
 
 static bool arg_ask_password = true;
@@ -69,7 +70,7 @@ typedef struct StatusInfo {
 } StatusInfo;
 
 static void print_status_info(StatusInfo *i) {
-        sd_id128_t mid, bid;
+        sd_id128_t mid = {}, bid = {};
         int r;
         const char *id = NULL;
         _cleanup_free_ char *pretty_name = NULL, *cpe_name = NULL;
@@ -121,7 +122,9 @@ static void print_status_info(StatusInfo *i) {
 
         assert_se(uname(&u) >= 0);
         printf("            Kernel: %s %s\n"
-               "      Architecture: %s\n", u.sysname, u.release, u.machine);
+               "      Architecture: %s\n",
+               u.sysname, u.release,
+               architecture_to_string(uname_architecture()));
 
 }
 
@@ -145,7 +148,7 @@ static int show_one_name(sd_bus *bus, const char* attr) {
 
         r = sd_bus_message_read(reply, "s", &s);
         if (r < 0)
-                return r;
+                return bus_log_parse_error(r);
 
         printf("%s\n", s);
 
@@ -285,7 +288,7 @@ static int set_chassis(sd_bus *bus, char **args, unsigned n) {
         assert(args);
         assert(n == 2);
 
-        return set_simple_string(bus, "SetChasis", args[1]);
+        return set_simple_string(bus, "SetChassis", args[1]);
 }
 
 static int help(void) {
@@ -294,12 +297,12 @@ static int help(void) {
                "Query or change system hostname.\n\n"
                "  -h --help              Show this help\n"
                "     --version           Show package version\n"
-               "     --transient         Only set transient hostname\n"
-               "     --static            Only set static hostname\n"
-               "     --pretty            Only set pretty hostname\n"
                "     --no-ask-password   Do not prompt for password\n"
                "  -H --host=[USER@]HOST  Operate on remote host\n"
-               "  -M --machine=CONTAINER Operate on local container\n\n"
+               "  -M --machine=CONTAINER Operate on local container\n"
+               "     --transient         Only set transient hostname\n"
+               "     --static            Only set static hostname\n"
+               "     --pretty            Only set pretty hostname\n\n"
                "Commands:\n"
                "  status                 Show current hostname settings\n"
                "  set-hostname NAME      Set system hostname\n"