Created
January 20, 2017 16:35
-
-
Save scriptum/3c4f026228d21ec0a9af47b7c27dbb02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # rpm -q --scripts ofed-scripts | |
| postinstall scriptlet (using /bin/sh): | |
| if [ $1 -ge 1 ]; then #This package is being installed or reinstalled | |
| if [ -e /etc/yum.conf ]; then | |
| list="ibutils-libs" | |
| lista=`echo ${list} | sed -e "s/ /* /g" -e "s/$/*/"` | |
| if [ -n "$list" ]; then | |
| if ( grep -q "^exclude=" /etc/yum.conf ); then | |
| new_list= | |
| for pkg in $list | |
| do | |
| if (grep "^exclude=" /etc/yum.conf | grep -wq "$pkg"); then | |
| continue | |
| else | |
| new_list="$new_list ${pkg}*" | |
| fi | |
| done | |
| perl -ni -e "s@^(exclude=.*)@\$1 $new_list@;print" /etc/yum.conf | |
| else | |
| perl -i -ne "if (m@^\[main\]@) { | |
| print q@[main] | |
| exclude=$lista | |
| @; | |
| } else { | |
| print; | |
| }" /etc/yum.conf | |
| fi | |
| fi | |
| fi | |
| fi | |
| /sbin/ldconfig | |
| postuninstall scriptlet (using /bin/sh): | |
| if [ $1 = 0 ]; then #Erase, not upgrade | |
| if [ -e /etc/yum.conf ]; then | |
| list="ibutils-libs" | |
| if [ -n "$list" ]; then | |
| if ( grep -q "^exclude=" /etc/yum.conf ); then | |
| for pkg in $list | |
| do | |
| if (grep "^exclude=" /etc/yum.conf | grep -wq "$pkg"); then | |
| sed -i -e "s/\<$pkg\>\*//" /etc/yum.conf | |
| sed -i -e "s/\<$pkg\>//" /etc/yum.conf | |
| fi | |
| done | |
| fi | |
| fi | |
| perl -ni -e "print unless /^exclude=\s+$/" /etc/yum.conf | |
| sed -i -e "s/^exclude= \{1,\}/exclude=/" -e "s/ \{1,\}$//" /etc/yum.conf | |
| fi | |
| fi | |
| /sbin/ldconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment