mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
util: Add welcome message for Ubuntu
The approved method for determining the installed release of Ubuntu is to execute "lsb_release". However, this is in /usr/bin and is implemented in python so it is not safe to execute at this early stage of booting. This code parses /etc/lsb-release which is where "lsb_release" looks for the information.
This commit is contained in:
parent
858dae181b
commit
274914f991
14
src/util.c
14
src/util.c
@ -3025,6 +3025,20 @@ void status_welcome(void) {
|
||||
status_printf("Welcome to Debian \x1B[1;31m%s\x1B[0m!\n", r); /* Light Red for Debian */
|
||||
|
||||
free(r);
|
||||
#elif defined(TARGET_UBUNTU)
|
||||
char *desc = NULL;
|
||||
char *codename = NULL;
|
||||
|
||||
if (parse_env_file("/etc/lsb-release", NEWLINE,
|
||||
"DISTRIB_DESCRIPTION", &desc,
|
||||
"DISTRIB_CODENAME", &codename, NULL) < 0)
|
||||
return;
|
||||
if (desc && codename)
|
||||
/* Light Red for Ubuntu */
|
||||
status_printf("Welcome to \x1B[1;31m%s\x1B[0m (%s)\n",
|
||||
desc, codename);
|
||||
free(desc);
|
||||
free(codename);
|
||||
#elif defined(TARGET_ARCH)
|
||||
status_printf("Welcome to \x1B[1;36mArch Linux\x1B[0m!\n"); /* Cyan for Arch */
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user