diff --git a/utils/afetch/Makefile b/utils/afetch/Makefile new file mode 100644 index 00000000000000..8ad7530e208ba1 --- /dev/null +++ b/utils/afetch/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=afetch +PKG_VERSION:=2.2.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=afetch-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/13-CF/afetch/tar.gz/V$(PKG_VERSION)? +PKG_HASH:=e1f4630b2f8aea0edb76676afbfba9b92c819c6df5da68eb5b89da9c330e2fcd + +PKG_MAINTAINER:=Tiago Rocha +PKG_LICENSE:=GPL-3.0-only +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/afetch + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Fast and simple system info written in C + DEPENDS:=+base-files + URL:=https://github.com/13-CF/afetch +endef + +define Package/afetch/description + Fast and simple system info (for UNIX based operating systems) + written in POSIX compliant C99. +endef + +define Package/afetch/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/afetch $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,afetch)) diff --git a/utils/afetch/patches/100-add_openwrt_support_and_reduce_size.patch b/utils/afetch/patches/100-add_openwrt_support_and_reduce_size.patch new file mode 100644 index 00000000000000..c74b34db609aab --- /dev/null +++ b/utils/afetch/patches/100-add_openwrt_support_and_reduce_size.patch @@ -0,0 +1,347 @@ +Index: afetch-2.2.0/src/fetch.c +=================================================================== +--- afetch-2.2.0.orig/src/fetch.c ++++ afetch-2.2.0/src/fetch.c +@@ -155,334 +155,18 @@ void *os() + strcpy(osname, newContents); + free(newContents); + /* end */ +- if (strncmp(osname, "Alpine Linux", 12) == 0) { +- info.col1 = BBLUE "\n"; +- info.col2 = BBLUE " /\\ /\\ "; +- info.col3 = BBLUE " / \\ \\ "; +- info.col4 = BBLUE " / \\ \\ "; +- info.col5 = BBLUE " / \\ \\ "; +- info.col6 = BBLUE "/ \\ \\"; +- info.col7 = BBLUE " \\ "; ++ if (strncmp(osname, "OpenWrt", 7) == 0) { ++ info.col1 = BWHITE " ______ \n" BBLUE; ++ info.col2 = BWHITE " / ____ \\ " BBLUE; ++ info.col3 = BWHITE " / __ \\ " BBLUE; ++ info.col4 = BBLUE " / "BWHITE"/ \\ "BBLUE"\\ " BBLUE; ++ info.col5 = BBLUE " \\ "BWHITE"()"BBLUE" / " BBLUE; ++ info.col6 = BBLUE " \\____/ " BBLUE; ++ info.col7 = BBLUE " OpenWrt " BBLUE; + info.col8 = BBLUE ""; + info.getPkgCount = + "grep 'P:' /lib/apk/db/installed | wc -l"; +- } else if (strncmp(osname, "Arch Linux", 10) == 0) { +- info.col1 = BCYAN ""; +- info.col2 = BCYAN " /\\ "; +- info.col3 = BCYAN " / \\ "; +- info.col4 = BCYAN " /\\ \\ "; +- info.col5 = BCYAN " / \\ "; +- info.col6 = BCYAN " / ,, \\ "; +- info.col7 = BCYAN " / | | -\\ "; +- info.col8 = BCYAN "/_-'' ''-_\\\n"; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "Arch bang Linux", 15) == +- 0) { +- info.col1 = BCYAN " ____\n"; +- info.col2 = BCYAN " /\\ / /"; +- info.col3 = BCYAN " / / / "; +- info.col4 = BCYAN " / / / "; +- info.col5 = BCYAN " / /_/\\ "; +- info.col6 = BCYAN " / __ \\ "; +- info.col7 = BCYAN " / /_/\\ \\ "; +- info.col8 = BCYAN "/_-'' ''-_\\\n"; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "ArcoLinux", 9) == 0) { +- info.col1 = BBLUE ""; +- info.col2 = BBLUE " /\\ "; +- info.col3 = BBLUE " / \\ "; +- info.col4 = BBLUE " / /\\ \\ "; +- info.col5 = BBLUE " / / \\ \\ "; +- info.col6 = BBLUE " / / \\ \\ "; +- info.col7 = BBLUE " / / _____\\ \\ "; +- info.col8 = BBLUE "/_/ `----.\\_\\\n"; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "Artix Linux", 11) == 0) { +- info.col1 = BCYAN ""; +- info.col2 = BCYAN " /\\ "; +- info.col3 = BCYAN " / \\ "; +- info.col4 = BCYAN " /`'.,\\ "; +- info.col5 = BCYAN " / ', "; +- info.col6 = BCYAN " / ,`\\ "; +- info.col7 = BCYAN " / ,.'`. \\ "; +- info.col8 = BCYAN "/.,'` `'.\\\n"; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "Deepin", 6) == 0) { +- info.col1 = BRED "\n"; +- info.col2 = BRED ""; +- info.col3 = BRED ""; +- info.col4 = BRED ""; +- info.col5 = BRED ""; +- info.col6 = BRED ""; +- info.col7 = BRED ""; +- info.col8 = BRED ""; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "Debian GNU/Linux", 16) == +- 0) { +- info.col1 = BRED " _____\n"; +- info.col2 = BRED " / __ \\ "; +- info.col3 = BRED "| / |"; +- info.col4 = BRED "| \\___- "; +- info.col5 = BRED "-_ "; +- info.col6 = BRED " --_ "; +- info.col7 = BRED " "; +- info.col8 = BRED ""; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "elementary OS", 12) == 0) { +- info.col1 = BCYAN ""; +- info.col2 = BCYAN " _______ "; +- info.col3 = BCYAN " / ____ \\ "; +- info.col4 = BCYAN "/ | / /\\"; +- info.col5 = BCYAN "|__\\ / / |"; +- info.col6 = BCYAN "\\ /__/ /"; +- info.col7 = BCYAN " \\_______/ "; +- info.col8 = BCYAN ""; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "EndeavourOS", 11) == 0) { +- info.col1 = BCYAN ""; +- info.col2 = +- BRED " /" BBLUE "\\ " BCYAN; +- info.col3 = BRED " /" BBLUE "/ \\" BCYAN +- "\\ " BCYAN; +- info.col4 = BRED " /" BBLUE "/ \\ " BCYAN +- "\\ " BCYAN; +- info.col5 = BRED " / " BBLUE "/ _) " BCYAN +- ")" BCYAN; +- info.col6 = BRED "/_" BBLUE "/___-- " BCYAN +- "__- " BCYAN; +- info.col7 = BCYAN " /____-- " BCYAN; +- info.col8 = BCYAN ""; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "Fedora", 6) == 0) { +- info.col1 = BWHITE " _____\n" BBLUE; +- info.col2 = BWHITE " / __)" BBLUE "\\ "; +- info.col3 = BWHITE " | / " BBLUE "\\ \\"; +- info.col4 = BWHITE " ___| |" BBLUE "__/ /"; +- info.col5 = +- BBLUE " / " BWHITE "(_ _)" BBLUE "_/ "; +- info.col6 = +- BBLUE "/ / " BWHITE "| | " BBLUE; +- info.col7 = +- BBLUE "\\ \\" BWHITE "__/ | " BBLUE; +- info.col8 = BBLUE " \\" BWHITE "(_____/" BBLUE; +- info.getPkgCount = +- "[[ $(which sqlite3 2>/dev/null) && $? -ne " +- "1 ]] && (sqlite3 " +- "/var/lib/rpm/rpmdb.sqlite \"select * from " +- "Name\"|wc -l) || rpm -qa | wc -l"; +- } else if (strncmp(osname, "Gentoo", 6) == 0) { +- info.col1 = BMAGENTA " _-----_ \n"; +- info.col2 = BMAGENTA " ( \\ "; +- info.col3 = BMAGENTA " \\ 0 \\ "; +- info.col4 = BMAGENTA " \\ )"; +- info.col5 = BMAGENTA " / _/ "; +- info.col6 = BMAGENTA " ( _- "; +- info.col7 = BMAGENTA " \\____- "; +- info.col8 = BWHITE "\n"; +- info.getPkgCount = "qlist -IRv | wc -l"; +- } else if (strncmp(osname, "KDE neon", 8) == 0) { +- info.col1 = BGREEN ""; +- info.col2 = BGREEN " "; +- info.col3 = BGREEN " --- _ "; +- info.col4 = BGREEN " / --- \\ "; +- info.col5 = BGREEN " | | | |"; +- info.col6 = BGREEN " \\ --- _/ "; +- info.col7 = BGREEN " --- "; +- info.col8 = BGREEN ""; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "Linux Mint", 10) == 0) { +- info.col1 = BGREEN " _____________ \n"; +- info.col2 = BGREEN " |_ \\ "; +- info.col3 = BGREEN " | | _____ | "; +- info.col4 = BGREEN " | | | | | | "; +- info.col5 = BGREEN " | | | | | | "; +- info.col6 = BGREEN " | \\_____/ | "; +- info.col7 = BGREEN " \\___________/ "; +- info.col8 = BGREEN "\n"; +- info.getPkgCount = "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "Manjaro", 7) == 0) { +- info.col1 = BGREEN " ________ __ \n"; +- info.col2 = BGREEN "| | | |"; +- info.col3 = BGREEN "| ____| | |"; +- info.col4 = BGREEN "| | __ | |"; +- info.col5 = BGREEN "| | | | | |"; +- info.col6 = BGREEN "| | | | | |"; +- info.col7 = BGREEN "| | | | | |"; +- info.col8 = BGREEN "|__| |__| |__|\n"; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "NixOS", 5) == 0) { +- info.col1 = BMAGENTA " \n"; +- info.col2 = BMAGENTA " \\\\ \\\\ // "; +- info.col3 = BMAGENTA " ==\\\\__\\\\/ // "; +- info.col4 = BMAGENTA " // \\\\// "; +- info.col5 = BMAGENTA "==// //== "; +- info.col6 = BMAGENTA " //\\\\___// "; +- info.col7 = BMAGENTA "// /\\\\ \\\\== "; +- info.col8 = BMAGENTA " // \\\\ \\\\ "; +- info.getPkgCount = +- "nix-store -q --requisites " +- "/run/current-system/sw | wc -l"; +- } else if (strncmp(osname, "openSUSE Leap", 10) == 0 || +- strncmp(osname, "openSUSE Tumbleweed", 19) == +- 0) { +- info.col1 = BGREEN " _______\n"; +- info.col2 = BGREEN "__| __ \\ "; +- info.col3 = BGREEN " / .\\ \\"; +- info.col4 = BGREEN " \\__/ |"; +- info.col5 = BGREEN " _______|"; +- info.col6 = BGREEN " \\_______"; +- info.col7 = BGREEN "__________/"; +- info.col8 = BGREEN ""; +- info.getPkgCount = "rpm -qa | wc -l"; +- } else if (strncmp(osname, "Parabola", 8) == 0) { +- info.col1 = BMAGENTA ""; +- info.col2 = BMAGENTA " __ __ __ _ "; +- info.col3 = BMAGENTA ".`_//_//_/ / `."; +- info.col4 = BMAGENTA " / .`"; +- info.col5 = BMAGENTA " / .` "; +- info.col6 = BMAGENTA " /.` "; +- info.col7 = BMAGENTA " /` "; +- info.col8 = BMAGENTA ""; +- info.getPkgCount = "pacman -Qq | wc -l"; +- } else if (strncmp(osname, "Pop!_OS", 7) == 0) { +- info.col1 = BCYAN "______\n"; +- info.col2 = BCYAN "\\ _ \\ __"; +- info.col3 = BCYAN " \\ \\ \\ \\ / /"; +- info.col4 = BCYAN " \\ \\_\\ \\ / / "; +- info.col5 = BCYAN " \\ ___\\ /_/ "; +- info.col6 = BCYAN " \\ \\ _ "; +- info.col7 = BCYAN " __\\_\\__(_)_ "; +- info.col8 = BCYAN " (___________)"; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "postmarketOS", 13) == 0) { +- info.col1 = BGREEN " /\\ \n"; +- info.col2 = BGREEN " / \\ "; +- info.col3 = BGREEN " / \\ "; +- info.col4 = BGREEN " /\\__ \\ "; +- info.col5 = BGREEN " / /\\ _\\ "; +- info.col6 = BGREEN " / ___\\/ \\ "; +- info.col7 = BGREEN " / \\ \\ "; +- info.col8 = BGREEN "/_____/________\\"; +- info.getPkgCount = +- "grep 'P:' /lib/apk/db/installed | wc -l"; +- } else if (strncmp(osname, "Slackware", 10) == 0) { +- info.col1 = BBLUE " ________\n"; +- info.col2 = BBLUE " / ______| "; +- info.col3 = BBLUE " | |______ "; +- info.col4 = BBLUE " \\______ \\ "; +- info.col5 = BBLUE " ______| | "; +- info.col6 = BBLUE "| |________/ "; +- info.col7 = BBLUE "|____________"; +- info.col8 = BBLUE ""; +- info.getPkgCount = +- "ls /var/log/packages | wc -l"; +- } else if (strncmp(osname, "Solus", 5) == 0) { +- info.col1 = BMAGENTA " __________\n"; +- info.col2 = BMAGENTA " / \\ "; +- info.col3 = BMAGENTA " / /\\ \\ \\ "; +- info.col4 = BMAGENTA " / / \\ \\ \\ "; +- info.col5 = BMAGENTA "| / \\ \\ |"; +- info.col6 = BMAGENTA " \\--------------/ "; +- info.col7 = BMAGENTA " \\------------/ "; +- info.col8 = BMAGENTA " \\----------/"; +- info.getPkgCount = +- "ls /var/lib/eopkg/package/ | wc -l"; +- } else if (strncmp(osname, "Ubuntu", 6) == 0) { +- info.col1 = BRED ""; +- info.col2 = BRED " _ "; +- info.col3 = BRED " ---(_) "; +- info.col4 = BRED " _/ --- \\ "; +- info.col5 = BRED "(_) | | "; +- info.col6 = BRED " \\ --- _/ "; +- info.col7 = BRED " ---(_) "; +- info.col8 = BRED ""; +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- } else if (strncmp(osname, "void", 4) == 0) { +- info.col1 = BGREEN " _____\n"; +- info.col2 = BGREEN " _ \\____ - "; +- info.col3 = BGREEN " / / ____ \\ \\ "; +- info.col4 = BGREEN " / / / \\ \\ \\"; +- info.col5 = BGREEN " | | " BGRAY BITAL "VOID " BGREEN "| |"; +- info.col6 = BGREEN " \\ \\ \\____/ / /"; +- info.col7 = BGREEN " \\ \\____ /_/ "; +- info.col8 = BGREEN " -_____\\\n"; +- info.getPkgCount = "xbps-query -l | wc -l"; +- } else if (strncmp(osname, "Zorin OS", 8) == 0) { +- info.col1 = BBLUE " ______ \n"; +- info.col2 = BBLUE " /______\\ "; +- info.col3 = BBLUE " / / \\ "; +- info.col4 = BBLUE "/ / \\"; +- info.col5 = BBLUE "\\ / /"; +- info.col6 = BBLUE " \\ /___ / "; +- info.col7 = BBLUE " \\______/ "; +- info.col8 = BBLUE ""; +- info.getPkgCount = "dpkg -l | tail -n+6 | wc -l"; + } +- } else if (strncmp(sysInfo.sysname, "Darwin", 6) == 0) { +- info.col1 = "" BYELLOW; +- info.col2 = BGREEN " .:' " BYELLOW; +- info.col3 = BGREEN " __ :'__ " BYELLOW; +- info.col4 = BYELLOW " .'`__`-'__``." BYELLOW; +- info.col5 = BRED " :__________.-'" BYELLOW; +- info.col6 = BRED " :_________: " BYELLOW; +- info.col7 = BMAGENTA " :_________`-;" BYELLOW; +- info.col8 = BBLUE " `.__.-.__.' " BYELLOW; +- if ((strncmp(sysInfo.machine, "iPhone", 6) == 0) || (strncmp(sysInfo.machine, "iPad", 4) == 0) || (strncmp(sysInfo.machine, "iPod", 4) == 0)) { +- info.getPkgCount = +- "dpkg -l | tail -n+6 | wc -l"; +- +- char *iosVer = malloc(1024); +- strcpy(iosVer, "iOS "); +- char *productVer = pipeRead("sw_vers -productVersion"); +- +- strcat(iosVer, productVer); +- free(productVer); +- osname = iosVer; +- free(iosVer); +- } else { +- info.getPkgCount = +- "ls /usr/local/Cellar/* | grep ':' | wc -l | xargs"; +- +- char *macVer = malloc(64); +- strcpy(macVer, "macOS "); +- char *productVer = pipeRead("sw_vers -productVersion"); +- +- strcat(macVer, productVer); +- free(productVer); +- osname = macVer; +- free(macVer); +- } +- } else if (strncmp(sysInfo.sysname, "FreeBSD", 7) == 0) { +- info.col1 = BRED ""; +- info.col2 = BRED "/\\,-'''''-,/\\"; +- info.col3 = BRED "\\_) (_/"; +- info.col4 = BRED "| |"; +- info.col5 = BRED "| |"; +- info.col6 = BRED " ; ; "; +- info.col7 = BRED " '-_____-' "; +- info.col8 = BRED ""; +- info.getPkgCount = "pkg info | wc -l | tr -d ' '"; +- osname = sysInfo.sysname; +- } else if (strncmp(sysInfo.sysname, "OpenBSD", 7) == 0) { +- info.col1 = BYELLOW " _____ \n"; +- info.col2 = BYELLOW " \\- -/ "; +- info.col3 = BYELLOW " \\_/ \\ "; +- info.col4 = BYELLOW " | " BWHITE "O O" BYELLOW " |"; +- info.col5 = BYELLOW " |_ < ) 3 )"; +- info.col6 = BYELLOW " / \\ / "; +- info.col7 = BYELLOW " /-_____-\\ "; +- info.col8 = BYELLOW ""; +- info.getPkgCount = +- "/bin/ls -1 /var/db/pkg/ | wc -l | tr -d ' '"; +- osname = sysInfo.sysname; +- } else if (strncmp(sysInfo.sysname, "NetBSD", 6) == 0) { +- + } + pkgCount = pipeRead(info.getPkgCount); +