aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--src/hostnamed.c9
2 files changed, 8 insertions, 4 deletions
diff --git a/TODO b/TODO
index ff32ee0..9b68c84 100644
--- a/TODO
+++ b/TODO
@@ -6,9 +6,6 @@ if the relevant variable is set in /etc/rc.conf (go to read-only mode?)
What happens if e.g. /etc/conf.d/hostname.{runlevel} files exist? Just
document that this case is not supported?
-Write an init.d file to read RC_SYS so that we can piggyback on openrc's
-built-in virtualization detection.
-
De-systemd-ize hwclock.c
Do something about runtime dependency on systemd's org.freedesktop.hostname1.policy,
diff --git a/src/hostnamed.c b/src/hostnamed.c
index 1fb14c0..b476cdb 100644
--- a/src/hostnamed.c
+++ b/src/hostnamed.c
@@ -26,6 +26,8 @@
#include <gio/gio.h>
#include <polkit/polkit.h>
+#include <rc.h>
+
#include "hostnamed.h"
#include "hostname1-generated.h"
#include "utils.h"
@@ -68,10 +70,15 @@ hostname_is_valid (const gchar *name)
static gchar *
guess_icon_name ()
{
- /* TODO: detect virtualization by reading rc_sys */
gchar *filebuf = NULL;
gchar *ret = NULL;
+ /* Note that rc_sys() leaks memory :( */
+ if (rc_sys() != NULL) {
+ ret = g_strdup ("computer-vm");
+ goto out;
+ }
+
#if defined(__i386__) || defined(__x86_64__)
/*
Taken with a few minor changes from systemd's hostnamed