Last active
October 5, 2017 12:40
-
-
Save marvolo3d/e93b9a2fa874fe51629e1647069cb27c to your computer and use it in GitHub Desktop.
marvolo_maya linux and osx install script
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
#!/bin/bash | |
_blue="\033[01;38;5;39m" | |
_green="\033[01;38;5;34m" | |
_orange="\033[0;38;5;208m" | |
_default="\033[0;00m" | |
echo | |
echo -e "$_blue<<< marvolo_maya installation >>>$_default" | |
echo | |
echo "downloading marvolo_maya" | |
# wget -O /tmp/marvolo_maya.zip https://github.com/t-marvolo/marvolo_maya/archive/master.zip > /dev/null 2>&1 | |
curl -Lko /tmp/marvolo_maya.zip https://github.com/t-marvolo/marvolo_maya/archive/master.zip > /dev/null 2>&1 | |
echo "extracting" | |
unzip -o /tmp/marvolo_maya.zip -d /tmp/ > /dev/null 2>&1 | |
mv /tmp/marvolo_maya-master /tmp/marvolo_maya/ | |
echo "downloading Qt.py" | |
# wget -O /tmp/Qt.py https://raw.githubusercontent.com/mottosso/Qt.py/master/Qt.py > /dev/null 2>&1 | |
curl -Lko /tmp/Qt.py https://raw.githubusercontent.com/mottosso/Qt.py/master/Qt.py > /dev/null 2>&1 | |
echo | |
echo "check for maya installs..." | |
echo | |
function finish { | |
rm -rf /tmp/marvolo_maya* /tmp/Qt.py | |
} | |
trap finish EXIT # catch premature exit and cleanup | |
if [ $(uname) = "Linux" ]; then | |
mayaroot="$HOME/maya/" | |
echo "OS is Linux | maya root: $mayaroot" | |
elif [ $(uname) = "Darwin" ]; then | |
mayaroot="$HOME/Library/Preferences/Autodesk/maya/" | |
echo "OS is MacOS | maya root: $mayaroot" | |
fi | |
echo | |
for (( v=2014; v<=2018; v++ )) | |
do | |
mayadir="${mayaroot}${v}" | |
if [ -d $mayadir ]; then | |
echo -ne "found maya $v at $mayadir: install here (y/n)? " | |
read ANS | |
if [ $ANS == "y" ]; then | |
cp -r /tmp/marvolo_maya "$mayadir/scripts/" | |
cp /tmp/Qt.py "$mayadir/scripts/" | |
userSetup="$mayadir/scripts/userSetup.py" | |
appendUserSetup=1 | |
if [ -f $userSetup ]; then #create userSetup.py, or append space if existing | |
#if marvolo_maya import does not already exist in userSetup | |
if [[ -z $(cat ${userSetup} | grep "import marvolo_maya") ]]; then | |
echo "no marvolo_maya import found in userSetup" | |
echo >> $userSetup | |
else | |
echo "marvolo_maya import already exists in userSetup - skipping append" | |
appendUserSetup=0 | |
fi | |
else | |
echo "no userSetup.py file - creating" | |
touch $userSetup | |
fi | |
if [ $appendUserSetup = 1 ]; then | |
echo "appending marvolo_maya import to userSetup" | |
echo "import pymel.core as pm" >> $userSetup | |
echo "pm.evalDeferred('import marvolo_maya')" >> $userSetup | |
fi | |
echo -e "${_green}succesfully installed for maya $v$_default" | |
else | |
echo -e "${_orannge}skipped install for maya $v${_default}" | |
fi | |
echo | |
else | |
echo "no maya $v found" | |
echo | |
fi | |
done | |
echo "cleanup..." | |
echo | |
echo -e "${_blue}marvolo_maya install complete${_default}" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment