diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2010-01-24 23:06:21 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2010-01-24 23:06:21 +0530 |
commit | d25db9a281620d647971b864b9d43c261a2da9b1 (patch) | |
tree | 7f29e6868e7a8454dba0616c0bbe9d6dc0385f8d | |
parent | Add net-misc/mobile-broadband-provider-info-20100122 (diff) | |
download | nirbheek-d25db9a281620d647971b864b9d43c261a2da9b1.tar.gz nirbheek-d25db9a281620d647971b864b9d43c261a2da9b1.tar.bz2 nirbheek-d25db9a281620d647971b864b9d43c261a2da9b1.zip |
net-misc/networkmanager: Read system hostname file
-rw-r--r-- | net-misc/networkmanager/Manifest | 3 | ||||
-rw-r--r-- | net-misc/networkmanager/files/networkmanager-0.8-read-hostname.patch | 76 | ||||
-rw-r--r-- | net-misc/networkmanager/networkmanager-0.8.0_rc3.ebuild | 3 |
3 files changed, 81 insertions, 1 deletions
diff --git a/net-misc/networkmanager/Manifest b/net-misc/networkmanager/Manifest index 6d92bb7..b54e4ae 100644 --- a/net-misc/networkmanager/Manifest +++ b/net-misc/networkmanager/Manifest @@ -1,4 +1,5 @@ AUX networkmanager-0.7.1-confchanges.patch 968 RMD160 7216f028613a29cf619029db3178cb0510aa3c1b SHA1 d818ddeb553862e18f0f796dcf30e53e25af0bd4 SHA256 5032ffd7fddbd9f67ef05ee0159f77e67b8c08b1aac9ef5209363fb02297d437 +AUX networkmanager-0.8-read-hostname.patch 2380 RMD160 8b4349293235d2b63546b4e65d30a94d91ab9a04 SHA1 f7d57c686e9bd1f1ac58e67efcd8255c0fc9a5c5 SHA256 5ee07a0fb949c7ce299f0d2459c4f9840ace765308cd1a208d89eecec51a63fe AUX nm-system-settings.conf 23 RMD160 6d66c702b345bde668a420a15716feea6005fbd1 SHA1 49ba558d20f5ca5a201e027e13b878dd5ac3569c SHA256 44b048804c7c0b8b3b0c29b8632b6ad613c397d0a1635ec918e10c0fbcdadf21 DIST NetworkManager-0.8-rc3.tar.bz2 775283 RMD160 a8442395b341fa4b5a6a6181a1d0b42058792186 SHA1 d69a0c57c61d6138a4c25a110bc75c55f9d008dd SHA256 c603034ad7765aca802bb87b3c1318c9ac1fad26a8102b45cd15b0cfa8dc59de -EBUILD networkmanager-0.8.0_rc3.ebuild 3657 RMD160 ffc5432ecd2598ac1009ff8cf7e81d1338c85139 SHA1 3d230342b855d0fbd7376f1f54112227b6bd475c SHA256 e3dbf2b67746aeecfb599bb189c176dd455f86941f04f4bd0959b8855629abd3 +EBUILD networkmanager-0.8.0_rc3.ebuild 3773 RMD160 cdb61892705d80a8144e0392cca0b18309034296 SHA1 107d569e58fc2e1221de080146573a2b96562098 SHA256 da358403b5f451de5d2acf4ac822a77e550bc0cf48dc56c69c6623bc325a4974 diff --git a/net-misc/networkmanager/files/networkmanager-0.8-read-hostname.patch b/net-misc/networkmanager/files/networkmanager-0.8-read-hostname.patch new file mode 100644 index 0000000..ac59fe2 --- /dev/null +++ b/net-misc/networkmanager/files/networkmanager-0.8-read-hostname.patch @@ -0,0 +1,76 @@ +When reading hostname from NM keyfile, if no hostname is set, read from the +system file at /etc/conf.d/hostname to set hostname. This patch is not meant to +be ever upstreamed. Proper fix is to write a gentoo-specific ifcfg plugin. + +To change hostname, touch nm-system-settings.conf, which will reload the keyfile +and cause /etc/conf.d/hostname to be reloaded. + +This horrible hack fixes http://bugs.gentoo.org/176873 + +Author: Nirbheek Chauhan <nirbheek@gentoo.org> +Reviewed-by: Arun Raghavan <ford_prefect@gentoo.org> + +--- +--- system-settings/plugins/keyfile/plugin.c ++++ system-settings/plugins/keyfile/plugin.c +@@ -43,6 +43,9 @@ + #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2008 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." + + #define CONF_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf" ++#ifdef TARGET_GENTOO ++#define HOSTNAME_FILE SYSCONFDIR "/conf.d/hostname" ++#endif + + static char *plugin_get_hostname (SCPluginKeyfile *plugin); + static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); +@@ -381,6 +384,12 @@ + GKeyFile *key_file; + char *hostname = NULL; + GError *error = NULL; ++#ifdef TARGET_GENTOO ++ char *contents = NULL; ++ char **lines = NULL, **line; ++ GError *contents_err = NULL; ++ gsize contents_len = 0; ++#endif + + key_file = g_key_file_new (); + if (g_key_file_load_from_file (key_file, CONF_FILE, G_KEY_FILE_NONE, &error)) +@@ -392,7 +401,37 @@ + + g_key_file_free (key_file); + ++ if (hostname) ++ goto out; ++#ifdef TARGET_GENTOO ++ /* If hostname is unset in keyfile, read system file to get hostname */ ++ if (!g_file_get_contents (HOSTNAME_FILE, &contents, ++ &contents_len, &contents_err)) ++ goto out; ++ ++ lines = g_strsplit_set (contents, "\n\r", 0); ++ if (!lines) ++ goto out; ++ ++ for (line = lines; *line; line++) { ++ if (!g_str_has_prefix (*line, "hostname=")) ++ continue; ++ hostname = g_strsplit_set (g_strsplit_set (*line, "=", 0)[1], "#", 0)[0]; ++ g_strstrip (hostname); ++ if (!hostname) ++ goto out; ++ /* Remove quotes surrounding hostname */ ++ if (hostname[0] == '"' && hostname[strlen(hostname)-1] == '"') ++ contents = g_strndup(&hostname[1], strlen(hostname)-2); ++ /* Un-escape before using to imitate librc behaviour */ ++ hostname = g_strcompress (contents); ++ } ++ ++out: ++ g_error_free(contents_err); ++ + return hostname; ++#endif + } + + static gboolean diff --git a/net-misc/networkmanager/networkmanager-0.8.0_rc3.ebuild b/net-misc/networkmanager/networkmanager-0.8.0_rc3.ebuild index 6e311d3..09993a3 100644 --- a/net-misc/networkmanager/networkmanager-0.8.0_rc3.ebuild +++ b/net-misc/networkmanager/networkmanager-0.8.0_rc3.ebuild @@ -58,6 +58,9 @@ src_prepare() { # Fix up the dbus conf file to use plugdev group epatch "${FILESDIR}/${PN}-0.7.1-confchanges.patch" + # Hack keyfile plugin to read hostname file, fixes bug 176873 + epatch "${FILESDIR}/${PN}-0.8-read-hostname.patch" + # git snapshot gtkdocize || die "gtkdocize failed" intltoolize --force |