mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 08:11:39 +00:00
New version, new tarball. This is a significant change, but inxi should handle it smoothly.
While default configs remain in /etc/inxi.conf, the user overrides now use the following order of tests: 1. XDG_CONFIG_HOME / XDG_DATA_HOME for the config and log/debugger data respectively. 2. Since those will often be blank, it then uses a second priority check: $HOME/.config $HOME/.local/share to place the inxi data directory, which was previously here: $HOME/.inxi 3. If neither of these cases are present, inxi will default to its legacy user data: $HOME/.inxi as before In order to make this switch transparent to users, inxi will move the files from .inxi to the respective .config/ .local/share/inxi directories, and remove the .inxi directory after to cleanup. Also, since I was fixing some path stuff, I also did issue 77, manual inxi install not putting man pages in /usr/local/share/man/man1, which had caused an issue with Arch linux inxi installer. Note that I can't help users who had a manual inxi install with their man page in /usr/share/man/man1 already, because it's too risky to guess about user or system intentions, this man location correction will only apply if users have never installed inxi before manually, and have no distro version installed, unlike the config/data directory, which does update neatly with output letting users know the data was moved. Note that if users have man --path set up incorrectly, it's possible that the legacy man page would show up instead, which isn't good, but there was no perfect fix for the man issue so I just picked the easiest way, ignoring all man pages installed into /usr/share/man/man1 and treating them as final location, otherwise using if present the /usr/local/share/man/man1 location for new manual install users. Also, for users with existing man locations and an inxi manually installed, you have to update to inxi current, then move your man file to /usr/local/share/man/man1, then update man with: mandb command (as root), after that inxi will update to the new man location. Also added some more XDG debugger data as well to cover this for future debugger data. This closes previous issue #77 (man page for manual inxi install does not go into /usr/local/share/man/man1) and issue 101, which I made today just to force the update. Just as a side note, I find this absurd attempt at 'simplifying by making more complex and convoluted' re the XDG and .config and standard nix . file to be sort of tragic, because really, they've just made it all way more complicated, and since all 3 methods can be present, all the stuff has to be tested for anyway, so this doesn't make matters cleaner at all, it's just pointless busywork that makes some people happy since now there's even more rules to follow, sigh.
This commit is contained in:
parent
5711e84587
commit
bcc6af4999
152
inxi
152
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### Version: 2.3.5
|
||||
#### Date: 2016-12-02
|
||||
#### Version: 2.3.6
|
||||
#### Date: 2016-12-19
|
||||
#### Patch Number: 00
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -470,18 +470,18 @@ HDDTEMP_PATH=''
|
|||
MODINFO_PATH=''
|
||||
SUDO_PATH=''
|
||||
|
||||
SCRIPT_DATA_DIR="$HOME/.inxi"
|
||||
ALTERNATE_FTP='' # for data uploads
|
||||
ALTERNATE_WEATHER_LOCATION='' # weather alternate location
|
||||
LOG_FILE="$SCRIPT_DATA_DIR/inxi.log"
|
||||
LOG_FILE_1="$SCRIPT_DATA_DIR/inxi.1.log"
|
||||
LOG_FILE_2="$SCRIPT_DATA_DIR/inxi.2.log"
|
||||
SCRIPT_CONFIG_DIR=''
|
||||
SCRIPT_DATA_DIR=''
|
||||
LOG_FILE='inxi.log'
|
||||
LOG_FILE_1='inxi.1.log'
|
||||
LOG_FILE_2='inxi.2.log'
|
||||
MAN_FILE_DOWNLOAD='https://github.com/smxi/inxi/raw/master/inxi.1.gz'
|
||||
MAN_FILE_LOCATION='/usr/share/man/man1'
|
||||
SCRIPT_NAME='inxi'
|
||||
SCRIPT_PATCH_NUMBER=''
|
||||
SCRIPT_PATH='' #filled-in in Main
|
||||
SCRIPT_VERSION_NUMBER="" #filled-in in Main
|
||||
SCRIPT_PATH='' # filled-in in Main
|
||||
SCRIPT_VERSION_NUMBER='' # filled-in in Main
|
||||
SCRIPT_DOWNLOAD='https://github.com/smxi/inxi/raw/master/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_1='https://github.com/smxi/inxi/raw/one/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_2='https://github.com/smxi/inxi/raw/two/'
|
||||
|
@ -677,6 +677,10 @@ USB_NETWORK_SEARCH="$USB_NETWORK_SEARCH|050d:935b|0bda:8189|0bda:8197"
|
|||
########################################################################
|
||||
main()
|
||||
{
|
||||
# Source user config variables override /etc/inxi.conf variables
|
||||
# this must be set first so log paths are present.
|
||||
set_user_paths
|
||||
|
||||
eval $LOGFS
|
||||
|
||||
local color_scheme='' kde_config_app=''
|
||||
|
@ -691,10 +695,11 @@ main()
|
|||
if [[ -s /etc/$SCRIPT_NAME.conf ]];then
|
||||
source /etc/$SCRIPT_NAME.conf
|
||||
fi
|
||||
# Source user config variables override /etc/inxi.conf variables
|
||||
if [[ -s $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ]];then
|
||||
source $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf
|
||||
|
||||
if [[ -s $SCRIPT_CONFIG_DIR/$SCRIPT_NAME.conf ]];then
|
||||
source $SCRIPT_CONFIG_DIR/$SCRIPT_NAME.conf
|
||||
fi
|
||||
|
||||
set_display_width 'live' # can be reset with -y
|
||||
|
||||
# echo SCHEME $SCHEME
|
||||
|
@ -826,6 +831,49 @@ main()
|
|||
exit 0
|
||||
}
|
||||
|
||||
set_user_paths()
|
||||
{
|
||||
local b_conf='false' b_data='false'
|
||||
|
||||
if [[ -n $XDG_CONFIG_HOME ]];then
|
||||
SCRIPT_CONFIG_DIR=$XDG_CONFIG_HOME
|
||||
b_conf=true
|
||||
elif [[ -d $HOME/.config ]];then
|
||||
SCRIPT_CONFIG_DIR=$HOME/.config
|
||||
b_conf=true
|
||||
else
|
||||
SCRIPT_CONFIG_DIR="$HOME/.$SCRIPT_NAME"
|
||||
fi
|
||||
if [[ -n $XDG_DATA_HOME ]];then
|
||||
SCRIPT_DATA_DIR=$XDG_DATA_HOME/$SCRIPT_NAME
|
||||
b_data=true
|
||||
elif [[ -d $HOME/.local/share ]];then
|
||||
SCRIPT_DATA_DIR=$HOME/.local/share/$SCRIPT_NAME
|
||||
b_data=true
|
||||
else
|
||||
SCRIPT_DATA_DIR="$HOME/.$SCRIPT_NAME"
|
||||
fi
|
||||
# note, this used to be created/checked in specific instance, but we'll just do it
|
||||
# universally so it's done at script start.
|
||||
if [[ ! -d $SCRIPT_DATA_DIR ]];then
|
||||
mkdir $SCRIPT_DATA_DIR
|
||||
fi
|
||||
|
||||
if [[ $b_conf == 'true' && -f $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ]];then
|
||||
mv -f $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf $SCRIPT_CONFIG_DIR
|
||||
echo "Moved $SCRIPT_NAME.conf from $HOME/.$SCRIPT_NAME to $SCRIPT_CONFIG_DIR"
|
||||
fi
|
||||
if [[ $b_data == 'true' && -d $HOME/.$SCRIPT_NAME ]];then
|
||||
mv -f $HOME/.$SCRIPT_NAME/* $SCRIPT_DATA_DIR
|
||||
rm -Rf $HOME/.$SCRIPT_NAME
|
||||
echo "Moved data dir $HOME/.$SCRIPT_NAME to $SCRIPT_DATA_DIR"
|
||||
fi
|
||||
|
||||
LOG_FILE=$SCRIPT_DATA_DIR/$LOG_FILE
|
||||
LOG_FILE_1=$SCRIPT_DATA_DIR/$LOG_FILE_1
|
||||
LOG_FILE_2=$SCRIPT_DATA_DIR/$LOG_FILE_2
|
||||
}
|
||||
|
||||
#### -------------------------------------------------------------------
|
||||
#### basic tests: set script data, booleans, PATH, version numbers
|
||||
#### -------------------------------------------------------------------
|
||||
|
@ -1210,7 +1258,7 @@ select_default_color_scheme()
|
|||
{
|
||||
eval $LOGFS
|
||||
local spacer=' ' options='' user_selection='' config_variable=''
|
||||
local config_file="$HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf"
|
||||
local config_file="$SCRIPT_CONFIG_DIR/$SCRIPT_NAME.conf"
|
||||
local irc_clear="[0m"
|
||||
local irc_gui='Unset' irc_console='Unset' irc_x_term='Unset'
|
||||
local console='Unset' virt_term='Unset' global='Unset'
|
||||
|
@ -1307,9 +1355,6 @@ select_default_color_scheme()
|
|||
set_color_scheme $user_selection
|
||||
# make file/directory first if missing
|
||||
if [[ ! -f $config_file ]];then
|
||||
if [[ ! -d $HOME/.$SCRIPT_NAME ]];then
|
||||
mkdir $HOME/.$SCRIPT_NAME
|
||||
fi
|
||||
touch $config_file
|
||||
fi
|
||||
if [[ -z $( grep -s "$config_variable=" $config_file ) ]];then
|
||||
|
@ -1533,9 +1578,6 @@ log_function_data()
|
|||
# will have max 3 files, inxi.log, inxi.1.log, inxi.2.log
|
||||
create_rotate_logfiles()
|
||||
{
|
||||
if [[ ! -d $SCRIPT_DATA_DIR ]];then
|
||||
mkdir $SCRIPT_DATA_DIR
|
||||
fi
|
||||
# do the rotation if logfile exists
|
||||
if [[ -f $LOG_FILE ]];then
|
||||
# copy if present second to third
|
||||
|
@ -1561,7 +1603,8 @@ script_self_updater()
|
|||
{
|
||||
eval $LOGFS
|
||||
local downloader_error=0 file_contents='' downloader_man_error=0
|
||||
local man_file_path="$MAN_FILE_LOCATION/inxi.1.gz"
|
||||
local man_file_location=$( set_man_location )
|
||||
local man_file_path="$man_file_location/inxi.1.gz"
|
||||
|
||||
if [[ $B_IRC == 'true' ]];then
|
||||
print_screen_output "Sorry, you can't run the $SCRIPT_NAME self updater option (-$3) in an IRC client."
|
||||
|
@ -1603,14 +1646,14 @@ script_self_updater()
|
|||
print_screen_output "To run the new version, just start $SCRIPT_NAME again."
|
||||
print_screen_output "----------------------------------------"
|
||||
print_screen_output "Starting download of man page file now."
|
||||
if [[ ! -d $MAN_FILE_LOCATION ]];then
|
||||
print_screen_output "The required man directory was not detected on your system, unable to continue: $MAN_FILE_LOCATION"
|
||||
if [[ ! -d $man_file_location ]];then
|
||||
print_screen_output "The required man directory was not detected on your system, unable to continue: $man_file_location"
|
||||
else
|
||||
if [[ $B_ROOT == 'true' ]];then
|
||||
print_screen_output "Checking Man page download URL..."
|
||||
if [[ -f /usr/share/man/man8/inxi.8.gz ]];then
|
||||
print_screen_output "Updating man page location to man1."
|
||||
mv -f /usr/share/man/man8/inxi.8.gz /usr/share/man/man1/inxi.1.gz
|
||||
mv -f /usr/share/man/man8/inxi.8.gz $man_file_location/inxi.1.gz
|
||||
if type -p mandb &>/dev/null;then
|
||||
exec $( type -p mandb ) -q
|
||||
fi
|
||||
|
@ -1650,7 +1693,7 @@ script_self_updater()
|
|||
print_screen_output "Man file download URL failed, unable to continue: $MAN_FILE_DOWNLOAD"
|
||||
fi
|
||||
else
|
||||
print_screen_output "Updating / Installing the Man page requires root user, writing to: $MAN_FILE_LOCATION"
|
||||
print_screen_output "Updating / Installing the Man page requires root user, writing to: $man_file_location"
|
||||
print_screen_output "If you want the man page, you'll have to run $SCRIPT_NAME -$3 as root."
|
||||
fi
|
||||
fi
|
||||
|
@ -1671,6 +1714,40 @@ script_self_updater()
|
|||
eval $LOGFS
|
||||
}
|
||||
|
||||
set_man_location()
|
||||
{
|
||||
local location='' default_location='/usr/share/man/man1'
|
||||
local man_paths=$(man --path 2>/dev/null) man_local='/usr/local/share/man'
|
||||
local b_use_local=false
|
||||
|
||||
if [[ -n "$man_paths" && -n $( grep $man_local <<< "$man_paths" ) ]];then
|
||||
b_use_local=true
|
||||
fi
|
||||
|
||||
# for distro installs, existing inxi man manual installs, do nothing
|
||||
if [[ -f $default_location/inxi.1.gz ]];then
|
||||
location=$default_location
|
||||
else
|
||||
if [[ $b_use_local == 'true' ]];then
|
||||
if [[ ! -d $man_local/man1 ]];then
|
||||
mkdir $man_local/man1
|
||||
fi
|
||||
location="$man_local/man1"
|
||||
fi
|
||||
# print_screen_output "Updating man page location to man1."
|
||||
# mv -f /usr/share/man/man1/inxi.1.gz /usr/local/share/man/man1/inxi.1.gz
|
||||
# if type -p mandb &>/dev/null;then
|
||||
# exec $( type -p mandb ) -q
|
||||
# fi
|
||||
fi
|
||||
|
||||
if [[ -z "$location" ]];then
|
||||
location=$default_location
|
||||
fi
|
||||
|
||||
echo $location
|
||||
}
|
||||
|
||||
# args: $1 - debug data type: sys|xorg|disk
|
||||
debug_data_collector()
|
||||
{
|
||||
|
@ -1706,11 +1783,6 @@ debug_data_collector()
|
|||
ftp_upload=$ALTERNATE_FTP
|
||||
fi
|
||||
echo "Starting debugging data collection type: $1"
|
||||
echo -n "Checking/creating required directories... "
|
||||
if [[ ! -d $SCRIPT_DATA_DIR ]];then
|
||||
mkdir $SCRIPT_DATA_DIR
|
||||
fi
|
||||
echo 'completed'
|
||||
cd $SCRIPT_DATA_DIR
|
||||
if [[ -d $SCRIPT_DATA_DIR/$debug_data_dir ]];then
|
||||
echo 'Deleting previous xiin data directory...'
|
||||
|
@ -1887,6 +1959,10 @@ debug_data_collector()
|
|||
# bsd data
|
||||
cat /var/run/dmesg.boot &> $debug_data_dir/bsd-var-run-dmesg.boot.txt
|
||||
echo $COLS_INNER &> $debug_data_dir/cols-inner.txt
|
||||
echo $XDG_CONFIG_HOME &> $debug_data_dir/xdg_config_home.txt
|
||||
echo $XDG_CONFIG_DIRS &> $debug_data_dir/xdg_config_dirs.txt
|
||||
echo $XDG_DATA_HOME &> $debug_data_dir/xdg_data_home.txt
|
||||
echo $XDG_DATA_DIRS &> $debug_data_dir/xdg_data_dirs.txt
|
||||
|
||||
check_recommends_user_output &> $debug_data_dir/check-recommends-user-output.txt
|
||||
# first download and verify xiin
|
||||
|
@ -7138,6 +7214,24 @@ get_init_data()
|
|||
eval $LOGFE
|
||||
}
|
||||
|
||||
# note: useless because this is just absurdly inaccurate, too bad...
|
||||
get_install_date()
|
||||
{
|
||||
eval $LOGFS
|
||||
|
||||
local installed=''
|
||||
|
||||
if ls -al --time-style '+FORMAT %Y-%m-%d' /usr 2>/dev/null;then
|
||||
installed=$(ls -al --time-style '+FORMAT %Y-%m-%d' / | awk '/lost\+found/ {print $7;exit}' )
|
||||
# elif
|
||||
# :
|
||||
fi
|
||||
|
||||
echo $installed
|
||||
|
||||
eval $LOGFE
|
||||
}
|
||||
|
||||
get_kernel_compiler_version()
|
||||
{
|
||||
# note that we use gawk to get the last part because beta, alpha, git versions can be non-numeric
|
||||
|
|
16
inxi.1
16
inxi.1
|
@ -1,4 +1,4 @@
|
|||
.TH INXI 1 "2016\-11\-03" inxi "inxi manual"
|
||||
.TH INXI 1 "2016\-12\-19" inxi "inxi manual"
|
||||
.SH NAME
|
||||
inxi \- Command line system information script for console and IRC
|
||||
.SH SYNOPSIS
|
||||
|
@ -611,13 +611,15 @@ you would enter a command like this:
|
|||
If you leave off the \fB\-o\fR, only you will see the output on your local weechat. WeeChat
|
||||
users may also like to check out the weeget.py
|
||||
.SH INITIALIZATION FILE
|
||||
.TP
|
||||
inxi will read the following configuration/initialization files in the following order:
|
||||
.TP
|
||||
.B /etc/inxi.conf
|
||||
.TP
|
||||
.B $HOME/.inxi/inxi.conf
|
||||
.TP
|
||||
|
||||
\fB/etc/inxi.conf\fR is the default configurations. These can be overridden by user configurations
|
||||
found in one of the following locations (inxi will place its config file using the following precedence
|
||||
as well, that is, if \fB$XDG_CONFIG_HOME\fR is not empty, it will go there, else if \fB$HOME/.conf/inxi.conf\fR
|
||||
exists, it will go there, and as a last default, the legacy location is used:
|
||||
|
||||
\fB$XDG_CONFIG_HOME/inxi.conf\fR or \fB$HOME/.conf/inxi.conf\fR or \fB$HOME/.inxi/inxi.conf\fR
|
||||
|
||||
See wiki pages for more information on how to set these up:
|
||||
.TP
|
||||
.I http://smxi.org/docs/inxi-configuration.htm
|
||||
|
|
|
@ -1,3 +1,54 @@
|
|||
=====================================================================================
|
||||
Version: 2.3.6
|
||||
Patch Version: 00
|
||||
Script Date: 2016-12-19
|
||||
-----------------------------------
|
||||
Changes:
|
||||
-----------------------------------
|
||||
New version, new tarball. This is a significant change, but inxi should handle it smoothly.
|
||||
|
||||
While default configs remain in /etc/inxi.conf, the user overrides now use the following order of tests:
|
||||
|
||||
1. XDG_CONFIG_HOME / XDG_DATA_HOME for the config and log/debugger data respectively.
|
||||
|
||||
2. Since those will often be blank, it then uses a second priority check:
|
||||
$HOME/.config $HOME/.local/share to place the inxi data directory, which was previously here:
|
||||
$HOME/.inxi
|
||||
|
||||
3. If neither of these cases are present, inxi will default to its legacy user data: $HOME/.inxi as before
|
||||
|
||||
In order to make this switch transparent to users, inxi will move the files from .inxi to the respective
|
||||
.config/ .local/share/inxi directories, and remove the .inxi directory after to cleanup.
|
||||
|
||||
Also, since I was fixing some path stuff, I also did issue 77, manual inxi install not putting man pages in
|
||||
/usr/local/share/man/man1, which had caused an issue with Arch linux inxi installer. Note that I can't help
|
||||
users who had a manual inxi install with their man page in /usr/share/man/man1 already, because it's too risky
|
||||
to guess about user or system intentions, this man location correction will only apply if users have never
|
||||
installed inxi before manually, and have no distro version installed, unlike the config/data directory,
|
||||
which does update neatly with output letting users know the data was moved.
|
||||
|
||||
Note that if users have man --path set up incorrectly, it's possible that the legacy man page would show up
|
||||
instead, which isn't good, but there was no perfect fix for the man issue so I just picked the easiest way,
|
||||
ignoring all man pages installed into /usr/share/man/man1 and treating them as final location, otherwise
|
||||
using if present the /usr/local/share/man/man1 location for new manual install users.
|
||||
|
||||
Also, for users with existing man locations and an inxi manually installed, you have to update to inxi current,
|
||||
then move your man file to /usr/local/share/man/man1, then update man with: mandb command (as root), after that
|
||||
inxi will update to the new man location.
|
||||
|
||||
Also added some more XDG debugger data as well to cover this for future debugger data.
|
||||
|
||||
This closes previous issue #77 (man page for manual inxi install does not go into /usr/local/share/man/man1) and
|
||||
issue 101, which I made today just to force the update.
|
||||
|
||||
Just as a side note, I find this absurd attempt at 'simplifying by making more complex and convoluted' re the XDG
|
||||
and .config and standard nix . file to be sort of tragic, because really, they've just made it all way more complicated,
|
||||
and since all 3 methods can be present, all the stuff has to be tested for anyway, so this doesn't make matters cleaner
|
||||
at all, it's just pointless busywork that makes some people happy since now there's even more rules to follow, sigh.
|
||||
|
||||
-----------------------------------
|
||||
-- Harald Hope - Mon, 19 Dec 2016 18:38:57 -0800
|
||||
|
||||
=====================================================================================
|
||||
Version: 2.3.5
|
||||
Patch Version: 00
|
||||
|
|
Loading…
Reference in a new issue