Un1q32 / pfetch

🐧 A pretty system information tool written in POSIX sh.
MIT License
30 stars 9 forks source link

NetBSD missing pkg_info #20

Closed polluks closed 5 months ago

polluks commented 5 months ago
\\`-______,----__     polluks@sdf
 \\        __,---`_   os     NetBSD 10.0
  \\       `.____     host   Supermicro X7DBT
   \\-______,----`-   uptime 7d 14h 18m
pkg_info: not found
./pfetch: arith: syntax error: "total_pkgs + count"

By the way


$ ls /usr/pkg/db/pkg | wc -l
    1127
Un1q32 commented 5 months ago

Seems to work fine for me on this mostly fresh install. Is pkg_info not installed on your system or in your PATH? My understanding is that it's installed by default on every NetBSD system, the original pfetch didn't have a check for it either, though it wouldn't have caused as much of an issue since they handled package counting differently. I can add a check for pkg_info existing and that might fix the issue. Also /usr/pkg/db/pkg doesn't seem to exist on my install, there is /usr/pkg/pkgdb that seems like it might be the same thing, but pkg_info seems fast enough that I don't think it would be worth it to have checks for certain common directories to use instead of just running pkg_info.

2024-06-10-143606_hyprshot

Un1q32 commented 5 months ago

Try the latest commit and see if that fixes it.

polluks commented 5 months ago

What about non-root users? Thank you so far.


$ bash pfetch -d
\\`-______,----__     polluks@sdf
 \\        __,---`_   os     NetBSD 10.0
  \\       `.____     host   Supermicro X7DBT
   \\-______,----`-   uptime 8d 1h 4m
    \\                memory 13379M / 16382M
     \\
      \\

$ sh pfetch -d 
\\`-______,----__     polluks@sdf
 \\        __,---`_   os     NetBSD 10.0
  \\       `.____     host   Supermicro X7DBT
   \\-______,----`-   uptime 8d 1h 4m
pfetch: arith: syntax error: "total_pkgs + count"
Un1q32 commented 5 months ago

seems /usr/sbin is in PATH on my install even for non-root. pfetch still works fine.

Un1q32 commented 5 months ago

damn you github

Un1q32 commented 5 months ago

try latest commit

polluks commented 5 months ago

hmm, the same syntax error

$ echo $PATH
/bin:/usr/bin:/usr/pkg/bin:/usr/local/bin:/usr/pkg/games:/usr/pkg/X11R7/bin

I have only pkg-config

Un1q32 commented 5 months ago

whats the output of which pkg_info (as root) Does adding /sbin, /usr/sbin, and the like to your PATH fix the issue?

Un1q32 commented 5 months ago

Oh wait I think I might have found the problem, try latest commit now

polluks commented 5 months ago

almost right


$ ./pfetch -d
\\`-______,----__     polluks@sdf
 \\        __,---`_   os     NetBSD 10.0
  \\       `.____     host   Supermicro X7DBT
   \\-______,----`-   uptime 8d 3h 5m
    \\                pkgs   **1**
     \\               memory 13800M / 16382M
      \\
Un1q32 commented 5 months ago

what is the output of pkg_info and which pkg_info?

polluks commented 5 months ago

$ ls -l /usr/sbin/pkg_info
-r-xr-xr-x  1 root  wheel  108064 Aug  4  2022 /usr/sbin/pkg_info
$ /usr/sbin/pkg_info
$ pkg_info
zsh: command not found: pkg_info
Un1q32 commented 5 months ago

What is the output of PF_SOURCE= PF_PACKAGE_MANAGERS=on pfetch -d

polluks commented 5 months ago

\\`-______,----__     polluks@sdf
 \\        __,---`_   os     NetBSD 10.0
  \\       `.____     host   Supermicro X7DBT
   \\-______,----`-   uptime 8d 14h 27m
    \\                pkgs   1 (cargo)
     \\               memory 14190M / 16382M
      \\
Un1q32 commented 5 months ago

looks like the 1 extra package is coming from cargo, not pkgsrc, you can disable cargo packages being counted with the PF_DISABLED_PACKAGE_MANAGERS environment variable