Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/rpm/redhat
File: dist.sh
#!/bin/bash
[0] Fix | Delete
# dist.sh
[1] Fix | Delete
# Author: Tom "spot" Callaway <tcallawa@redhat.com>
[2] Fix | Delete
# License: GPL
[3] Fix | Delete
# This is a script to output the value for the %{dist}
[4] Fix | Delete
# tag. The dist tag takes the following format: .$type$num
[5] Fix | Delete
# Where $type is one of: el, fc, rh
[6] Fix | Delete
# (for RHEL, Fedora Core, and RHL, respectively)
[7] Fix | Delete
# And $num is the version number of the distribution.
[8] Fix | Delete
# NOTE: We can't detect Rawhide or Fedora Test builds properly.
[9] Fix | Delete
# If we successfully detect the version number, we output the
[10] Fix | Delete
# dist tag. Otherwise, we exit with no output.
[11] Fix | Delete
[12] Fix | Delete
RELEASEFILE=/etc/redhat-release
[13] Fix | Delete
[14] Fix | Delete
function check_num {
[15] Fix | Delete
MAINVER=`cut -d "(" -f 1 < $RELEASEFILE | \
[16] Fix | Delete
sed -e "s/[^0-9.]//g" -e "s/$//g" | cut -d "." -f 1`
[17] Fix | Delete
[18] Fix | Delete
echo $MAINVER | grep -q '[0-9]' && echo $MAINVER
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
function check_rhl {
[22] Fix | Delete
grep -q "Red Hat Linux" $RELEASEFILE && ! grep -q "Advanced" $RELEASEFILE && echo $DISTNUM
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
function check_rhel {
[26] Fix | Delete
egrep -q "(Enterprise|Advanced|CloudLinux)" $RELEASEFILE && echo $DISTNUM
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
function check_fedora {
[30] Fix | Delete
grep -q Fedora $RELEASEFILE && echo $DISTNUM
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
DISTNUM=`check_num`
[34] Fix | Delete
DISTFC=`check_fedora`
[35] Fix | Delete
DISTRHL=`check_rhl`
[36] Fix | Delete
DISTRHEL=`check_rhel`
[37] Fix | Delete
if [ -n "$DISTNUM" ]; then
[38] Fix | Delete
if [ -n "$DISTFC" ]; then
[39] Fix | Delete
DISTTYPE=fc
[40] Fix | Delete
elif [ -n "$DISTRHEL" ]; then
[41] Fix | Delete
DISTTYPE=el
[42] Fix | Delete
elif [ -n "$DISTRHL" ]; then
[43] Fix | Delete
DISTTYPE=rhl
[44] Fix | Delete
fi
[45] Fix | Delete
fi
[46] Fix | Delete
[ -n "$DISTTYPE" -a -n "$DISTNUM" ] && DISTTAG=".${DISTTYPE}${DISTNUM}"
[47] Fix | Delete
[48] Fix | Delete
case "$1" in
[49] Fix | Delete
--el) echo -n "$DISTRHEL" ;;
[50] Fix | Delete
--fc) echo -n "$DISTFC" ;;
[51] Fix | Delete
--rhl) echo -n "$DISTRHL" ;;
[52] Fix | Delete
--distnum) echo -n "$DISTNUM" ;;
[53] Fix | Delete
--disttype) echo -n "$DISTTYPE" ;;
[54] Fix | Delete
--help)
[55] Fix | Delete
printf "Usage: $0 [OPTIONS]\n"
[56] Fix | Delete
printf " Default mode is --dist. Possible options:\n"
[57] Fix | Delete
printf " --el\t\tfor RHEL version (if RHEL)\n"
[58] Fix | Delete
printf " --fc\t\tfor Fedora version (if Fedora)\n"
[59] Fix | Delete
printf " --rhl\t\tfor RHL version (if RHL)\n"
[60] Fix | Delete
printf " --dist\t\tfor distribution tag\n"
[61] Fix | Delete
printf " --distnum\tfor distribution number (major)\n"
[62] Fix | Delete
printf " --disttype\tfor distribution type\n" ;;
[63] Fix | Delete
*) echo -n "$DISTTAG" ;;
[64] Fix | Delete
esac
[65] Fix | Delete
[66] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function