13-cf / afetch Goto Github PK
View Code? Open in Web Editor NEWSimple system info written in C
License: GNU General Public License v3.0
Simple system info written in C
License: GNU General Public License v3.0
Hello, I'd like to have support for NixOS.
Here's what /etc/os-release
looks like:
NAME=NixOS
ID=nixos
VERSION="20.09.1758.3090c650411 (Nightingale)"
VERSION_CODENAME=nightingale
VERSION_ID="20.09.1758.3090c650411"
PRETTY_NAME="NixOS 20.09 (Nightingale)"
LOGO="nix-snowflake"
HOME_URL="https://nixos.org/"
DOCUMENTATION_URL="https://nixos.org/learn.html"
SUPPORT_URL="https://nixos.org/community.html"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
I'll package this for nixpkgs too if that's okay.
Hi! I'm working on a Web Assembly Systems Interface (WASI) Operating System for the browser and would like to know if it is possible to add support to afetch
. I chose afetch
because, of all the fetch programs I found, it is the simplest.
There are currently no special files that identify the system (though I will probably add /etc/os-release) but it can be identified through uname.
/ # uname -a
wasi (none) 0.0.0 0.0.0 wasm32
/ # uname -s
wasi
It would be really cool to see nice ASCII art for WebAssembly in afetch!
I would love it if you could add Bedrock Linux to afetch
The problem is with bedrock, its basically a distro which allows you to mix and match components (like an easy LFS) but I have no idea how you could get the info for it. I don't know if I have explained it correctly, if I haven't I would suggest you to read the documentation on their website or run the hijacker on some spare system then run thru the tutorial
Bedrock has its own "package manager" which updates other package managers (thats why its called "pmm" (package manager manager) but I wouldn't use that as a package count in the fetch because I think its better to use the original distro's package manager
ls: /usr/local/Cellar/*: No such file or directory
.:' USER polluks
__ :'__ OS macOS 12.4
.'`__`-'__``. KERNEL 21.5.0
:__________.-' UPTIME 243h 16m
:_________: SHELL zsh
:_________`-; PKGS 0
`.__.-.__.'
because of
$ ls /opt/homebrew/Cellar | wc -l
163
duplicate of #65
Just wanted to check if this project is licensed gplv3 only or does it follow the "or any later version" provision?
Thanks
[root@rpi 21:28 ~]› git clone https://github.com/13-CF/afetch.git && cd afetch && make && make install && afetch
Cloning into 'afetch'...
remote: Enumerating objects: 230, done.
remote: Counting objects: 100% (230/230), done.
remote: Compressing objects: 100% (169/169), done.
remote: Total 387 (delta 135), reused 139 (delta 60), pack-reused 157
Receiving objects: 100% (387/387), 3.51 MiB | 2.15 MiB/s, done.
Resolving deltas: 100% (211/211), done.
cc -O2 -std=c99 -Wall -Wextra src/fetch.c -o afetch
src/fetch.c: In function ‘main’:
src/fetch.c:393:26: warning: comparison is always true due to limited range of data type [-Wtype-limits]
393 | while ( (i=fgetc(pkgs)) != EOF) {
| ^~
src/fetch.c: In function ‘uptimealt’:
src/fetch.c:19:2: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | fgets(uptimebuf, 75, uptimefile);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
install -o root -g root -d /usr/local/bin
install -o root -g root -d /usr/local/share/man/man1
install -o root -g root -m 711 ./afetch /usr/local/bin/afetch
install -o root -g root -m 644 ./src/afetch.1 /usr/local/share/man/man1/afetch.1
_ USER root
---(_) DISTRO Ubuntu
_/ --- \ KERNEL 5.8.0-1010-raspi
(_) | | UPTIME 82h 40m
\ --- _/ SHELL bash
---(_) PKGS 1182
^C
[root@rpi master ✓ 21:31 ~/afetch]› strace afetch
execve("/usr/local/bin/afetch", ["afetch"], 0xffffd6bbbf20 /* 29 vars */) = 0
brk(NULL) = 0xaaaaebe39000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=45634, ...}) = 0
mmap(NULL, 45634, PROT_READ, MAP_PRIVATE, 3, 0) = 0xffff82e32000
close(3) = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\300I\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1474056, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffff82e0b000
mmap(NULL, 1543104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffff82c92000
mprotect(0xffff82df2000, 65536, PROT_NONE) = 0
mmap(0xffff82e02000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x160000) = 0xffff82e02000
mmap(0xffff82e08000, 11200, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffff82e08000
close(3) = 0
mprotect(0xffff82e02000, 12288, PROT_READ) = 0
mprotect(0xaaaaae850000, 4096, PROT_READ) = 0
mprotect(0xffff82e40000, 4096, PROT_READ) = 0
munmap(0xffff82e32000, 45634) = 0
uname({sysname="Linux", nodename="rpi.bielej.org", ...}) = 0
brk(NULL) = 0xaaaaebe39000
brk(0xaaaaebe5a000) = 0xaaaaebe5a000
openat(AT_FDCWD, "/etc/os-release", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=375, ...}) = 0
read(3, "NAME=\"Ubuntu\"\nVERSION=\"20.10 (Gr"..., 4096) = 375
close(3) = 0
openat(AT_FDCWD, "/etc/os-release", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=375, ...}) = 0
read(3, "NAME=\"Ubuntu\"\nVERSION=\"20.10 (Gr"..., 4096) = 375
close(3) = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0
write(1, "\33[1;31m\33[1;31m _ "..., 49 _ USER root
) = 49
write(1, "\33[1;31m ---(_) DISTRO \33["..., 44 ---(_) DISTRO Ubuntu
) = 44
write(1, "\33[1;31m _/ --- \\ KERNEL \33["..., 54 _/ --- \ KERNEL 5.8.0-1010-raspi
) = 54
write(1, "\33[1;31m(_) | | UPTIME \33["..., 45(_) | | UPTIME 82h 40m
) = 45
write(1, "\33[1;31m \\ --- _/ SHELL \33["..., 42 \ --- _/ SHELL bash
) = 42
pipe2([3, 4], O_CLOEXEC) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xffff82e35000
rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
clone(child_stack=0xffff82e3e000, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 997311
munmap(0xffff82e35000, 36864) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
close(4) = 0
fcntl(3, F_SETFD, 0) = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "1182\n", 4096) = 5
write(1, "\33[1;31m ---(_) PKGS \33["..., 42 ---(_) PKGS 1182
) = 42
read(3, "", 4096) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=997311, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
write(1, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 1024) = 1024
write(1, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 1024) = 1024
write(1, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 1024) = 1024
write(1, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 1024) = 1024
This may be a aarch64 only issue, since on a x86_64 Ubuntu it works fine.
_ USER root
---(_) DISTRO Ubuntu
_/ --- \ KERNEL 5.8.0-33-generic
(_) | | UPTIME 126h 27m
\ --- _/ SHELL bash
---(_) PKGS 784
Whenever I attempt to install this, it warns me that there is no ./afetch available for it to stat, and errors out. This was the case on Arch, Artix, Void, and Ubuntu.
The output looks like this:
install -o root -g root -d /usr/local/bin
install -o root -g root -d /usr/local/share/man/man1
install -o root -g root -m 711 ./afetch /usr/local/bin/afetch
install: cannot stat './afetch': No such file or directory
make: *** [Makefile:15: install] Error 1
Not exactly sure what's happening with it.
This is a very minimal prototype of FreeBSD support with compilation by clang. Below is a diff from the latest commit with the changes that have to be made. By applying this patch, you break Linux support as there are multiple things that have been modified. Of course this could later be developed into the main program and be used only if the system is detected as FreeBSD.
I cannot be the judge of if this code is any good. If this code is useless, please just tell me, otherwise, hopefully it helps.
*Edited to fix corrupt line*
diff --git a/Makefile b/Makefile
index 54e8541..b586b82 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
#UNCOMMENT THE LINE BELOW IF ON FREEBSD, AND DELETE THE LINE AFTER
#LDFLAGS=-lsysinfo
-LDFLAGS=
+#LDFLAGS=
SRC = fetch.c
-CC = gcc
+CC = cc
CFLAGS = -O2
diff --git a/fetch.c b/fetch.c
index 7f69eb3..d46d3b8 100644
--- a/fetch.c
+++ b/fetch.c
@@ -1,9 +1,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/sysinfo.h>
#include <sys/utsname.h>
#include "config.h"
+#include <time.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
char * os()
{
char *releasefileContents = malloc(100);
@@ -259,10 +261,10 @@ char * shell() {
int main(){
/* initialise system info */
- struct sysinfo si; //used for uptime
+ struct timespec si; //used for uptime
struct utsname ui; //used for hostname, system name and system release
uname(&ui);
- sysinfo(&si);
+ clock_gettime(CLOCK_UPTIME, &si);
Dist ascii = asciiart();
char *os_string = os();
@@ -271,7 +273,7 @@ int main(){
printf("%s %s %s%s\n",ascii.dcol2,USERTEXT, TEXTCOLOUR, lowercase(getenv("USER")));
printf("%s %s %s%s\n",ascii.dcol3,DISROTEXT, TEXTCOLOUR, lowercase(os_string));
printf("%s %s %s%s\n",ascii.dcol4,KERNELTEXT, TEXTCOLOUR, ui.release);
- printf("%s %s %s%lih %lim\n", ascii.dcol5,UPTIMETEXT, TEXTCOLOUR, si.uptime / 3600, (si.uptime / 60) - (si.uptime / 3600 * 60));
+ printf("%s %s %s%lih %lim\n", ascii.dcol5,UPTIMETEXT, TEXTCOLOUR, si.tv_sec / 3600, (si.tv_sec / 60) - (si.tv_sec / 3600 * 60));
printf("%s %s %s%s\n",ascii.dcol6, SHELLTEXT,TEXTCOLOUR, shell());
printf("%s %s %s",ascii.dcol7, PACKAGETEXT, TEXTCOLOUR);
--
Hi, could you please add package count support for Deepin Linux (Debian Based)
I'd like to add request for you to add ArcoLinux.
Here is my /etc/os-release
file :
NAME=ArcoLinux
ID=arcolinux
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="0;36"
HOME_URL="https://arcolinux.info/"
SUPPORT_URL="https://arcolinuxforum.com/"
BUG_REPORT_URL="https://github.com/arcolinux"
LOGO=arcolinux-hello
Here it is my actual custom art if you want to use it :
#define COL1 BLUE " /\\ \n"
#define COL2 BLUE " / \\ " //info starts on column 2
#define COL3 BLUE " / /\\ \\ "
#define COL4 BLUE " / / \\ \\ "
#define COL5 BLUE " / / \\ \\ "
#define COL6 BLUE " / / _____\\ \\ "
#define COL7 BLUE "/_/ `----.\\_\\" //info ends on column 7
Thank's !
Title says all. My logo art below:
else if (strncmp(dist, "ArchBang Linux", 10)==0) {
info.dcol1=BCYAN" ____\n";
info.dcol2=BCYAN" /\\ / /";
info.dcol3=BCYAN" / / / ";
info.dcol4=BCYAN" / / / ";
info.dcol5=BCYAN" / /_/\\ ";
info.dcol6=BCYAN" / __ \\ ";
info.dcol7=BCYAN" / /_/\\ \\ ";
info.dcol8=BCYAN"/_-'' ''-_\\\n";
info.getpkg = "pacman -Qq | wc -l";
break;
}
Please add support for OS in title.
/etc/os-release
contains
NAME="elementary OS"
VERSION="5.1.7 Hera"
ID=elementary
ID_LIKE=ubuntu
PRETTY_NAME="elementary OS 5.1.7 Hera"
LOGO=distributor-logo
VERSION_ID="5.1.7"
HOME_URL="https://elementary.io/"
SUPPORT_URL="https://elementary.io/support"
BUG_REPORT_URL="https://github.com/elementary/os/issues/new"
PRIVACY_POLICY_URL="https://elementary.io/privacy-policy"
VERSION_CODENAME=hera
UBUNTU_CODENAME=bionic
Thanks in advance!
The icons show up for question marks in boxes for me with my font (fira-code); what font is required to see them?
So, I am a little curious that these distros are not here but something exotic for desktop like NetBSD is here. I mean, LM one of the most wide known distro, and it's not here and its Debian version aka LMDE either. So, could you add both, please?
Hello! When I installed afetch on Solus it's don't show an ascii artwork however Solus is in the supported list.
Hi! I tried to brew install afetch
but it didn't work
Show the number of packages
Hello, I would love to see Parabola supported by this tool. Thanks in advance! pfetch has a small ASCII art for Parabola, it could be a good starting point. Here is the content of my /etc/os-release
:
NAME="Parabola"
PRETTY_NAME="Parabola GNU/Linux-libre"
ID=parabola
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="1;35"
HOME_URL="https://www.parabola.nu/"
DOCUMENTATION_URL="https://wiki.parabola.nu/"
SUPPORT_URL="irc://chat.freenode.net#parabola"
BUG_REPORT_URL="https://labs.parabola.nu/"
LOGO=parabola
Wish you have a nice day!
Right now it looks like this
___
___/ \___ USER POLLUKS
/ '---' \ OS (null)
'--_______--' KERNEL 0
/ \ UPTIME 0h 0m
/ \ SHELL (null)
/ \ PKGS %DCL-W-IVVERB, unrecognized command verb - check validi
ty and spelling
hello! as the title states, colour blocks dont seem to be working for me.
im on pop os, and i double checked my config.h file's contents, and where it's placed, and it all seems to be fine. the config file is located at ~/.config/afetch/config.h, and the contents are as follows:
#define PrintColours true #define ColourCharacter ""
it still dosent seem to be printing out the colour blocks.
im sorry if this has been asked before, and if im overlooking something dumb 😅
The project has no license, I would recommand a GPL3 license but if it was intended to not include a license you should add a public domain license.
afetch hangs when run. If other info is needed please reply.
output of /etc/os-release:
NAME="CelOS 1"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="CelOS 1 [v2.0 Beta]"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Many thanks!
I would like to add a request for you to add Slackware.
The /etc/os-release
file looks like this:
NAME=Slackware
VERSION="14.2"
ID=slackware
VERSION_ID=14.2
PRETTY_NAME="Slackware 14.2"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:14.2"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
I sincerely thank you in advanced.
Unable to locate package afetch
/etc/os-release
:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Hi there, thanks a lot for this tool !
I see you only have a stable
release tag. Is it plan to have a v1
, v2
, etc. ? It would be super helpful for people interested to package this software for various distributions in order to distribute it.
I would personally be interested to add it to Gentoo GURU overlay. :)
Installing from the aur, can't make the package.
==> Retrieving sources...
-> Updating afetch git repo...
Fetching origin
-> Found Makefile.patch
==> Validating source files with md5sums...
afetch ... Skipped
Makefile.patch ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
-> Creating working copy of afetch git repo...
Cloning into 'afetch'...
done.
==> Starting prepare()...
patching file afetch/Makefile
Hunk #1 FAILED at 19.
Hunk #2 FAILED at 22.
2 out of 2 hunks FAILED -- saving rejects to file afetch/Makefile.rej
==> ERROR: A failure occurred in prepare().
Aborting...
error making: afetch-git
There is no info nor support for termux. Could you please add support for termux?
On macOS Ventura, fetch doesn't appear to be in the home-brew library.
TIA
hi bro. thanks for creating this awesome tool, i appreciate it🤗
in this case, i want to ask you something. when i run command 'make' in wsl ubuntu 20.04, i got a warn message. is this okay?
idk whether this problem should be fixed or not, but when i run 'afetch' is perfectly working.
hmm, im sorry for missing my icons😓
I re-cloned the repo agian and this time got this after compiling:
IRM_x86_FREV [fa2_l]-[~/afetch] % ./afetch [INSERT]
/\,-'''''-,/\ USER fa2_l
zsh: segmentation fault (core dumped) ./afetch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.