This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 3.x development tree".
The branch, master has been updated via e0bee503456c9d1f0c5c9606635a95e1d220310e (commit) from f0ed5737d5b64ff1f584c686be8a0fc2afcfca67 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit e0bee503456c9d1f0c5c9606635a95e1d220310e Author: Michael Tremer michael.tremer@ipfire.org Date: Sat May 28 21:35:44 2011 +0200
lldpd: Add support for /etc/os-release.
-----------------------------------------------------------------------
Summary of changes: pkgs/lldpd/lldpd.nm | 2 +- pkgs/lldpd/patches/lldpd-0.52.x-os-release.patch | 92 ++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletions(-) create mode 100644 pkgs/lldpd/patches/lldpd-0.52.x-os-release.patch
Difference in files: diff --git a/pkgs/lldpd/lldpd.nm b/pkgs/lldpd/lldpd.nm index 68f91cb..1d76203 100644 --- a/pkgs/lldpd/lldpd.nm +++ b/pkgs/lldpd/lldpd.nm @@ -26,7 +26,7 @@ include $(PKGROOT)/Include
PKG_NAME = lldpd PKG_VER = 0.5.2 -PKG_REL = 3 +PKG_REL = 4
PKG_MAINTAINER = PKG_GROUPS = Networking/Tools diff --git a/pkgs/lldpd/patches/lldpd-0.52.x-os-release.patch b/pkgs/lldpd/patches/lldpd-0.52.x-os-release.patch new file mode 100644 index 0000000..3d45fee --- /dev/null +++ b/pkgs/lldpd/patches/lldpd-0.52.x-os-release.patch @@ -0,0 +1,92 @@ +commit ae87586a12eaf4e8329b88f6e0c629e7b14f27bc +Author: Michael Tremer michael.tremer@ipfire.org +Date: Sat May 28 14:29:33 2011 +0200 + + Add support to read /etc/os-release for system information. + + /etc/os-release is introduced with systemd which will be in all the + major distributions, soon. For backwards-compatibility, the lsb_release + method is still there and will be used if no /etc/os-release is available. + +diff --git a/src/lldpd.c b/src/lldpd.c +index b19af11..1641f13 100644 +--- a/src/lldpd.c ++++ b/src/lldpd.c +@@ -89,6 +89,7 @@ static void lldpd_decode(struct lldpd *, char *, int, + static void lldpd_update_chassis(struct lldpd_chassis *, + const struct lldpd_chassis *); + static char *lldpd_get_lsb_release(void); ++static char *lldpd_get_os_release(void); + #ifdef ENABLE_LLDPMED + static void lldpd_med(struct lldpd_chassis *); + #endif +@@ -553,6 +554,46 @@ lldpd_get_lsb_release() { + return NULL; + } + ++/* Same like lldpd_get_lsb_release but reads /etc/os-release for PRETTY_NAME=. */ ++static char * ++lldpd_get_os_release() { ++ static char release[1024]; ++ ++ FILE *fp = fopen("/etc/os-release", "r"); ++ if (!fp) { ++ LLOG_WARN("Could not open /etc/os-release to read system information"); ++ return NULL; ++ } ++ ++ char line[1024]; ++ char *key, *val; ++ ++ while ((fgets(line, 1024, fp) != NULL)) { ++ key = strtok(line, "="); ++ val = strtok(NULL, "="); ++ ++ if (strncmp(key, "PRETTY_NAME", 1024) == 0) { ++ strncpy(release, val, 1024); ++ break; ++ } ++ } ++ fclose(fp); ++ ++ /* Remove trailing newline and all " in the string. */ ++ char *ptr1 = release; ++ char *ptr2 = release; ++ while (*ptr1 != 0) { ++ if ((*ptr1 == '"') || (*ptr1 == '\n')) { ++ ++ptr1; ++ } else { ++ *ptr2++ = *ptr1++; ++ } ++ } ++ *ptr2 = 0; ++ ++ return release; ++} ++ + int + lldpd_callback_add(struct lldpd *cfg, int fd, void(*fn)(CALLBACK_SIG), void *data) + { +@@ -889,7 +930,7 @@ lldpd_update_localchassis(struct lldpd *cfg) + fatal("failed to set full system description"); + } else { + if (cfg->g_advertise_version) { +- if (asprintf(&LOCAL_CHASSIS(cfg)->c_descr, "%s%s %s %s", ++ if (asprintf(&LOCAL_CHASSIS(cfg)->c_descr, "%s %s %s %s", + cfg->g_lsb_release?cfg->g_lsb_release:"", + un.sysname, un.release, un.machine) + == -1) +@@ -1189,7 +1230,12 @@ lldpd_main(int argc, char *argv[]) + close(pid); + } + +- lsb_release = lldpd_get_lsb_release(); ++ /* Try to read system information from /etc/os-release if possible. ++ Fall back to lsb_release for compatibility. */ ++ lsb_release = lldpd_get_os_release(); ++ if (!lsb_release) { ++ lsb_release = lldpd_get_lsb_release(); ++ } + + priv_init(PRIVSEP_CHROOT); +
hooks/post-receive -- IPFire 3.x development tree