more refactoring, cleanup

This commit is contained in:
inxi-svn 2008-10-29 03:49:24 +00:00
parent 27de71c99f
commit 186f1ced0b

21
inxi
View file

@ -270,6 +270,8 @@ sanitize_characters()
# Determine if any of the absolutely necessary tools are absent
check_script_depends()
{
local app_name=''
if [ ! -d /proc/ ]
then
error_handler 6
@ -277,16 +279,16 @@ check_script_depends()
if ((X))
then
for I in xrandr xdpyinfo glxinfo
for app_name in xrandr xdpyinfo glxinfo
do
type -p $I >/dev/null || { script_debugger "inxi: Resuming in non X mode: $I not found in path"; X=0; break; }
type -p $app_name >/dev/null || { script_debugger "inxi: Resuming in non X mode: $app_name not found in path"; X=0; break; }
done
fi
app_name=''
# bc removed from deps for now
for I in df free gawk grep hostname lspci ps readlink runlevel tr uname uptime wc
for app_name in df free gawk grep hostname lspci ps readlink runlevel tr uname uptime wc
do
type -p $I >/dev/null || error_handler 5 "$I"
type -p $app_name >/dev/null || error_handler 5 "$app_name"
done
}
@ -609,8 +611,8 @@ set_calculated_variables()
X=1
fi
# Fallback paths put into $EXTRA_PATH; This might, among others, help on gentoo.
# Now, create a difference of $PATH and $EXTRA_PATH and add that to $PATH:
# Fallback paths put into $extra_paths; This might, among others, help on gentoo.
# Now, create a difference of $PATH and $extra_paths and add that to $PATH:
IFS=":"
for path in $extra_paths
do
@ -679,7 +681,10 @@ get_distro_data()
else
# Debian pure should fall through here
DISTRO_FILE="issue"
DISTRO=$( gawk 'BEGIN { RS="" } { gsub(/\\[a-z]/,""); gsub(/ [ ]+/," "); gsub(/^ +| +$/,""); print }' "/etc/${DISTRO_FILE}" )
DISTRO=$( gawk 'BEGIN { RS="" } { gsub(/\\[a-z]/,"");
gsub(/ [ ]+/," ");
gsub(/^ +| +$/,"");
print }' "/etc/${DISTRO_FILE}" )
fi
((${#DISTRO} > 80 && ! CRAP)) && DISTRO="${RED}/etc/${DISTRO_FILE} corrupted, use --crap to override${NORMAL}"
: ${DISTRO:=Unknown distro o_O}