diff options
author | Kay Sievers <kay@vrfy.org> | 2013-02-26 15:27:22 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-02-26 15:27:22 +0100 |
commit | 99d758f40a3001a0e2e03921c5c560e11eb8e142 (patch) | |
tree | 0b45ed89749e43c08edd72d0a827f2a2cc40b91e /src | |
parent | 10f0a340483995f0576788043a2b2f2c6cfa486b (diff) |
setup: install - write machine-id to default pattern
Diffstat (limited to 'src')
-rw-r--r-- | src/setup/setup.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/setup/setup.c b/src/setup/setup.c index 9f71bb7..d36aad5 100644 --- a/src/setup/setup.c +++ b/src/setup/setup.c @@ -1202,24 +1202,22 @@ static int remove_variables(const uint8_t uuid[16], const char *path, bool in_or static int install_loader_config(const char *esp_path) { char *p = NULL; - char line[LINE_MAX]; + char line[64]; char *vendor = NULL; FILE *f; - f = fopen("/etc/os-release", "re"); + f = fopen("/etc/machine-id", "re"); if (!f) return -errno; - while (fgets(line, sizeof(line), f) != NULL) { + if (fgets(line, sizeof(line), f) != NULL) { char *s; - if (strncmp(line, "ID=", 3) != 0) - continue; - vendor = line + 3; - s = strchr(vendor, '\n'); + s = strchr(line, '\n'); if (s) s[0] = '\0'; - break; + if (strlen(line) == 32) + vendor = line; } fclose(f); |