diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-10-14 19:36:32 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-10-14 19:36:32 +0000 |
commit | 60a8f9866e39b0eb0f5f0e15057f36679d007522 (patch) | |
tree | e86d39f59a06ada627d57addf02b31810730853d /loader2/loader.c | |
parent | 6af42d3070c2528db2c3fb47a3613e150ef1c449 (diff) | |
download | anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.tar.gz anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.tar.xz anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.zip |
read product path from the build stamp if possible, default to RedHat if not
available. basically notting's patch with some fixes and genhdlist handled
Diffstat (limited to 'loader2/loader.c')
-rw-r--r-- | loader2/loader.c | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/loader2/loader.c b/loader2/loader.c index b5aafa4e8..d3086a8ba 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -183,35 +183,56 @@ void stopNewt(void) { newtRunning = 0; } -char * getProductName(void) { - static char * productName = NULL; +static char * productName = NULL; +static char * productPath = NULL; + +static void initProductInfo(void) { FILE *f; int i; - if (!productName) { - f = fopen("/.buildstamp", "r"); - if (!f) { - productName = strdup("anaconda"); - } else { - productName = malloc(256); - fgets(productName, 256, f); /* stamp time */ - fgets(productName, 256, f); /* product name */ - - i = strlen(productName) - 1; - while (isspace(*(productName + i))) { - *(productName + i) = '\0'; - i--; - } - - return productName; - } + f = fopen("/.buildstamp", "r"); + if (!f) { + productName = strdup("anaconda"); + productPath = strdup("RedHat"); } else { - return productName; + productName = malloc(256); + productPath = malloc(256); + fgets(productName, 256, f); /* stamp time */ + fgets(productName, 256, f); /* product name */ + fgets(productPath, 256, f); /* product version */ + fgets(productPath, 256, f); /* product path */ + + i = strlen(productName) - 1; + while (isspace(*(productName + i))) { + *(productName + i) = '\0'; + i--; + } + i = strlen(productPath) - 1; + while (isspace(*(productPath + i))) { + *(productPath + i) = '\0'; + i--; + } } +} - return NULL; +char * getProductName(void) { + if (!productName) { + initProductInfo(); + } + return productName; +} + +char * getProductPath(void) { + if (!productPath) { + initProductInfo(); + } + return productPath; } + + + + void initializeConsole(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags) { if (!FL_NOFB(flags)) |