This commit is contained in:
Your Name 2023-11-02 18:34:27 +03:00
parent dfa1d3ad24
commit 519d0b1e5d
2 changed files with 37 additions and 10 deletions

View File

@ -48,10 +48,37 @@ int GetOs(char *os_name, size_t len) {
return 1;
}
void SetArt(FETCH *fetch, size_t size, char *pkg_cmd, char **logo, char *color) {
fetch->logo_size = size;
fetch->logo = logo;
fetch->pkg_cmd = pkg_cmd;
fetch->color = color;
}
void GetArt(FETCH *fetch) {
fetch->color = "\033[36m";
fetch->logo = Unknow;
fetch->logo_size = sizeof(Unknow) / sizeof(char *);
if (strstr(fetch->os_name, "Debian"))
SetArt(fetch, sizeof(Debian) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Debian, "\033[0;31m");
else if (strstr(fetch->os_name, "Void"))
SetArt(fetch, sizeof(Void) / sizeof(char *), "xbps-query -l | wc -l", Void, "\033[0;32m");
else if (strstr(fetch->os_name, "Alpine"))
SetArt(fetch, sizeof(Alpine) / sizeof(char *), "grep 'P:' /lib/apk/db/installed | wc -l", Alpine, "\033[1;34m");
else if (strstr(fetch->os_name, "Arch") || strstr(fetch->os_name, "Artix"))
SetArt(fetch, sizeof(Arch) / sizeof(char *), "pacman -Qq | wc -l", Arch, "\033[0;34m");
else if (strstr(fetch->os_name, "PlainOs"))
SetArt(fetch, sizeof(PlainOs) / sizeof(char *), NULL, PlainOs, "\033[37m");
else if (strstr(fetch->os_name, "OpenBSD"))
SetArt(fetch, sizeof(OpenBSD) / sizeof(char *), "/bin/ls -1 /var/db/pkg/ | wc -l | tr -d ' '", OpenBSD, "\033[1;33m");
else if (!chdir("/system"))
SetArt(fetch, sizeof(Android) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Android, "\033[32m");
else
SetArt(fetch, sizeof(Unknow) / sizeof(char *), NULL, Unknow, "\033[1;36m");
}
void GetKernel(const char *title, const FETCH fetch) {