Correct runlevel check

This commit is contained in:
trash80.v2.0 2008-12-16 23:12:27 +00:00
parent 59c49120de
commit e18f634857

15
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.8.9 #### version: 0.8.10
#### Date: December 14 2008 #### Date: December 14 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -37,11 +37,12 @@
#### DEPENDENCIES #### DEPENDENCIES
#### bash >=2.05b(bash), df;readlink;stty;tr;uname;wc(coreutils), #### bash >=2.05b(bash), df;readlink;stty;tr;uname;wc(coreutils),
#### gawk(gawk), grep(grep), hostname(hostname), lspci(pciutils), #### gawk(gawk), grep(grep), hostname(hostname), lspci(pciutils),
#### ps;uptime(procps), runlevel(sysvinit), glxinfo;xdpyinfo;xrandr(xbase-clients) #### ps;uptime(procps), glxinfo;xdpyinfo;xrandr(xbase-clients)
#### Also the proc filesystem should be present and mounted #### Also the proc filesystem should be present and mounted
#### ####
#### RECOMMENDS (Needed to run certain features) #### RECOMMENDS (Needed to run certain features)
#### For local interfaces/IP test: ifconfig (in net-tools for Debian systems) #### For local interfaces/IP test: ifconfig (in net-tools for Debian systems)
#### runlevel(sysvinit: to view current runlevel while not in X window system
######################################################################## ########################################################################
#### CONVENTIONS: #### CONVENTIONS:
#### Indentation: TABS #### Indentation: TABS
@ -426,7 +427,7 @@ check_script_depends()
{ {
local app_name='' app_data='' local app_name='' app_data=''
# bc removed from deps for now # bc removed from deps for now
local depends="df free gawk grep hostname lspci ps readlink runlevel tr uname uptime wc" local depends="df free gawk grep hostname lspci ps readlink tr uname uptime wc"
if [[ ! -d /proc/ ]];then if [[ ! -d /proc/ ]];then
error_handler 6 error_handler 6
@ -2484,8 +2485,9 @@ print_hard_disk_data()
print_info_data() print_info_data()
{ {
local suggested_app="runlevel"
local info_data='' local info_data=''
local runlvl="$( runlevel | gawk '{ print $2 }' )" local runlvl=''
local memory="$( get_memory_data )" local memory="$( get_memory_data )"
local processes="$(( $( ps aux | wc -l ) - 1 ))" local processes="$(( $( ps aux | wc -l ) - 1 ))"
local up_time="$( get_uptime )" local up_time="$( get_uptime )"
@ -2496,7 +2498,10 @@ print_info_data()
# this only triggers if no X data is present # this only triggers if no X data is present
if [[ $B_X_RUNNING != 'true' ]];then if [[ $B_X_RUNNING != 'true' ]];then
info_data="${info_data} ${C1}Runlevel${C2} ${runlvl}${CN}" if [[ -a $suggested_app ]];then
runlvl="$( runlevel | gawk '{ print $2 }' )"
info_data="${info_data} ${C1}Runlevel${C2} ${runlvl}${CN}"
fi
fi fi
if [[ $SHOW_IRC -gt 0 ]];then if [[ $SHOW_IRC -gt 0 ]];then