summaryrefslogtreecommitdiffstats
path: root/inxi
diff options
context:
space:
mode:
Diffstat (limited to 'inxi')
-rwxr-xr-xinxi159
1 files changed, 119 insertions, 40 deletions
diff --git a/inxi b/inxi
index b8ab2fc..99c469a 100755
--- a/inxi
+++ b/inxi
@@ -31,8 +31,8 @@ use POSIX qw(uname strftime ttyname);
## INXI INFO ##
my $self_name='inxi';
-my $self_version='3.0.29';
-my $self_date='2018-12-10';
+my $self_version='3.0.30';
+my $self_date='2018-12-31';
my $self_patch='00';
## END INXI INFO ##
@@ -2134,17 +2134,17 @@ sub upload_file {
}
# random tests for various issues
sub user_debug_test_1 {
- open(my $duped, '>&', STDOUT);
- local *STDOUT = $duped;
- my $item = POSIX::strftime("%c", localtime);
- print "Testing character encoding handling. Perl IO data:\n";
- print(join(', ', PerlIO::get_layers(STDOUT)), "\n");
- print "Without binmode: ", $item,"\n";
- binmode STDOUT,":utf8";
- print "With binmode: ", $item,"\n";
- print "Perl IO data:\n";
- print(join(', ', PerlIO::get_layers(STDOUT)), "\n");
- close($duped);
+# open(my $duped, '>&', STDOUT);
+# local *STDOUT = $duped;
+# my $item = POSIX::strftime("%c", localtime);
+# print "Testing character encoding handling. Perl IO data:\n";
+# print(join(', ', PerlIO::get_layers(STDOUT)), "\n");
+# print "Without binmode: ", $item,"\n";
+# binmode STDOUT,":utf8";
+# print "With binmode: ", $item,"\n";
+# print "Perl IO data:\n";
+# print(join(', ', PerlIO::get_layers(STDOUT)), "\n");
+# close($duped);
}
#### -------------------------------------------------------------------
@@ -4474,8 +4474,8 @@ sub show_options {
/ /boot /home /opt /tmp /usr /usr/home /var /var/log /var/tmp. Use -p to see all
mounted ${partition_string}s." ],
['1', '-r', '--repos', "Distro repository data. Supported repo types: APK,
- APT, EOPKG, PACMAN, PACMAN-G2, PISI, PORTAGE, PORTS (BSDs), SLACKPKG, TCE,
- URPMQ, XBPS, YUM/ZYPP." ],
+ APT, CARDS, EOPKG, PACMAN, PACMAN-G2, PISI, PORTAGE, PORTS (BSDs), SLACKPKG,
+ TCE, URPMQ, XBPS, YUM/ZYPP." ],
['1', '-R', '--raid', "RAID data. Shows RAID devices, states, levels,
and components. md-raid: If device is resyncing, also shows resync progress line." ],
['1', '-s', '--sensors', "Sensors output (if sensors installed/configured):
@@ -4535,8 +4535,9 @@ sub show_options {
PCI Bus ID/USB ID number of card; Version/port(s)/driver version (if available)." ],
['2', '-B', '', "Vendor/model, status (if available); attached devices
(e.g. wireless mouse, keyboard, if present)." ],
- ['2', '-C', '', "CPU $flags, Bogomips on CPU; CPU microarchitecture +
- revision (if found, or unless --admin, then shows as 'stepping')." ],
+ ['2', '-C', '', "CPU $flags (short list, use -f to see full list), Bogomips
+ on CPU; CPU microarchitecture + revision (if found, or unless --admin,
+ then shows as 'stepping')." ],
['2', '-d', '', "Extra optical drive features data; adds rev version to
optical drive." ],
['2', '-D', '', "HDD temp with disk data if you have hddtemp installed,
@@ -4707,9 +4708,10 @@ sub show_options {
['1', '', '--sleep', "[0-x.x] Change CPU sleep time, in seconds, for -C
(default:^$cpu_sleep). Allows system to catch up and show a more accurate CPU
use. Example:^$self_name^-Cxxx^--sleep^0.15" ],
- ['1', '', '--tty', "Forces irc flag to false. Useful for running Ansible or Chef.
- Must use -y [width] option if you want a specific output width. Always put this option
- first in an option list."],
+ ['1', '', '--tty', "Forces irc flag to false. Generally useful if $self_name is running
+ inside of another tool like Chef or MOTD and returns corrupted color codes. Please see
+ man page or file an issue if you need to use this flag. Must use -y [width] option if
+ you want a specific output width. Always put this option first in an option list."],
['1', '', '--usb-sys', "Force USB data to use /sys as data source (Linux only)." ],
['1', '', '--usb-tool', "Force USB data to use lsusb as data source (Linux only)." ],
['1', '', '--wm', "Force wm: to use wmctrl as data source. Default uses ps." ],
@@ -4871,6 +4873,7 @@ sub get_client_name {
$client{'name'} = $client_name;
get_client_version();
# print "c:$client_name p:$pppid\n";
+ #print "$client{'name-print'}\n";
}
else {
if (! check_modern_konvi() ){
@@ -4991,7 +4994,26 @@ sub get_client_version {
perl_python_client();
}
if (!$client{'name-print'}) {
- $client{'name-print'} = 'Unknown Client: ' . $client{'name'};
+ # NOTE: these must be empirically determined, not all events that
+ # show no tty are actually IRC.
+ my $wl_terms = 'alacritty|evilvte|germinal|guake|hyper|kate|kitty|kmscon|';
+ $wl_terms .= 'konsole|putty|rxvt|sakura|shellinabox|^st$|sudo|term|tilda|';
+ $wl_terms .= 'tilix|urvxt|yaft|yakuake';
+ my $wl_clients = 'ansible|chef|run-parts';
+ my $whitelist = "$wl_terms|$wl_clients";
+ # print "$client{'name'}\n";
+ if ($client{'name'} =~ /($whitelist)/i){
+ if ($client{'name'} =~ /($wl_terms)/i){
+ main::get_shell_data($ppid);
+ }
+ else {
+ $client{'name-print'} = $client{'name'};
+ }
+ $b_irc = 0;
+ }
+ else {
+ $client{'name-print'} = 'Unknown Client: ' . $client{'name'};
+ }
}
eval $end if $b_log;
}
@@ -5076,7 +5098,6 @@ sub perl_python_client {
## and all other irc clients are not running. As of 2014-03-25 this isn't used in my cases
sub check_modern_konvi {
eval $start if $b_log;
-
return 0 if ! $client{'qdbus'};
my $b_modern_konvi = 0;
my $konvi_version = '';
@@ -8656,7 +8677,7 @@ sub device_vendor {
my @vendors = (
## These go first because they are the most likely and common ##
['(Crucial|^(FC)?CT|-CT|^M4\b)','Crucial','Crucial',''],
- ['^(INTEL|SSDPAM)','^INTEL','Intel',''],
+ ['^(INTEL|SSD(PAM|SA2))','^INTEL','Intel',''],
['(KINGSTON|DataTraveler|^SMS|^SHS|^SUV|^Ultimate CF)','KINGSTON','Kingston',''], # maybe SHS: SHSS37A SKC SUV
# must come before samsung MU. NOTE: toshiba can have: TOSHIBA_MK6475GSX: mush: MKNSSDCR120GB_
['(^MKN|Mushkin)','Mushkin','Mushkin',''], # MKNS
@@ -8668,7 +8689,7 @@ sub device_vendor {
['^STEC\b','^STEC\b','STEC',''], # ssd drive, must come before seagate ST test
# real, SSEAGATE Backup+; XP1600HE30002 | 024 HN (spinpoint)
['(^ST[^T]|[S]?SEAGATE|^X[AFP]|^5AS|^BUP|Expansion Desk|FreeAgent|GoFlex|Backup(\+|\s?Plus)\s?Hub)','[S]?SEAGATE','Seagate',''],
- ['^(WD|Western Digital|My (Book|Passport)|\d*LPCX|Elements|M000|EARX|EFRX|\d*EAVS|0JD|JPVX|[0-9]+(BEV|AAK|AAV|AZL))','(^WDC|Western\s?Digital)','Western Digital',''],
+ ['^(WD|Western Digital|My (Book|Passport)|\d*LPCX|Elements|M000|EARX|EFRX|\d*EAVS|0JD|JPVX|[0-9]+(BEV|(00)?AAK|AAV|AZL))','(^WDC|Western\s?Digital)','Western Digital',''],
## Then better known ones ##
['^(A-DATA|ADATA|AXN|CH11)','^(A-DATA|ADATA)','A-Data',''],
['^ADTRON','^(ADTRON)','Adtron',''],
@@ -8694,12 +8715,14 @@ sub device_vendor {
# note: seen: KXG50ZNV512G NVMe TOSHIBA 512GB | THNSN51T02DUK NVMe TOSHIBA 1024GB
['(^[S]?TOS|^THN|TOSHIBA|TransMemory)','[S]?TOSHIBA','Toshiba',''], # scsi-STOSHIBA_STOR.E_EDITION_
## These go last because they are short and could lead to false ID, or are unlikely ##
- # unknown: AL25744_12345678; ADP may be usb 2.5" adapter; udisk
+ # unknown: AL25744_12345678; ADP may be usb 2.5" adapter; udisk unknown: Z1E6FTKJ 00AAKS
+ # SSD2SC240G726A10 MRS020A128GTS25C EHSAJM0016GB
+ ['^5ACE','^5ACE','5ACE',''], # could be seagate: ST316021 5ACE
['^Android','^Android','Android',''],
# must come before AP|Apacer
['^APPLE','^APPLE','Apple',''],
['^(AP|Apacer)','^Apacer','Apacer',''],
- ['^(ASMT|2115)','^ASMT','ASMedia',''],
+ ['^(ASM|2115)','^ASM','ASMedia',''],#asm1153e
['^BHT','^BHT','BHT',''],
['^BIWIN','^BIWIN','BIWIN',''],
['^BUFFALO','^BUFFALO','Buffalo',''],
@@ -8729,7 +8752,7 @@ sub device_vendor {
['^HUAWEI','^HUAWEI','Huawei',''],
['^(IBM|DT)','^IBM','IBM',''],
['^IEI Tech','^IEI Tech(\.|nology)?( Corp(\.|oration)?)?','IEI Technology',''],
- ['^(Imation|Nano\s?Pro)','^Imation(\sImation)?','Imation',''], # Imation_ImationFlashDrive; TF20 is imation/tdk
+ ['^(Imation|Nano\s?Pro|HQT)','^Imation(\sImation)?','Imation',''], # Imation_ImationFlashDrive; TF20 is imation/tdk
['^(InnoDisk|Innolite)','^InnoDisk( Corp.)?','InnoDisk',''],
['^Innostor','^Innostor','Innostor',''],
['^Innovation','^Innovation','Innovation',''],
@@ -8744,10 +8767,13 @@ sub device_vendor {
['^KingMAX','^KingMAX','KingMAX',''],
['^KINGSHARE','^KINGSHARE','KingShare',''],
['^KingSpec','^KingSpec','KingSpec',''],
+ # kingwin docking, not actual drive
+ ['^(EZD|EZ-Dock)','','Kingwin Docking Station',''],
['^LDLC','^LDLC','LDLC',''],
['^Lenovo','^Lenovo','Lenovo',''],
- ['^(LITE[\-]?ON[\s\-]?IT)','^LITE[\-]?ON[\s\-]?IT','LITE-ON IT',''], # LITEONIT_LSS-24L6G
- ['^(LITE[\-]?ON|PH6)','^LITE[\-]?ON','LITE-ON',''], # PH6-CE240-L
+ ['^RPFT','','Lenovo O.E.M.',''],
+ ['^(LITE[\-\s]?ON[\s\-]?IT)','^LITE[\-]?ON[\s\-]?IT','LITE-ON IT',''], # LITEONIT_LSS-24L6G
+ ['^(LITE[\-\s]?ON|PH6)','^LITE[\-]?ON','LITE-ON',''], # PH6-CE240-L
['^M-Systems','^M-Systems','M-Systems',''],
['^(MAXTOR)','^MAXTOR','Maxtor',''], # note M3 is usually maxtor, but can be samsung
# note: C300/400 can be either micron or crucial, but C400 is M4 from crucial
@@ -8757,9 +8783,10 @@ sub device_vendor {
['^Medion','^Medion','Medion',''],
['^(MEDIAMAX|WL[0-9]{2})','^MEDIAMAX','MediaMax',''],
['^Motorola','^Motorola','Motorola',''],
+ ['^Netac','^Netac','Netac',''],
['^OOS[1-9]','','Utania',''],
['^PALIT','PALIT','Palit',''], # ssd
- ['^(PS[8F]|Patriot)','^Patriot','Patriot',''],
+ ['^(PS[8F]|Patriot)','^Patriot([-\s]?Memory)?','Patriot',''],
['^PIX[\s]?JR','^PIX[\s]?JR','Disney',''],
['^(PLEXTOR|PX-)','^PLEXTOR','Plextor',''],
['^(PQI|Intelligent\s?Stick)','^PQI','PQI',''],
@@ -8800,6 +8827,7 @@ sub device_vendor {
['^(UG|Unigen)','^Unigen','Unigen',''],
['^VBOX','','VirtualBox',''],
['^(Verbatim|STORE N GO)','^Verbatim','Verbatim',''],
+ ['^(Victorinox|Swissflash)','^Victorinox','Victorinox',''],
['^VISIONTEK','^VISIONTEK','VisionTek',''],
['^VMware','^VMware','VMware',''],
['^(Vseky|Vaseky)','^Vaseky','Vaseky',''], # ata-Vseky_V880_350G_
@@ -9421,11 +9449,14 @@ sub x_drivers {
# $log = "$ENV{HOME}/bin/scripts/inxi/data/xorg-logs/Xorg.0-gm10.log";
my @xorg = main::reader($log);
# list is from sgfxi plus non-free drivers, plus ARM drivers
- my $list = 'amdgpu|apm|ark|armsoc|ati|chips|cirrus|cyrix|fbdev|fbturbo|fglrx|glint|';
- $list .= 'i128|i740|i810|iftv|imstt|intel|ivtv|mach64|mesa|mga|modesetting|';
- $list .= 'neomagic|newport|nouveau|nsc|nvidia|nv|openchrome|radeonhd|radeon|';
- $list .= 'rendition|s3virge|s3|savage|siliconmotion|sisimedia|sisusb|sis|tdfx|';
- $list .= 'tga|trident|tseng|unichrome|v4l|vboxvideo|vesa|vga|via|vmware|voodoo';
+ my $list = join '|',qw(amdgpu apm ark armsoc atimisc ati
+ chips cirrus cyrix fbdev fbturbo fglrx geode glide glint
+ i128 i740 i810-dec100 i810e i810 i815 i830 i845 i855 i865 i915 i945 i965
+ iftv imstt intel ivtv mach64 mesa mga modesetting
+ neomagic newport nouveau nsc nvidia nv openchrome r128 radeonhd radeon
+ rendition s3virge s3 savage siliconmotion sisimedia sisusb sis
+ sunbw2 suncg14 suncg3 suncg6 sunffb sunleo suntcx
+ tdfx tga trident tseng unichrome v4l vboxvideo vesa vga via vmware voodoo);
# it's much cheaper to grab the simple pattern match then do the expensive one
# in the main loop.
#@xorg = grep {/Failed|Unload|Loading/} @xorg;
@@ -11321,7 +11352,7 @@ sub partition_data {
my @row = split /\s+/, $_;
# autofs is a bsd thing, has size 0
if ($row[0] =~ /$filters/ || $row[0] =~ /^ROOT/i ||
- ($b_fs && ($row[2] == 0 || $row[1] eq 'tmpfs' || $row[1] eq 'autofs' ))){
+ ($b_fs && ($row[2] == 0 || $row[1] =~ /^(autofs|iso9660|tmpfs)$/ ) )){
next;
}
($dev_base,$dev_type,$fs,$id,$label,$type,$uuid) = ('','','','','','');
@@ -13194,6 +13225,7 @@ sub get_repos_linux {
my ($key,$path);
my $apk = '/etc/apk/repositories';
my $apt = '/etc/apt/sources.list';
+ my $cards = '/etc/cards.conf';
my $eopkg_dir = '/var/lib/eopkg/';
my $pacman = '/etc/pacman.conf';
my $pacman_g2 = '/etc/pacman-g2.conf';
@@ -13545,6 +13577,30 @@ sub get_repos_linux {
@data = repo_builder($apk,'apk','^\s*[^#]+');
@rows = (@rows,@data);
}
+ # cards/nutyx
+ if (-f $cards){
+ @data3 = main::reader($cards,'clean');
+ push @dbg_files, $cards if $debugger_dir;
+ foreach (@data3){
+ if ($_ =~ /^dir\s+\/[^\|]+\/([^\/\|]+)\s*(\|\s*((http|ftp).*))?/){
+ my $type = ($3) ? $3: 'local';
+ push @content, "$1 ~ $type";
+ }
+ }
+ if (! @content){
+ $key = repo_builder('missing','cards');
+ }
+ else {
+ @content = url_cleaner(@content);
+ $key = repo_builder('active','cards');
+ }
+ @data = (
+ {main::key($num++,$key) => $cards},
+ [@content],
+ );
+ @rows = (@rows,@data);
+ @content = ();
+ }
# TinyCore
if (-e $tce_app || -f $tce_file || -f $tce_file2){
@data = repo_builder($tce_file,'tce','^\s*[^#]+');
@@ -13780,6 +13836,7 @@ sub repo_builder {
'apt' => 'No active apt repos in',
'bsd-package' => 'No enabled BSD pkg servers in',
'bsd-nf' => 'No BSD pkg server files found',
+ 'cards' => 'No active CARDS collections in',
'eopkg' => 'No active eopkg repos found',
'pacman' => 'No active pacman repos in',
'pacman-g2' => 'No active pacman-g2 repos in',
@@ -13808,6 +13865,7 @@ sub repo_builder {
'apk' => 'APK repo',
'apt' => 'Active apt repos in',
'bsd-package' => 'BSD enabled pkg servers in',
+ 'cards' => 'Active CARDS collections in',
'eopkg' => 'Active eopkg repo',
'freebsd' => 'FreeBSD update server',
'freebsd-pkg' => 'FreeBSD default pkg server',
@@ -15603,21 +15661,42 @@ sub get_weather {
# very clever trick, just make the system think it's in the
# remote timezone for this local block only
local $ENV{'TZ'} = $tz;
- $date_time = POSIX::strftime "%c", localtime;
+ $date_time = POSIX::strftime "%c", localtime();
+ $date_time = test_local_date($date_time,'','');
$weather{'date-time'} = $date_time;
}
else {
- $date_time = POSIX::strftime "%c", localtime;
+ $date_time = POSIX::strftime "%c", localtime();
+ $date_time = test_local_date($date_time,'','');
$tz = ( $location[2] ) ? " ($location[2])" : '';
$weather{'date-time'} = $date_time . $tz;
}
# we get the wrong time using epoch for remote -W location
if ( !$show{'weather-location'} && $weather{'observation-epoch'}){
- $weather{'observation-time-local'} = POSIX::strftime "%c", localtime($weather{'observation-epoch'});
+ $date_time = POSIX::strftime "%c", localtime($weather{'observation-epoch'});
+ $date_time = test_local_date($date_time,$show{'weather-location'},$weather{'observation-epoch'});
+ $weather{'observation-time-local'} = $date_time;
}
return %weather;
eval $end if $b_log;
}
+# resolve wide character issue, if detected, switch to iso
+# date format, we won't try to be too clever here.
+sub test_local_date {
+ my ($date_time,$location,$epoch) = @_;
+ # $date_time .= 'дек';
+ #print "1: $date_time\n";
+ if ($date_time =~ m/[^\x00-\x7f]/){
+ if (!$location && $epoch){
+ $date_time = POSIX::strftime "%Y-%m-%d %H:%M:%S", localtime($epoch);
+ }
+ else {
+ $date_time = POSIX::strftime "%Y-%m-%d %H:%M:%S", localtime();
+ }
+ }
+ #print "2: $date_time\n";
+ return $date_time;
+}
sub get_location {
eval $start if $b_log;
my ($city,$country,$freshness,%loc,$loc_arg,$loc_string,@loc_data,$state);
@@ -16631,7 +16710,7 @@ sub get_linux_distro {
}
if ($extra > 0){
my $base_debian_version_distro = 'sidux';
- my $base_debian_version_osr = 'lmde|neptune|parrot|pureos|sparky|tails';
+ my $base_debian_version_osr = '\belive|lmde|neptune|parrot|pureos|sparky|tails';
my $base_default = 'antix-version|mx-version'; # osr has base ids
my $base_issue = 'bunsen'; # base only found in issue
my $base_manual = 'blankon|deepin|kali'; # synthesize, no direct data available