From: Antoine Jacoutot Date: Sat, 16 Aug 2014 16:11:00 +0000 (+0200) Subject: Get/set info into /etc/machine-info. X-Git-Tag: gsoc-final~6 X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d6bffb8877bb40df1095c6966985c3ccd543548;p=systembsd.git Get/set info into /etc/machine-info. discussed with Ian --- diff --git a/Makefile b/Makefile index 7639490..bcfab91 100644 --- a/Makefile +++ b/Makefile @@ -95,11 +95,9 @@ _generate_servicefiles: _install_conf: _generate_servicefiles ${INSTALL_DATA_DIR} $(DESTDIR)$(DBUS_POLICYDIR) ${INSTALL_DATA_DIR} $(DESTDIR)$(DBUS_CONFIGDIR) - ${INSTALL_DATA_DIR} $(DESTDIR)$(SYSCONFDIR) ${INSTALL_DATA_DIR} $(DESTDIR)$(POLKIT_POLICYDIR) ${INSTALL_DATA} $(POLICYDIR)/*-dbus.conf $(DESTDIR)$(DBUS_POLICYDIR)/ ${INSTALL_DATA} $(SERVICEFDIR)/*.service $(DESTDIR)$(DBUS_CONFIGDIR)/ - ${INSTALL_DATA} $(CONFDIR)/systemd_compat.conf $(DESTDIR)$(SYSCONFDIR)/ ${INSTALL_DATA} $(POLKITDIR)/*.policy $(DESTDIR)$(POLKIT_POLICYDIR)/ _install_interface_binaries: $(LINKHN) diff --git a/conf/systemd_compat.conf b/conf/systemd_compat.conf deleted file mode 100644 index d59df78..0000000 --- a/conf/systemd_compat.conf +++ /dev/null @@ -1,4 +0,0 @@ -[hostnamed] -PrettyHostname= -IconName= -ChassisType= diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index 162cf5d..9bc1f9e 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -339,9 +339,9 @@ on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf, hostname1_complete_set_pretty_hostname(hn1_passed_interf, invoc); ret = TRUE; - if(g_key_file_load_from_file(config, "/etc/systemd_compat.conf", G_KEY_FILE_NONE, NULL)) { + if(g_key_file_load_from_file(config, "/etc/machine-info", G_KEY_FILE_NONE, NULL)) { - g_key_file_set_string(config, "hostnamed", "PrettyHostname", valid_pretty_hostname_buf); + g_key_file_set_string(config, "hostnamed", "PRETTY_HOSTNAME", valid_pretty_hostname_buf); if((computed_static_hostname = g_hostname_to_ascii(PRETTY_HOSTNAME))) { @@ -358,7 +358,7 @@ on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf, } } - g_key_file_save_to_file(config, "/etc/systemd_compat.conf", NULL); + g_key_file_save_to_file(config, "/etc/machine-info", NULL); g_key_file_unref(config); return ret; @@ -436,7 +436,7 @@ on_handle_set_chassis(Hostname1 *hn1_passed_interf, g_ptr_array_add(hostnamed_freeable, valid_chassis_name_buf); hostname1_complete_set_chassis(hn1_passed_interf, invoc); - if(g_key_file_load_from_file(config, "/etc/systemd_compat.conf", G_KEY_FILE_NONE, NULL)) { + if(g_key_file_load_from_file(config, "/etc/machine-info", G_KEY_FILE_NONE, NULL)) { ret = TRUE; g_key_file_set_string(config, "hostnamed", "ChassisType", valid_chassis_name_buf); @@ -445,7 +445,7 @@ on_handle_set_chassis(Hostname1 *hn1_passed_interf, } } - g_key_file_save_to_file(config, "/etc/systemd_compat.conf", NULL); + g_key_file_save_to_file(config, "/etc/machine-info", NULL); g_key_file_unref(config); return ret; @@ -517,7 +517,7 @@ on_handle_set_icon_name(Hostname1 *hn1_passed_interf, g_ptr_array_add(hostnamed_freeable, valid_icon_name_buf); hostname1_complete_set_icon_name(hn1_passed_interf, invoc); - if(g_key_file_load_from_file(config, "/etc/systemd_compat.conf", G_KEY_FILE_NONE, NULL)) { + if(g_key_file_load_from_file(config, "/etc/machine-info", G_KEY_FILE_NONE, NULL)) { ret = TRUE; g_key_file_set_string(config, "hostnamed", "IconName", valid_icon_name_buf); @@ -526,7 +526,7 @@ on_handle_set_icon_name(Hostname1 *hn1_passed_interf, } } - g_key_file_save_to_file(config, "/etc/systemd_compat.conf", NULL); + g_key_file_save_to_file(config, "/etc/machine-info", NULL); g_key_file_unref(config); return ret; @@ -807,8 +807,8 @@ gboolean set_names() { strncpy(ret, hostname_buf, hostname_divider); */ /* (3) set PRETTY_HOSTNAME */ - if(g_key_file_load_from_file(config, "/etc/systemd_compat.conf", G_KEY_FILE_NONE, NULL) - && (pretty_hostname_buf = g_key_file_get_value(config, "hostnamed", "PrettyHostname", NULL))) + if(g_key_file_load_from_file(config, "/etc/machine-info", G_KEY_FILE_NONE, NULL) + && (pretty_hostname_buf = g_key_file_get_value(config, "hostnamed", "PRETTY_HOSTNAME", NULL))) PRETTY_HOSTNAME = pretty_hostname_buf; else PRETTY_HOSTNAME = "";