diff options
author | 2019-07-02 17:27:16 -0400 | |
---|---|---|
committer | 2019-07-02 17:27:16 -0400 | |
commit | ce0443811182e71e8a792a533d8a1d686afda8d2 (patch) | |
tree | 56613f23158f6079b3ae55b30e4597eaa8eb7456 /inxi | |
parent | 38bfd820d2274c2c11fb2153dfe06bf8db7fd722 (diff) | |
download | inxi-ce0443811182e71e8a792a533d8a1d686afda8d2.tar.bz2 inxi-ce0443811182e71e8a792a533d8a1d686afda8d2.tar.xz inxi-ce0443811182e71e8a792a533d8a1d686afda8d2.tar.zst |
New upstream version 3.0.34-1upstream/3.0.34-1
Diffstat (limited to 'inxi')
-rwxr-xr-x | inxi | 230 |
1 files changed, 157 insertions, 73 deletions
@@ -31,8 +31,8 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.0.32'; -my $self_date='2019-02-07'; +my $self_version='3.0.34'; +my $self_date='2019-04-30'; my $self_patch='00'; ## END INXI INFO ## @@ -549,6 +549,7 @@ sub system_files { 'asound-cards' => '/proc/asound/cards', 'asound-modules' => '/proc/asound/modules', 'asound-version' => '/proc/asound/version', + 'cmdline' => '/proc/cmdline', 'cpuinfo' => '/proc/cpuinfo', 'dmesg-boot' => '/var/run/dmesg.boot', 'lsb-release' => '/etc/lsb-release', @@ -1786,6 +1787,7 @@ sub system_files { copy_files(\@files,'system-distro'); @files = ( '/proc/1/comm', + '/proc/cmdline', '/proc/cpuinfo', '/proc/meminfo', '/proc/modules', @@ -2437,7 +2439,7 @@ sub run { my (@data,@rows); my $line = make_line(); my $pm = get_pm(); - @data = basic_data($line); + @data = basic_data($line,$pm); push @rows,@data; if (!$bsd_type){ @data = check_items('required system directories',$line,$pm); @@ -2467,9 +2469,10 @@ sub run { } sub basic_data { - my ($line) = @_; + my ($line,$pm_local) = @_; my (@data,@rows); my $client = $client{'name-print'}; + $pm_local ||= 'N/A'; $client .= ' ' . $client{'version'} if $client{'version'}; my $default_shell = 'N/A'; if ($ENV{'SHELL'}){ @@ -2491,6 +2494,7 @@ sub basic_data { ['0', '', '', "Current shell: " . $client ], ['0', '', '', "Default shell: " . $default_shell ], ['0', '', '', "sh links to: $sh_real" ], + ['0', '', '', "Package manager: $pm_local" ], ); return @rows; } @@ -2512,7 +2516,8 @@ sub check_items { } else { @data = qw(blockdev dig dmidecode fdisk file hddtemp ifconfig ip ipmitool - ipmi-sensors lsblk lsusb modinfo runlevel sensors strings sudo tree upower uptime); + ipmi-sensors lsblk lsusb modinfo runlevel sensors smartctl strings sudo + tree upower uptime); } $b_program = 1; $item = 'Program'; @@ -2611,7 +2616,10 @@ sub check_items { } else { $result = 'Missing'; - $install = " ~ Install package: $info{$pm}" if (($b_program || $b_module) && $pm); + if (($b_program || $b_module) && $pm){ + $info{$pm} ||= 'N/A'; + $install = " ~ Install package: $info{$pm}"; + } push @missing, "$_$install"; } $row = make_row($_,$about,$result); @@ -2639,7 +2647,7 @@ sub check_items { sub item_data { my ($type) = @_; my %data = ( - # directory data + # Directory Data '/sys/class/dmi/id' => ({ 'info' => '-M system, motherboard, bios', }), @@ -2664,7 +2672,7 @@ sub item_data { '/sys' => ({ 'info' => '', }), - # file data + # File Data '/etc/lsb-release' => ({ 'info' => '-S distro version data (older version)', }), @@ -2701,8 +2709,9 @@ sub item_data { '/var/run/dmesg.boot' => ({ 'info' => '-D,-d disk data', }), - # system tools - # apt-dpkg,apt-get; pm-arch,pacman; rpm-redhat,suse + ## START PACKAGE MANAGER BLOCK ## + # Note: see inxi-perl branch for details: docs/recommends-package-manager.txt + # System Tools 'blockdev' => ({ 'info' => '--admin -p/-P (filesystem blocksize)', 'info-bsd' => '', @@ -2858,8 +2867,8 @@ sub item_data { 'rpm' => 'lm-sensors', }), 'smartctl' => ({ - 'info' => '-Dx show hdd temp', - 'info-bsd' => '-Dx show hdd temp', + 'info' => '-Dxx rotation (alt), type, smart', + 'info-bsd' => '-Dx rotation (alt), type, smart', 'apt' => '', 'pacman' => '', 'rpm' => '', @@ -2920,7 +2929,7 @@ sub item_data { 'pacman' => 'wget', 'rpm' => 'wget', }), - # display tools + # Display Tools 'glxinfo' => ({ 'info' => '-G glx info', 'info-bsd' => '-G glx info', @@ -2956,7 +2965,7 @@ sub item_data { 'pacman' => 'xrandr', 'rpm' => 'x11-server-utils', }), - # Perl modules + # Perl Modules 'Cpanel::JSON::XS' => ({ 'info' => '--output json - required for export.', 'info-bsd' => '--output json - required for export.', @@ -3006,6 +3015,7 @@ sub item_data { 'pacman' => 'perl-xml-dumper', 'rpm' => 'perl-XML-Dumper', }), + ## END PACKAGE MANAGER BLOCK ## ); my $ref = $data{$type}; my %values = %$ref; @@ -3013,6 +3023,7 @@ sub item_data { } sub get_pm { my ($pm) = (''); + # support maintainers of other pm types using custom lists if (main::check_program('dpkg')){ $pm = 'apt'; } @@ -4074,7 +4085,7 @@ sub get_options{ my ($opt,$arg) = @_; # let api processor handle checks if valid, this # future proofs this - if ($arg =~ /^[0-9]$/){ + if ($arg =~ /^[1-9]$/){ $weather_source = $arg; } else { @@ -4446,10 +4457,11 @@ sub show_options { verbose or line output, not short form):" ], ['2', '-C', '', "If available: CPU vulnerabilities (bugs); family, model-id, stepping - format: hex (decimal) if greater than 9, otherwise hex; microcode - format: hex." ], - ['2', '-d', '', "If available: logical and physical block sizes." ], + ['2', '-d,-D', '', "If available: logical and physical block sizes." ], ['2', '-p,-P', '', "If available: raw size of partition, percent available for user, block size of file system (root required); for swap, shows swapiness and vfs cache pressure, and if values are default or not." ], + ['2', '-S', '', "If available: kernel boot parameters." ], ['1', '-A', '--audio', "Audio/sound card(s), driver, sound server." ], ['1', '-b', '--basic', "Basic output, short form. Same as $self_name^-v^2." ], ['1', '-B', '--battery', "System battery info, including charge and condition, plus @@ -4550,14 +4562,15 @@ sub show_options { if ( $b_weather ){ @rows = ( ['1', '-w', '--weather', "Local weather data/time. To check an alternate - location, see -W."], + location, see -W. NO AUTOMATED QUERIES ALLOWED!"], ['1', '-W', '--weather-location', "[location] Supported options for - [location]: postal code[,country]; city, state/country; latitude, longitude. - Only use if you want the weather somewhere other than the machine running - $self_name. Use only ASCII characters, replace spaces in city/state/country - names with '+'. Example:^$self_name^-W^new+york,ny"], - ['1', '', '--weather-source', "[0-9] Change weather data source. 0 uses - a legacy source internally. 1-3 generally active, 4-9 check. See man."], + [location]: postal code[,country/country code]; city, state (USA)/country + (country/two character country code); latitude, longitude. Only use if you + want the weather somewhere other than the machine running $self_name. Use + only ASCII characters, replace spaces in city/state/country names with '+'. + Example:^$self_name^-W^[new+york,ny^london,gb^madrid,es]"], + ['1', '', '--weather-source', "[1-9] Change weather data source. 1-4 generally + active, 5-9 check. See man."], ['1', '', '--weather-unit', "Set weather units to metric (m), imperial (i), metric/imperial (mi), or imperial/metric (im)."], ); @@ -5454,7 +5467,7 @@ sub row_defaults { 'unknown-desktop-version' => "ERR-101", 'unknown-dev' => "ERR-102", 'unknown-shell' => "ERR-100", - 'weather-error' => "Error in weather data: $id", + 'weather-error' => "Error: $id", 'weather-null' => "No $id found. Internet connection working?", 'xdpyinfo-missing' => '<xdpyinfo missing>', ); @@ -6660,8 +6673,8 @@ sub create_output_full { $flag_key = ($b_arm || $bsd_type) ? 'features': 'flags'; my $flag = 'N/A'; if (@flags){ - # failure to read dmesg.boot: dmesg.boot permissions - @flags = grep {/^(dmesg.boot|lm|nx|pae|permissions|pni|svm|vmx|(sss|ss)e([2-9])?([a-z])?(_[0-9])?)$/} @flags; + # failure to read dmesg.boot: dmesg.boot permissions; then short -Cx list flags + @flags = grep {/^(dmesg.boot|permissions|avx[2-9]?|lm|nx|pae|pni|(sss|ss)e([2-9])?([a-z])?(_[0-9])?|svm|vmx)$/} @flags; @flags = map {s/pni/sse3/; $_} @flags; @flags = sort(@flags); $flag = join ' ', @flags if @flags; @@ -8720,6 +8733,7 @@ sub device_vendor { # 0 - match pattern; 1 - replace pattern; 2 - vendor print; 3 - serial pattern # Data URLs: inxi-resources.txt Section: DiskData device_vendor() # $model = 'MEDIAMAX '; + # $model = 'Patriot Memory'; my @vendors = ( ## These go first because they are the most likely and common ## ['(Crucial|^(FC)?CT|-CT|^M4\b)','Crucial','Crucial',''], @@ -8735,7 +8749,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|(00)?AAK|AAV|AZL))','(^WDC|Western\s?Digital)','Western Digital',''], + ['^(WD|WL[0]9]|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',''], @@ -8747,7 +8761,6 @@ sub device_vendor { # note: 2012: wdc bought hgst ['^(HGST|Touro|5450)','^HGST','HGST (Hitachi)',''], # HGST HUA ['^(Hitachi|HD[ST]|DK[0-9]|IC|HT|HU)','^Hitachi','Hitachi',''], - ['^Hoodisk','^Hoodisk','Hoodisk',''], # vb: VB0250EAVER but clashes with vbox; HP_SSD_S700_120G ;GB0500EAFYL GB starter too generic? ['^(HP\b|MB0|G[BJ]0|v[0-9]{3}[ow])','^HP','HP',''], ['^(LSD|Lexar|JumpDrive|JD\s?Firefly)','^Lexar','Lexar',''], # mmc-LEXAR_0xb016546c; JD Firefly; @@ -8764,22 +8777,34 @@ sub device_vendor { # 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 + ['^Addlink','^Addlink','Addlink',''], + ['^Aireye','^Aireye','Aireye',''], + ['^Alfawise','^Alfawise','Alfawise',''], ['^Android','^Android','Android',''], + ['^Apotop','^Apotop','Apotop',''], # must come before AP|Apacer - ['^APPLE','^APPLE','Apple',''], + ['^(APPLE|iPod)','^APPLE','Apple',''], ['^(AP|Apacer)','^Apacer','Apacer',''], + ['^(A-?RAM|ARSSD)','^A-?RAM','A-RAM',''], ['^(ASM|2115)','^ASM','ASMedia',''],#asm1153e + ['^Bell\b','^Bell','Packard Bell',''], ['^BHT','^BHT','BHT',''], + ['^BIOSTAR','^BIOSTAR','Biostar',''], ['^BIWIN','^BIWIN','BIWIN',''], ['^BUFFALO','^BUFFALO','Buffalo',''], + ['^Centerm','^Centerm','Centerm',''], ['^CHN\b','','Zheino',''], + ['^Clover','^Clover','Clover',''], ['^Colorful\b','^Colorful','Colorful',''], ['^CSD','^CSD','CSD',''], ['^(Dane-?Elec|Z Mate)','^Dane-?Elec','DaneElec',''], # Daplink vfs is an ARM software thing + ['^Dell\b','^Dell','Dell',''], ['^DeLOCK','^Delock(\s?products)?','Delock',''], ['^DGM','^DGM\b','DGM',''], ['^DIGITAL\s?FILM','DIGITAL\s?FILM','Digital Film',''], + ['^Dogfish','^Dogfish','Dogfish',''], + ['^DragonDiamond','^DragonDiamond','DragonDiamond',''], ['^DREVO\b','^DREVO','Drevo',''], ['^(Eaget|V8$)','^Eaget','Eaget',''], ['^EDGE','^EDGE','EDGE',''], @@ -8791,6 +8816,7 @@ sub device_vendor { ['^FORESEE','^FORESEE','Foresee',''], ['^GALAX\b','^GALAX','GALAX',''], ['^Galaxy\b','^Galaxy','Galaxy',''], + ['^Geil','^Geil','Geil',''], ['^Generic','^Generic','Generic',''], ['^Gigabyte','^Gigabyte','Gigabyte',''], # SSD ['^Gigastone','^Gigastone','Gigastone',''], @@ -8798,6 +8824,9 @@ sub device_vendor { ['^(GOODRAM|IR SSD)','^GOODRAM','GOODRAM',''], # supertalent also has FM: |FM ['^(G[\.]?SKILL)','^G[\.]?SKILL','G.SKILL',''], + ['^HDC','^HDC\b','HDC',''], + ['^Hectron','^Hectron','Hectron',''], + ['^Hoodisk','^Hoodisk','Hoodisk',''], ['^HUAWEI','^HUAWEI','Huawei',''], ['^(IBM|DT)','^IBM','IBM',''], ['^IEI Tech','^IEI Tech(\.|nology)?( Corp(\.|oration)?)?','IEI Technology',''], @@ -8822,20 +8851,27 @@ sub device_vendor { ['^Lenovo','^Lenovo','Lenovo',''], ['^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 + ['^(LITE[\-\s]?ON|PH[1-9])','^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 + ['^(MAXTOR|Atlas)','^MAXTOR','Maxtor',''], # note M2 M3 is usually maxtor, but can be samsung + ['^Memorex','^Memorex','Memorex',''], # note: C300/400 can be either micron or crucial, but C400 is M4 from crucial ['(^MT|^M5|^Micron|00-MT|C[34]00)','^Micron','Micron',''],# C400-MTFDDAK128MAM + ['^MARSHAL\b','^MARSHAL','Marshal',''], ['^MARVELL','^MARVELL','Marvell',''], ['^MDT\b','^MDT','MDT (rebuilt WD/Seagate)',''], # mdt rebuilds wd/seagate hdd ['^Medion','^Medion','Medion',''], ['^(MEDIAMAX|WL[0-9]{2})','^MEDIAMAX','MediaMax',''], + ['^Morebeck','^Morebeck','Morebeck',''], ['^Motorola','^Motorola','Motorola',''], + ['^MTRON','^MTRON','MTRON',''], ['^Netac','^Netac','Netac',''], ['^OOS[1-9]','','Utania',''], + ['^OWC','^OWC\b','OWC',''], ['^PALIT','PALIT','Palit',''], # ssd + ['^PERC\b','','Dell PowerEdge RAID Card',''], # ssd ['^(PS[8F]|Patriot)','^Patriot([-\s]?Memory)?','Patriot',''], + ['^Pioneer','Pioneer','Pioneer',''], ['^PIX[\s]?JR','^PIX[\s]?JR','Disney',''], ['^(PLEXTOR|PX-)','^PLEXTOR','Plextor',''], ['^(PQI|Intelligent\s?Stick)','^PQI','PQI',''], @@ -8846,17 +8882,23 @@ sub device_vendor { ['^RENICE','^RENICE','Renice',''], ['^(Ricoh|R5)','^Ricoh','Ricoh',''], ['^RIM[\s]','^RIM','RIM',''], + ['^Runcore','^Runcore','Runcore',''], + ['^Sage','^Sage(\s?Micro)?','Sage Micro',''], ['^SigmaTel','^SigmaTel','SigmaTel',''], - ['^(Silicon\s?Power|SPPC|Silicon)','Silicon\s?Power','Silicon Power',''], - ['Smartbuy','\s?Smartbuy','Smartbuy',''], # SSD Smartbuy 60GB + # DIAMOND_040_GB + ['^(SILICON\s?MOTION|SM[0-9])','^SILICON\s?MOTION','Silicon Motion',''], + ['^(Silicon\s?Power|SP[CP]C|Silicon|Diamond|Haspeed)','Silicon\s?Power','Silicon Power',''], + ['Smartbuy','\s?Smartbuy','Smartbuy',''], # SSD Smartbuy 60GB; mSata Smartbuy 3 # HFS128G39TND-N210A; seen nvme with name in middle ['(SK\s?HYNIX|^HFS)','\s?SK\s?HYNIX','SK Hynix',''], ['hynix','hynix','Hynix',''],# nvme middle of string, must be after sk hynix ['^SH','','Smart Modular Tech.',''], + ['^Skill','^Skill','Skill',''], ['^(SMART( Storage Systems)?|TX)','^(SMART( Storage Systems)?)','Smart Storage Systems',''], ['^(S[FR]-|Sony)','^Sony','Sony',''], ['^STE[CK]','^STE[CK]','sTec',''], # wd bought this one ['^STORFLY','^STORFLY','StorFly',''], + ['^SUNEAST','^SUNEAST','SunEast',''], # NOTE: F[MNETU] not reliable, g.skill starts with FM too: # Seagate ST skips STT. ['^(STT)','','Super Talent',''], @@ -8867,6 +8909,8 @@ sub device_vendor { ['^(TDK|TF[1-9][0-9])','^TDK','TDK',''], ['^TEAC','^TEAC','TEAC',''], ['^TEAM','^TEAM( Group)?','Team',''], + ['^Teclast','^Teclast','Teclast',''], + ['^Teleplan','^Teleplan','Teleplan',''], ['^Tigo','^Tigo','Tigo',''], ['^TopSunligt','^TopSunligt','TopSunligt',''], # is this a typo? hard to know ['^TopSunlight','^TopSunlight','TopSunlight',''], @@ -8874,6 +8918,7 @@ sub device_vendor { # Twister Line but if we slice out Twister it would just say Line ['^(TrekStor|DS maxi)','^TrekStor','TrekStor',''], ['^UDinfo','^UDinfo','UDinfo',''], + ['^USBTech','^USBTech','USBTech',''], ['^(UG|Unigen)','^Unigen','Unigen',''], ['^VBOX','','VirtualBox',''], ['^(Verbatim|STORE N GO)','^Verbatim','Verbatim',''], @@ -8881,6 +8926,8 @@ sub device_vendor { ['^VISIONTEK','^VISIONTEK','VisionTek',''], ['^VMware','^VMware','VMware',''], ['^(Vseky|Vaseky)','^Vaseky','Vaseky',''], # ata-Vseky_V880_350G_ + ['^(YUCUN|R880)','^YUCUN','YUCUN',''], + ['^ZTC','^ZTC','ZTC',''], ['^(ASMT|2115)','^ASMT','ASMT (case)',''], ); foreach my $ref (@vendors){ @@ -13329,7 +13376,12 @@ sub get_repos_linux { @apt_working = (); $b_apt_enabled = 1; foreach my $row (@data2){ - next if $row =~ /^\s+/; # deb822 supports line folding which starts with space + # NOTE: the syntax of deb822 must be considered a bug, it's sloppy beyond belief. + # deb822 supports line folding which starts with space + # BUT: you can start a URIs: block of urls with a space, sigh. + next if $row =~ /^\s+/ && $row !~ /^\s+[^#]+:\//; + # strip out line space starters now that it's safe + $row =~ s/^\s+//; #print "$row\n"; if ($row eq '~'){ if (@apt_working && $b_apt_enabled){ @@ -14366,7 +14418,8 @@ sub lm_sensors_data { #my $file = "$ENV{'HOME'}/bin/scripts/inxi/data/sensors/sensors-asus-chassis-1.txt"; #my $file = "$ENV{'HOME'}/bin/scripts/inxi/data/sensors/sensors-devnull-1.txt"; #my $file = "$ENV{'HOME'}/bin/scripts/inxi/data/sensors/sensors-jammin1.txt"; - #@sensors_data = main::reader($file); + # my $file = "$ENV{'HOME'}/bin/scripts/inxi/data/sensors/sensors-maximus-arch-1.txt"; + # @sensors_data = main::reader($file); # print join ("\n", @sensors_data), "\n"; @sensors_data = map {$_ =~ s/\s*:\s*\+?/:/;$_} @sensors_data; foreach (@sensors_data){ @@ -14562,7 +14615,6 @@ sub sysctl_data { } last if /^(hw.cpuspeed|hw.vendor|hw.physmem)/; } - %sensors = data_processor(%sensors) if %sensors; main::log_data('dump','%sensors',\%sensors) if $b_log; # print Data::Dumper::Dumper \%sensors; @@ -14930,12 +14982,14 @@ sub gpu_data { $holder = ''; } if ($b_found){ - if (/^temp.*:([0-9]+).*(C|F)/){ + $gpudata[$j]{'type'} = $holder; + if (/^[^:]*:([0-9]+).*\b(C|F)\s/i){ $gpudata[$j]{'temp'} = $1; - $gpudata[$j]{'type'} = $holder; $gpudata[$j]{'unit'} = $2; + # print "$_\n"; } - if (/^fan.*:([0-9]+).*(RPM)?/){ + # speeds can be in percents or rpms, so need the 'fan' in regex + if (/^.*fan.*:([0-9]+).*(RPM)?/i){ $gpudata[$j]{'fan-speed'} = $1; # NOTE: we test for nvidia %, everything else stays with nothing $gpudata[$j]{'speed-unit'} = ''; @@ -15460,7 +15514,16 @@ sub create_output { if ($weather{'sunset'}){ $rows[0]{main::key($num++,'Sunset')} = $weather{'sunset'}; } + if ($weather{'moonphase'}){ + $value = $weather{'moonphase'} . '%'; + $value .= ($weather{'moonphase-graphic'}) ? ' ' . $weather{'moonphase-graphic'} :''; + $rows[0]{main::key($num++,'Moonphase')} = $value; + } + if ($weather{'forecast'}){ + $rows[0]{main::key($num++,'Forecast')} = $weather{'forecast'}; + } } + if ($weather{'api-source'}){ $rows[0]{main::key($num++,'Source')} = $weather{'api-source'}; } @@ -15631,6 +15694,9 @@ sub get_weather { elsif ( $working[0] eq 'error' ){ $weather{'error'} = $working[1]; } + elsif ( $working[0] eq 'forecast' ){ + $weather{'forecast'} = $working[1]; + } elsif ( $working[0] eq 'heat_index_string' ){ $weather{'heat-index'} = $working[1]; $working[1] =~ /^([0-9\.]+)\sF\s\(([0-9\.]+)\sC\)/; @@ -15653,6 +15719,12 @@ sub get_weather { elsif ( $working[0] eq 'local_epoch' ){ $weather{'local-epoch'} = $working[1]; } + elsif ( $working[0] eq 'moonphase' ){ + $weather{'moonphase'} = $working[1]; + } + elsif ( $working[0] eq 'moonphase_graphic' ){ + $weather{'moonphase-graphic'} = $working[1]; + } elsif ( $working[0] eq 'observation_time_rfc822' ){ $weather{'observation-time-rfc822'} = $working[1]; } @@ -15792,25 +15864,25 @@ sub get_weather { # remote timezone for this local block only local $ENV{'TZ'} = $tz if $tz; $date_time = POSIX::strftime "%c", localtime(); - $date_time = test_local_date($date_time,'',''); + $date_time = test_locale_date($date_time,'',''); $weather{'date-time'} = $date_time; # only wu has rfc822 value, and we want the original observation time then if ($weather{'observation-epoch'} && $tz){ $date_time = POSIX::strftime "%Y-%m-%d %T ($tz %z)", localtime($weather{'observation-epoch'}); - $date_time = test_local_date($date_time,$show{'weather-location'},$weather{'observation-epoch'}); + $date_time = test_locale_date($date_time,$show{'weather-location'},$weather{'observation-epoch'}); $weather{'observation-time-local'} = $date_time; } } else { $date_time = POSIX::strftime "%c", localtime(); - $date_time = test_local_date($date_time,'',''); + $date_time = test_locale_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'}){ $date_time = POSIX::strftime "%c", localtime($weather{'observation-epoch'}); - $date_time = test_local_date($date_time,$show{'weather-location'},$weather{'observation-epoch'}); + $date_time = test_locale_date($date_time,$show{'weather-location'},$weather{'observation-epoch'}); $weather{'observation-time-local'} = $date_time; } return %weather; @@ -15819,14 +15891,9 @@ sub get_weather { sub download_weather { eval $start if $b_log; my ($now,$file_cached,@location) = @_; - my (@weather,@weather_temp,$temp,$ua,$url); - if ($weather_source == 0){ - $url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=$location[0]"; - } - else { - $url = "https://smxi.org/opt/xr2.php?loc=$location[0]&src=$weather_source"; - } - $ua = 'weather' if $url =~ /smxi/; + my (@weather,$temp,$ua,$url); + $url = "https://smxi.org/opt/xr2.php?loc=$location[0]&src=$weather_source"; + $ua = 'weather'; # { # #my $file2 = "$ENV{'HOME'}/bin/scripts/inxi/data/weather/weather-1.xml"; # # my $file2 = "$ENV{'HOME'}/bin/scripts/inxi/data/weather/feed-oslo-1.xml"; @@ -15836,24 +15903,7 @@ sub download_weather { # $temp = <$fh>; # } $temp = main::download_file('stdout',$url,'',$ua); - $temp =~ s/\r|\n\n/\n/g if $weather_source == 0; - @weather_temp = split /\n/, $temp; - if ($weather_source == 0){ - foreach (@weather_temp){ - chomp $_; - $_ =~ s/<\/[^>]+>//; - $_ =~ s/.*icon.*|\r//g; - $_ =~ s/\s\s/ /g; - $_ =~ s/^\s+|\s+$//g; - $_ =~ s/>/^^/; - $_ =~ s/^<|NA$//g; - $_ =~ s/^(current|credit|terms|image|title|link|.*_url).*//; - push @weather, $_ if $_ !~ /^\s*$/; - } - } - else { - @weather = @weather_temp; - } + @weather = split(/\n/, $temp) if $temp; unshift (@weather,("timestamp^^$now")); main::writer($file_cached,\@weather); #print "$file_cached: download/cleaned\n"; @@ -15862,7 +15912,7 @@ sub download_weather { } # resolve wide character issue, if detected, switch to iso # date format, we won't try to be too clever here. -sub test_local_date { +sub test_locale_date { my ($date_time,$location,$epoch) = @_; # $date_time .= 'дек'; #print "1: $date_time\n"; @@ -15973,7 +16023,7 @@ sub complete_location { if ($location && $location =~ /[\+\-0-9]/ && $city){ $location = $country . ', ' . $location if $country && $location !~ m|$country|i; $location = $state . ', ' . $location if $state && $location !~ m|$state|i; - $location = $city . ', ' . $location; + $location = $city . ', ' . $location if $city && $location !~ m|$city|i; } eval $end if $b_log; return $location; @@ -16566,7 +16616,7 @@ sub set_info_data { my (@data,@info,$item); my $pattern = 'alltray|awn|bar|bmpanel|bmpanel2|budgie-panel|cairo-dock|'; $pattern .= 'dde-dock|dmenu|dockbarx|docker|docky|dzen|dzen2|'; - $pattern .= 'fbpanel|fspanel|glx-dock|gnome-panel|hpanel|i3bar|icewmtray|'; + $pattern .= 'fancybar|fbpanel|fspanel|glx-dock|gnome-panel|hpanel|i3bar|icewmtray|'; $pattern .= 'kdocker|kicker|'; $pattern .= 'latte|latte-dock|lemonbar|ltpanel|lxpanel|lxqt-panel|'; $pattern .= 'matchbox-panel|mate-panel|ourico|'; @@ -17384,6 +17434,32 @@ sub get_kernel_bits { return $bits; } +sub get_kernel_parameters { + eval $start if $b_log; + my ($parameters); + if (my $file = system_files('cmdline') ) { + $parameters = get_kernel_parameters_linux($file); + } + elsif ($bsd_type) { + $parameters = get_kernel_parameters_bsd(); + } + eval $end if $b_log; + return $parameters; +} +sub get_kernel_parameters_linux { + eval $start if $b_log; + my ($file) = @_; + my $line = (reader($file))[0]; + eval $end if $b_log; + return $line; +} +sub get_kernel_parameters_bsd { + eval $start if $b_log; + my ($parameters); + eval $end if $b_log; + return $parameters; +} + sub get_memory_data_full { eval $start if $b_log; my ($source) = @_; @@ -18044,8 +18120,10 @@ sub pciconf_data { if ($_ =~ /^~$/) { $vendor = main::cleaner($vendor); $device = main::cleaner($device); + # handle possible regex in device name, like [ConnectX-3] + my $device_temp = main::regex_cleaner($device); if ($vendor && $device){ - if ($vendor !~ /$device/i){ + if (main::regex_cleaner($vendor) !~ /$device_temp/i){ $device = "$vendor $device"; } } @@ -19734,6 +19812,7 @@ sub generate_system_data { $data{$data_name}[$index]{main::key($num++,'Host')} = &get_hostname(); } $data{$data_name}[$index]{main::key($num++,'Kernel')} = &get_kernel_data(); + $data{$data_name}[$index]{main::key($num++,'bits')} = &get_kernel_bits; if ($extra > 0){ my @compiler = get_compiler_version(); # get compiler data @@ -19747,6 +19826,11 @@ sub generate_system_data { $data{$data_name}[$index]{main::key($num++,'v')} = $compiler[1]; } } + if ($b_admin && (my $params = get_kernel_parameters())){ + $index = scalar(@{ $data{$data_name} } ); + $data{$data_name}[$index]{main::key($num++,'parameters')} = $params; + $index = scalar(@{ $data{$data_name} } ); + } # note: tty can have the value of 0 but the two tools # return '' if undefined, so we test for explicit '' if ($b_display){ |