New version, tarball, man page. New option -! 34 - skip SSL certificate check on

wget/fetch/curl. This allows systems with for example out of date certificate stores
to still download without error. Also a legacy system fix where tty size failed to show.
This commit is contained in:
Harald Hope 2017-06-09 11:55:19 -07:00
parent 03bfd88be7
commit 1afeb3fc1e
3 changed files with 67 additions and 28 deletions

75
inxi
View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.3.17
#### Version: 2.3.18
#### Date: 2017-06-09
#### Patch Number: 00
########################################################################
@ -426,6 +426,8 @@ SED_RX='-r' # for gnu sed, will be set to -E for bsd sed for backward compatibil
# default to false, no konversation found, 1 is native konvi (qt3/KDE3) script mode, 2 is /cmd inxi start,
## 3 is Konversation > 1.2 (qt4/KDE4)
KONVI=0
NO_SSL=''
NO_SSL_OPT=''
# NO_CPU_COUNT=0 # Whether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
# This is a variable that controls how many parameters inxi will parse in a /proc/<pid>/cmdline file before stopping.
PARAMETER_LIMIT=30
@ -920,19 +922,22 @@ initialize_data()
if type -p dig &>/dev/null;then
DNSTOOL='dig'
fi
# set downloaders.
if ! type -p wget &>/dev/null;then
# first check for bsd stuff
if type -p fetch &>/dev/null;then
DOWNLOADER='fetch'
NO_SSL=' --no-verify-peer'
elif type -p curl &>/dev/null;then
DOWNLOADER='curl'
NO_SSL=' --insecure'
elif [[ $BSD_VERSION == 'openbsd' && -n $( type -p ftp ) ]];then
DOWNLOADER='ftp'
else
DOWNLOADER='no-downloader'
fi
else
NO_SSL=' --no-check-certificate'
fi
if [[ -n $BSD_TYPE ]];then
@ -1618,16 +1623,16 @@ script_self_updater()
print_screen_output "Updating $SCRIPT_NAME in $SCRIPT_PATH using $2 as download source..."
case $DOWNLOADER in
curl)
file_contents="$( curl -s $1$SCRIPT_NAME )" || downloader_error=$?
file_contents="$( curl $NO_SSL_OPT -s $1$SCRIPT_NAME )" || downloader_error=$?
;;
fetch)
file_contents="$( fetch -q -o - $1$SCRIPT_NAME )" || downloader_error=$?
file_contents="$( fetch $NO_SSL_OPT -q -o - $1$SCRIPT_NAME )" || downloader_error=$?
;;
ftp)
file_contents="$( ftp -o - $1$SCRIPT_NAME 2>/dev/null )" || downloader_error=$?
file_contents="$( ftp $NO_SSL_OPT -o - $1$SCRIPT_NAME 2>/dev/null )" || downloader_error=$?
;;
wget)
file_contents="$( wget -q -O - $1$SCRIPT_NAME )" || downloader_error=$?
file_contents="$( wget $NO_SSL_OPT -q -O - $1$SCRIPT_NAME )" || downloader_error=$?
;;
no-downloader)
downloader_error=1
@ -1660,7 +1665,7 @@ script_self_updater()
fi
fi
if [[ $DOWNLOADER == 'wget' ]];then
wget -q --spider $MAN_FILE_DOWNLOAD || downloader_man_error=$?
wget $NO_SSL_OPT -q --spider $MAN_FILE_DOWNLOAD || downloader_man_error=$?
fi
if [[ $downloader_man_error -eq 0 ]];then
if [[ $DOWNLOADER == 'wget' ]];then
@ -1669,16 +1674,16 @@ script_self_updater()
print_screen_output "Downloading Man page file now."
case $DOWNLOADER in
curl)
curl -s -o $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
curl $NO_SSL_OPT -s -o $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
;;
fetch)
fetch -q -o $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
fetch $NO_SSL_OPT -q -o $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
;;
ftp)
ftp -o $man_file_path $MAN_FILE_DOWNLOAD 2>/dev/null || downloader_man_error=$?
ftp $NO_SSL_OPT -o $man_file_path $MAN_FILE_DOWNLOAD 2>/dev/null || downloader_man_error=$?
;;
wget)
wget -q -O $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
wget $NO_SSL_OPT -q -O $man_file_path $MAN_FILE_DOWNLOAD || downloader_man_error=$?
;;
no-downloader)
downloader_man_error=1
@ -1976,16 +1981,16 @@ debug_data_collector()
# -Nc is creating really weird download anomalies, so using -O instead
case $DOWNLOADER in
curl)
xiin_download="$( curl -s $xiin_url )" || downloader_error=$?
xiin_download="$( curl $NO_SSL_OPT -s $xiin_url )" || downloader_error=$?
;;
fetch)
xiin_download="$( fetch -q -o - $xiin_url )" || downloader_error=$?
xiin_download="$( fetch $NO_SSL_OPT -q -o - $xiin_url )" || downloader_error=$?
;;
ftp)
xiin_download="$( ftp -o - $xiin_url 2>/dev/null )" || downloader_error=$?
xiin_download="$( ftp $NO_SSL_OPT -o - $xiin_url 2>/dev/null )" || downloader_error=$?
;;
wget)
xiin_download="$( wget -q -O - $xiin_url )" || downloader_error=$?
xiin_download="$( wget $NO_SSL_OPT -q -O - $xiin_url )" || downloader_error=$?
;;
no-downloader)
downloader_error=1
@ -3020,6 +3025,9 @@ get_parameters()
33)
B_FORCE_DMIDECODE='true'
;;
34)
NO_SSL_OPT=$NO_SSL
;;
40*)
DISPLAY=${OPTARG/40/}
if [[ $DISPLAY == '' ]];then
@ -3218,6 +3226,7 @@ show_options()
print_lines_basic "1" "-! 31" "Turns off hostname in output. Useful if showing output from servers etc."
print_lines_basic "1" "-! 32" "Turns on hostname in output. Overrides global B_SHOW_HOST='false'"
print_lines_basic "1" "-! 33" "Forces use of dmidecode data instead of /sys where relevant (-M)."
print_lines_basic "1" "-! 34" "Skips SSL certificate checks for all downloader activies (wget/fetch/curl only). Must go before other options."
print_lines_basic "1" "-! 40" "Will try to get display data out of X. Default gets it from display :0. If you use this format: -40:1 it would get it from display 1 instead, or any display you specify as long as there is no space between -40 and the :[display-number]."
if [[ $1 == 'full' ]];then
@ -6543,6 +6552,16 @@ get_graphics_res_data()
screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{
print $2"x"$1
}' )
# really old systems may not support the above method
if [[ -z $screen_resolution ]];then
screen_resolution=$( stty -a | gawk -F ';' '
/^speed/ {
gsub(/[[:space:]]*(rows|columns)[[:space:]]*/,"",$0)
gsub(/[[:space:]]*/,"",$2)
gsub(/[[:space:]]*/,"",$3)
print $3"x"$2
}' )
fi
# note: this works fine for all systems but keeping the above for now since
# the above is probably more accurate for linux systems.
else
@ -8153,7 +8172,7 @@ get_networking_usb_data()
get_networking_wan_ip_data()
{
eval $LOGFS
local ip='' ip_data='' downloader_error=0 ua='' b_ipv4_good=true
local ip='' ip_data='' downloader_error=0 ua='' b_ipv4_good=true no_check_ssl=''
# get ip using wget redirect to stdout. This is a clean, text only IP output url,
# single line only, ending in the ip address. May have to modify this in the future
@ -8173,19 +8192,19 @@ get_networking_wan_ip_data()
if [[ -n $( grep 'smxi.org' <<< $WAN_IP_URL ) ]];then
ua="-A s-tools/inxi-ip"
fi
ip_data="$( curl $ua -y $DL_TIMEOUT -s $WAN_IP_URL )" || downloader_error=$?
ip_data="$( curl $NO_SSL_OPT $ua -y $DL_TIMEOUT -s $WAN_IP_URL )" || downloader_error=$?
;;
fetch)
ip_data="$( fetch -T $DL_TIMEOUT -q -o - $WAN_IP_URL )" || downloader_error=$?
ip_data="$( fetch $NO_SSL_OPT -T $DL_TIMEOUT -q -o - $WAN_IP_URL )" || downloader_error=$?
;;
ftp)
ip_data="$( ftp -o - $WAN_IP_URL 2>/dev/null )" || downloader_error=$?
ip_data="$( ftp $NO_SSL_OPT -o - $WAN_IP_URL 2>/dev/null )" || downloader_error=$?
;;
wget)
if [[ -n $( grep 'smxi.org' <<< $WAN_IP_URL ) ]];then
ua="-U s-tools/inxi-ip"
fi
ip_data="$( wget $ua -T $DL_TIMEOUT -q -O - $WAN_IP_URL )" || downloader_error=$?
ip_data="$( wget $NO_SSL_OPT $ua -T $DL_TIMEOUT -q -O - $WAN_IP_URL )" || downloader_error=$?
;;
no-downloader)
downloader_error=1
@ -11531,16 +11550,16 @@ get_weather_data()
if [[ $b_test_loc != 'true' ]];then
case $DOWNLOADER in
curl)
location_data="$( curl -y $DL_TIMEOUT -s $location_site )" || downloader_error=$?
location_data="$( curl $NO_SSL_OPT -y $DL_TIMEOUT -s $location_site )" || downloader_error=$?
;;
fetch)
location_data="$( fetch -T $DL_TIMEOUT -q -o - $location_site )" || downloader_error=$?
location_data="$( fetch $NO_SSL_OPT -T $DL_TIMEOUT -q -o - $location_site )" || downloader_error=$?
;;
ftp)
location_data="$( ftp -o - $location_site 2>/dev/null )" || downloader_error=$?
location_data="$( ftp $NO_SSL_OPT -o - $location_site 2>/dev/null )" || downloader_error=$?
;;
wget)
location_data="$( wget -t 1 -T $DL_TIMEOUT -q -O - $location_site )" || downloader_error=$?
location_data="$( wget $NO_SSL_OPT -t 1 -T $DL_TIMEOUT -q -O - $location_site )" || downloader_error=$?
;;
no-downloader)
downloader_error=100
@ -11668,16 +11687,16 @@ get_weather_data()
if [[ $b_test_weather != 'true' ]];then
case $DOWNLOADER in
curl)
weather_data="$( curl -y $DL_TIMEOUT -s $weather_feed"$location" )" || downloader_error=$?
weather_data="$( curl $NO_SSL_OPT -y $DL_TIMEOUT -s $weather_feed"$location" )" || downloader_error=$?
;;
fetch)
weather_data="$( fetch -T $DL_TIMEOUT -q -o - $weather_feed"$location" )" || downloader_error=$?
weather_data="$( fetch $NO_SSL_OPT -T $DL_TIMEOUT -q -o - $weather_feed"$location" )" || downloader_error=$?
;;
ftp)
weather_data="$( ftp -o - $weather_feed"$location" 2>/dev/null )" || downloader_error=$?
weather_data="$( ftp $NO_SSL_OPT -o - $weather_feed"$location" 2>/dev/null )" || downloader_error=$?
;;
wget)
weather_data="$( wget -t 1 -T $DL_TIMEOUT -q -O - $weather_feed"$location" )" || downloader_error=$?
weather_data="$( wget $NO_SSL_OPT -t 1 -T $DL_TIMEOUT -q -O - $weather_feed"$location" )" || downloader_error=$?
;;
no-downloader)
downloader_error=100

5
inxi.1
View file

@ -530,6 +530,11 @@ Turns on hostname in System line. Overrides inxi config file value (if set): B_S
.TP
.B \-! 33
Force use of \fBdmidecode\fR. This will override \fB/sys\fR data in some lines, like \fB\-M\fR.
.TP
.B \-! 34
Skip SSL certificate checks for all downloader actions (\fB\-U\fR, \fB\-w\fR, \fB\-W\fR, \fB\-i\fR).
Use if your system does not have current SSL certificate lists, or if you have problems making a connection for
any reason. Only works with \fBwget\fR, \fBcurl\fR, and \fBfetch\fR. This must go before the other options you use.
.TP
.B \-! 40

View file

@ -1,3 +1,18 @@
=====================================================================================
Version: 2.3.18
Patch Version: 00
Script Date: 2017-06-09
-----------------------------------
Changes:
-----------------------------------
New version, tarball, man page. New option -! 34 - skip SSL certificate check on
wget/fetch/curl. This allows systems with for example out of date certificate stores
to still download without error. Also a legacy system fix where tty size failed to show.
-----------------------------------
-- Harald Hope - Fri, 09 Jun 2017 11:52:26 -0700
=====================================================================================
Version: 2.3.17
Patch Version: 00