Skip to content

Instantly share code, notes, and snippets.

@korovamilk
Last active July 24, 2020 11:28
Show Gist options
  • Save korovamilk/5196018 to your computer and use it in GitHub Desktop.
Save korovamilk/5196018 to your computer and use it in GitHub Desktop.
#!/bin/bash
# yum3.sh
# v201303191415
# https://blog.agate.pw
# [Tested on Fedora 18 x86_64 - yum-3.4.3-51 + python-2.7.3-13 + python3-3.3.0-1]
# yum refuses to deal with python3 as default python version
# here’s a simple and dirt python version switcher
# just copy to /bin/ and launch from your path as you would as usual
# [sudo] yum3 [options] [command] [package(s)]
if [ -L /bin/python3 ] ; then
echo -e “\e[00;31m * Switching to Python2 for YUM’s sake \e[00m”
# removing symlink && creating symlink to python2
rm -f /bin/python && ln -s /bin/python2 /bin/python
/bin/yum $@
echo -e “\e[00;31m * Falling back to Python3 \e[00m”
# removing symlink && creating back symlink to python3
rm -f /bin/python && ln -s /bin/python3 /bin/python
else
echo -e “\e[00;31m * No symlink found, refusing to proceed \e[00m”
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment