PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`#!/bin/bash # Enable / Disable / Status the codeready-builder(CRB) or equivalent repo. ############### # Show help ############### usage() { echo "Usage `basename $0` [ enable | disable | status ] " >&2 echo >&2 echo "Enable, Disable, or give the status of the CodeReady Builder (CRB) repo" >&2 echo >&2 echo "Options:" >&2 echo " enable" >&2 echo " Enable the CRB repo" >&2 echo " disable" >&2 echo " Disable the CRB repo" >&2 echo " status" >&2 echo " Show if the CRB repo is enabled or disabled" >&2 echo " help" >&2 echo " Show this options menu" >&2 echo >&2 echo "Environment Variable:" >&2 echo " FORCE_DNF=1 Set this before the command to force the use of" >&2 echo " 'dnf config-manager' even on RHEL systems." >&2 echo " Example: FORCE_DNF=1 $(basename "$0") enable" >&2 echo >&2 popd &>/dev/null exit 1 } # Show the status show_status()( # Determine if a version of CRB is enabled crb_repo=$(dnf repolist | grep -i -e crb -e powertools -e codeready | grep -v -i -e debug -e source -e eus -e virt -e rhui | awk '{print $1}') if [ "${crb_repo}" == "" ] ; then echo "CRB repo is disabled" else echo "CRB repo is enabled and named: ${crb_repo}" fi ) # Enable or Disable the repo enable_disable_repo(){ command="$1" # Determine which repo we need to change crb_repo=$(dnf repolist --all | grep -i -e crb -e powertools -e codeready | grep -v -i -e debug -e source -e eus -e virt -e rhui | awk '{print $1}') # Determine if we are on RHEL or not, then do the correct steps source /etc/os-release if [[ "${FORCE_DNF:-0}" -eq 0 && "${NAME}" =~ "Red Hat" ]] ; then subscription-manager repos ${command} ${crb_repo} else # Determine if dnf-command(config-manager) is installed if ! rpm -q --whatprovides 'dnf-command(config-manager)' > /dev/null 2>&1 ; then echo "Error: Please run: dnf install 'dnf-command(config-manager)'" >&2 echo " before trying to enable/disable the CRB repo." >&2 echo "Aborting"'!' >&2 exit 1 fi # Everything else uses dnf config-manager dnf config-manager ${command} ${crb_repo} fi } ############### # Get our arguments ############### key="$1" case $key in enable | --enable ) echo "Enabling CRB repo" enable_disable_repo --enable show_status ;; disable | --disable ) echo "Disabling CRB repo" enable_disable_repo --disable show_status ;; status | --status ) show_status ;; * ) usage exit 2 ;; esac exit 0