Added support for raspbian, fixed #36. GPU info is wip.

This commit is contained in:
TheDarkBug 2021-03-14 21:42:52 +01:00
parent 5d3d8cbcdf
commit 28c4c7a59f
4 changed files with 22 additions and 11 deletions

View file

@ -10,7 +10,7 @@ build: uwufetch.c
debug: debug:
clear clear
gcc $(FLAGS_DEBUG) -o $(NAME) $(FILES) gcc $(FLAGS_DEBUG) -o $(NAME) $(FILES)
./uwufetch ./uwufetch -d raspbian
install: install:
cp $(NAME) $(INSTALL_DIR)$(NAME) cp $(NAME) $(INSTALL_DIR)$(NAME)

View file

@ -4,7 +4,7 @@ A meme system info tool for (almost) all your Linux/Unix-based systems, based on
## Currently supported distros ## Currently supported distros
Nyalpine, Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Miwint, Myanjawo, Pop OwOs, UwUntu, and OwOid; Plus Nyandroid; FweeBSD, and OwOpenBSD. Nyalpine, Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Miwint, Myanjawo, Pop OwOs, RaspNyan, UwUntu, and OwOid; Plus Nyandroid; FweeBSD, and OwOpenBSD.
## Building and installation ## Building and installation

1
test
View file

@ -1 +0,0 @@
lspci -mm | awk -F '\"|\" \"|\\(' '/"Display|"3D|"VGA/ {a[$0] = $1 " " $3 " " $4}END {for(i in a) {if(!seen[a[i]]++) print a[i]}}'

View file

@ -38,7 +38,7 @@
struct utsname sys_var; struct utsname sys_var;
struct sysinfo sys; struct sysinfo sys;
int ram_max = 0, ram_free = 0, pkgs, a_i_flag = 0; int ram_max = 0, ram_free = 0, pkgs, a_i_flag = 0;
char user[32], host[256], shell[64], version_name[64], cpu_model[256], pkgman_name[64], image_name[32]; char user[32], host[256], shell[64], version_name[64], cpu_model[256], gpu_model[256] = {0}, pkgman_name[64], image_name[32];
int pkgman(); int pkgman();
void get_info(); void get_info();
void list(); void list();
@ -132,6 +132,7 @@ void print_info() { // print collected info
"\033[18C%s%sOWOS %s%s\n" "\033[18C%s%sOWOS %s%s\n"
"\033[18C%s%sKEWNEL %s%s %s\n" "\033[18C%s%sKEWNEL %s%s %s\n"
"\033[18C%s%sCPUWU %s%s\n" "\033[18C%s%sCPUWU %s%s\n"
"\033[18C%s%sGPUWU %s%s\n"
"\033[18C%s%sWAM %s%i MB/%i MB\n" "\033[18C%s%sWAM %s%i MB/%i MB\n"
"\033[18C%s%sSHELL %s%s\n" "\033[18C%s%sSHELL %s%s\n"
"\033[18C%s%sPKGS %s%s%d %s\n" "\033[18C%s%sPKGS %s%s%d %s\n"
@ -141,6 +142,7 @@ void print_info() { // print collected info
NORMAL, BOLD, NORMAL, version_name, NORMAL, BOLD, NORMAL, version_name,
NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine, NORMAL, BOLD, NORMAL, sys_var.release, sys_var.machine,
NORMAL, BOLD, NORMAL, cpu_model, NORMAL, BOLD, NORMAL, cpu_model,
NORMAL, BOLD, NORMAL, gpu_model,
NORMAL, BOLD, NORMAL, (ram_max - ram_free), ram_max, NORMAL, BOLD, NORMAL, (ram_max - ram_free), ram_max,
NORMAL, BOLD, NORMAL, shell, NORMAL, BOLD, NORMAL, shell,
NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name, NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name,
@ -191,17 +193,18 @@ void get_info() { // get all necessary info
if (ram_max > 0 && ram_free > 0) { if (ram_max > 0 && ram_free > 0) {
ram_max *= 0.001024; ram_max *= 0.001024;
ram_free *= 0.001024; ram_free *= 0.001024;
fclose(meminfo);
break; break;
} }
} }
fclose(meminfo);
// gpu // gpu
FILE *gpu = popen("lspci", "r"); FILE *gpu = popen("lspci -vnn | grep 'VGA\\|DISPLAY\\|3D'", "r");
if (gpu) { if (gpu) {
//fscanf(gpu, "%[^\n]", gpu_model);
fclose(gpu); fclose(gpu);
} }
pkgs = pkgman(); pkgs = pkgman();
} }
@ -213,13 +216,13 @@ void list(char* arg) { // prints distribution list
" %sArch linux %sbased:\n" " %sArch linux %sbased:\n"
" %sarch, artix, %smanjaro, \"manjaro-arm\"\n\n" " %sarch, artix, %smanjaro, \"manjaro-arm\"\n\n"
" %sDebian/%sUbuntu %sbased:\n" " %sDebian/%sUbuntu %sbased:\n"
" %sdebian, %slinuxmint, %spop\n\n" " %sdebian, %slinuxmint, %spop, %sraspbian\n\n"
" %sOther/spare distributions:\n" " %sOther/spare distributions:\n"
" %salpine, %sfedora, %sgentoo, %s\"void\", android, %sunknown\n\n" " %salpine, %sfedora, %sgentoo, %s\"void\", android, %sunknown\n\n"
" %sBSD:\n" " %sBSD:\n"
" freebsd, %sopenbsd\n", " freebsd, %sopenbsd\n",
arg, BLUE, NORMAL, BLUE, GREEN, // Arch based colors arg, BLUE, NORMAL, BLUE, GREEN, // Arch based colors
RED, YELLOW, NORMAL, RED, GREEN, BLUE, // Debian based colors RED, YELLOW, NORMAL, RED, GREEN, BLUE, RED, // Debian based colors
NORMAL, BLUE, BLUE, PINK, GREEN, WHITE, // Other/spare distributions colors NORMAL, BLUE, BLUE, PINK, GREEN, WHITE, // Other/spare distributions colors
RED, YELLOW); // BSD colors RED, YELLOW); // BSD colors
} }
@ -306,6 +309,13 @@ void print_ascii() { // prints logo (as ascii art) of the given system. distribu
" | %s~ %sP! %s~ %s|\n" " | %s~ %sP! %s~ %s|\n"
"_ ---\\ w /\n" "_ ---\\ w /\n"
" \\_/ '-----'\n\n", BLUE, LPINK, WHITE, LPINK, BLUE); " \\_/ '-----'\n\n", BLUE, LPINK, WHITE, LPINK, BLUE);
} else if (strcmp(version_name, "raspbian") == 0) {
printf("\033[0E\033[6C%s__ __\n"
" (_\\)(/_)\n"
" %s(>(__)<)\n"
" (_(_)(_)_)\n"
" (_(__)_)\n"
" (__)\n\n\n", GREEN, RED);
} else if (strcmp(version_name, "ubuntu") == 0) { } else if (strcmp(version_name, "ubuntu") == 0) {
printf( "\033[1E\033[9C%s_\n" printf( "\033[1E\033[9C%s_\n"
" %s\u25E3%s__(_)%s\u25E2%s\n" " %s\u25E3%s__(_)%s\u25E2%s\n"
@ -347,6 +357,7 @@ void print_ascii() { // prints logo (as ascii art) of the given system. distribu
" /-________-\\ \n\n", YELLOW, RED, YELLOW, WHITE, YELLOW, LPINK, WHITE, LPINK, YELLOW); " /-________-\\ \n\n", YELLOW, RED, YELLOW, WHITE, YELLOW, LPINK, WHITE, LPINK, YELLOW);
} }
else printf( "\033[0E\033[2C%s._.--._.\n" else printf( "\033[0E\033[2C%s._.--._.\n"
" \\|>%s_%s< |/\n" " \\|>%s_%s< |/\n"
" |%s:_/%s |\n" " |%s:_/%s |\n"
@ -402,6 +413,7 @@ void uwu_name() { // changes distro name to uwufied(?) name
else STRING_TO_UWU("manjaro", "Myanjawo"); else STRING_TO_UWU("manjaro", "Myanjawo");
else STRING_TO_UWU("\"manjaro-arm\"", "Myanjawo AWM"); else STRING_TO_UWU("\"manjaro-arm\"", "Myanjawo AWM");
else STRING_TO_UWU("pop", "PopOwOS"); else STRING_TO_UWU("pop", "PopOwOS");
else STRING_TO_UWU("raspbian", "RaspNyan");
else STRING_TO_UWU("ubuntu", "Uwuntu"); else STRING_TO_UWU("ubuntu", "Uwuntu");
else STRING_TO_UWU("\"void\"", "OwOid"); else STRING_TO_UWU("\"void\"", "OwOid");
else STRING_TO_UWU("android", "Nyandroid"); // android at the end because it could be not considered as an actual distribution of gnu/linux else STRING_TO_UWU("android", "Nyandroid"); // android at the end because it could be not considered as an actual distribution of gnu/linux