Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide RHN,yum in main output when Ubuntu/Debian is detected #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions xsos
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,34 @@ DMIDECODE() {
_CHECK_DISTRO() {
# Local vars:
local OS_INDENT files file

OS_INDENT=" "

# I don't like blindly sourcing a file -- that provides a vector to screw with this script...
# But in modern Linux boxen this file is standard
# If able to source the new standard /etc/os-release, list it out
if source "$1/etc/os-release" 2>/dev/null; then
distro_release="${c[Imp]}[ID]${c[0]} $ID"
if [[ "$ID" == "rhel" || "$ID" == "fedora" || "$ID" == "centos" ]]; then
packaging=rpm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add packaging to the local vars of OSINFO()?

_CHECK_REDHAT "$1"
elif [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then
packaging=deb
distro_release="$distro_release\n$OS_INDENT${c[Imp]}[Version]${c[0]} $VERSION"
fi

else
_CHECK_REDHAT "$1"
fi
}

_CHECK_REDHAT() {
# Local vars:
local OS_INDENT files file
OS_INDENT=" "

# Parse redhat-release if we have it
if [[ ! -r $1/etc/redhat-release ]]; then
distro_release="${c[Imp]}[redhat-release]${c[0]} ${c[RED]}(missing)${c[0]}"
distro_release="$distro_release${c[Imp]}[redhat-release]${c[0]} ${c[RED]}(missing)${c[0]}"

else
# If release is RHEL 4,5,6,7 in standard expected format ...
Expand Down Expand Up @@ -716,16 +739,8 @@ _CHECK_DISTRO() {
fi
done
fi

# I don't like blindly sourcing a file -- that provides a vector to screw with this script...
# But in modern Linux boxen this file is standard
# If able to source the new standard /etc/os-release, list it out
if source "$1/etc/os-release" 2>/dev/null; then
distro_release="$distro_release\n$OS_INDENT${c[Imp]}[os-release]${c[0]} $PRETTY_NAME $VERSION"
fi
}


_CHECK_KERNELBUILD() {
# Get kernel build version somehow or another, making sure not to use build offered by rescue mode kernel

Expand Down Expand Up @@ -1098,9 +1113,13 @@ OSINFO() {
echo -e "${c[H1]}OS${c[0]}"
echo -e " ${c[H2]}Hostname:${c[0]} $hostname"
echo -e " ${c[H2]}Distro:${c[0]} $distro_release"
echo -e " ${c[H2]}RHN:${c[0]} $rhn_serverURL$rhnProxyStuff"
echo -e " ${c[H2]}RHSM:${c[0]} $rhsm_hostname$rhsmProxyStuff"
echo -e " ${c[H2]}YUM:${c[0]} $yum_plugins"
if [ $ID = "rhel" ]; then
echo -e " ${c[H2]}RHN:${c[0]} $rhn_serverURL$rhnProxyStuff"
echo -e " ${c[H2]}RHSM:${c[0]} $rhsm_hostname$rhsmProxyStuff"
fi
if [ $packaging = yum ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be rpm?

echo -e " ${c[H2]}YUM:${c[0]} $yum_plugins"
fi
[[ -n $runlevel ]] &&
echo -e " ${c[H2]}Runlevel:${c[0]} $runlevel (default $initdefault)"
echo -e " ${c[H2]}SELinux:${c[0]} $(_CHECK_SELINUX "$1")"
Expand Down