Advertisement
korovamilk

yum3.sh python3 to python2 switcher (and fallback) for YUM

Mar 4th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.81 KB | None | 0 0
  1. #!/bin/bash
  2. # YUM3.sh
  3. # v201303050112
  4. # [Tested on Fedora 18 x86_64 - yum-3.4.3-51 + python-2.7.3-13 + python3-3.3.0-1]
  5.  
  6. # yum refuses to deal with python3 as default python version
  7. # here's a simple and dirt python version switcher
  8. # just copy to /bin/ and launch from your path as you would as usual
  9. # [sudo] yum3 [options] [command] [package ...]
  10.  
  11. if [ -L /bin/python3 ] ; then
  12.     echo -e "\e[00;31m * Switching to Python2 for YUM's sake \e[00m"
  13.     # removing symlink && creating symlink to python2
  14.     rm -f /bin/python && ln -s /bin/python2 /bin/python
  15.     /bin/yum $@
  16.     echo -e "\e[00;31m * Falling back to Python3 \e[00m"
  17.     # removing symlink && creating back symlink to python3
  18.     rm -f /bin/python && ln -s /bin/python3 /bin/python
  19. else
  20.     echo -e "\e[00;31m * No symlink found, refusing to proceed \e[00m"
  21. fi
  22.  
  23. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement