Skip to content

Instantly share code, notes, and snippets.

@odysseywestra
Last active August 8, 2017 04:48
Show Gist options
  • Save odysseywestra/9f5ded741ce6f10eba0b to your computer and use it in GitHub Desktop.
Save odysseywestra/9f5ded741ce6f10eba0b to your computer and use it in GitHub Desktop.
Custom script for me to install, update, build, test, and debug my development environment for MyPaint. This script assumes a bunch of information. Edit accordingly.
#! /bin/bash
## THIS SCRIPT IS OUTDATED TO USE AS IS. I AM NOT RESPONSIBLE IF THIS SCRIPT BORKS YOUR SYSTEM!!!
# General script for installing MyPaint. This script assumes you use ssh
# to connnect to github, and that you are on a debian base system. Please
# edit the script acordingly. I am not responsible if this script breaks
# your system. If no argument is given, it will just update the repositories.
#Feedback Colors
SYS="\033[1m\033[31mSYSTEM:\033[34;1m"
GIT="\033[1m\033[32mGIT:\033[34;1m"
NC="\033[0m"
#Git Repository Target Folder
target="/home/albert/Public/Github"
#Install Location
location="/usr/local"
#Logs Location
logs="${target}/MyPaint/debug_logs.txt"
#Required Info for Git
name="Albert Westra"
email="[email protected]"
#Location of Repository
mypaint="[email protected]:mypaint/mypaint.git"
libmypaint="[email protected]:mypaint/libmypaint.git"
#Location of Website Repository
website="[email protected]:mypaint/mypaint.github.io.git"
#Requred dependencies to build and run MyPaint
dependencies="git g++ python-dev python-numpy libgtk-3-dev \
python-gi-dev gir1.2-gtk-3.0 python-gi-cairo swig scons gettext \
libpng12-dev liblcms2-dev libjson-c-dev gem"
if [ $1 = "install" ]; then
echo -e "${SYS} Installing Dependencies${NC}"
sudo apt install $dependencies
sudo gem install jekyll
cd $target
mkdir MyPaint
echo "${GIT} Setting Git Global Name and Email${NC}"
git config --global user.name "${name}"
git config --global user.email "${email}"
git config --global push.default matching
echo -e "${GIT} Cloning MyPaint Repositories${NC}"
cd MyPaint
git clone $mypaint mypaint
git clone $libmypaint libmypaint
git clone $website website
echo -e "${GIT} Updating Submodules${NC}"
cd mypaint
git submodule update --init --force
echo -e "${SYS} Installing MyPaint${NC}"
sudo scons prefix=$location install
echo -e "${SYS} Unless there are any errors, MyPaint is Installed${NC}"
elif [ $1 = "update" ]; then
echo -e "${GIT} Updating Repositories${NC}"
cd $target/MyPaint/website
git pull
cd $target/MyPaint/libmypaint
git pull
cd $target/MyPaint/mypaint
git pull
git submodule update --init --force
echo -e "${SYS} Updating MyPaint${NC}"
sudo scons prefix=$location install --clean
sudo scons prefix=$location install
echo -e "${SYS} MyPaint is now Updated${NC}"
elif [ $1 = "remove" ]; then
echo -e "${SYS} Uninstalling MyPaint${NC}"
cd $target/MyPaint
sudo scons prefix=$location install --clean
echo -e "${SYS} Deleting MyPaint Git Repositories${NC}"
cd ..
sudo rm -rf $target/MyPaint
echo -e "${SYS} MyPaint Development Build is Removed${NC}"
elif [ $1 = "build" ]; then
echo -e "${SYS} Compiling Local Build${NC}"
cd $target/MyPaint/mypaint
scons --clean
scons
rm -fr /tmp/mypaint_testconfig
echo -e "${SYS} Launching Local Build${NC}"
./mypaint -c /tmp/mypaint_testconfig
elif [ $1 = "clean" ]; then
echo -e "${SYS} Scrubbing Local Build${NC}"
cd $target/MyPaint/mypaint
scons --clean
echo -e "${SYS} Local Build Scrubed.${NC}"
elif [ $1 = "debug" ]; then
echo -e "${SYS} Installing Debuging Software${NC}"
sudo apt install gdb python2.7-dbg libgtk-3-0-dbg
cd $target/MyPaint/mypaint
scons debug=1
export MYPAINT_DEBUG=1
gdb -ex r --args python ./mypaint -c /tmp/cfgtmp_throwaway_2 > $logs
else
echo -e "${GIT} Updating Repositories${NC}"
cd $target/MyPaint/website
git pull
cd $target/MyPaint/libmypaint
git pull
cd $target/MyPaint/mypaint
git pull
git submodule update --init --force
echo -e "${SYS} Updating MyPaint${NC}"
sudo scons prefix=$location install --clean
sudo scons prefix=$location install
echo -e "${SYS} MyPaint is now Updated${NC}"
fi
sleep 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment