Skip to content

Instantly share code, notes, and snippets.

@yurii-litvinov
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurii-litvinov/7cfcc0c32ee333ee695c to your computer and use it in GitHub Desktop.
Save yurii-litvinov/7cfcc0c32ee333ee695c to your computer and use it in GitHub Desktop.
Helpful bash aliases for TRIK development
#User-defined settings
export PATH=~/Qt/5.5/gcc_64/bin/:$PATH
alias oecore='. /opt/trik-sdk/environment-setup-arm926ejste-oe-linux-gnueabi && xdotool key --delay 100 Alt+t p Down Down Return'
alias sublime='/home/yurii/Sublime\ Text\ 2/sublime_text 1> /dev/null 2>/dev/null'
alias creator='~/Qt/Tools/QtCreator/bin/qtcreator.sh 1>/dev/null 2>/dev/null &'
build() {
case ${PWD##*/} in
trikRuntime*)
if [ "$1" != "--no-tests" ]
then
echo "Building TRIKRuntime with tests"
else
echo "Building TRIKRuntime without tests"
fi
qmake -r CONFIG+=release trikRuntime.pro
make -j7
if [ $? -ne 0 ]
then
return 1
fi
if [ "$1" != "--no-tests" ]
then
cd tests
qmake -r CONFIG+=release tests.pro
make -j7
cd -
fi
;;
qreal*)
echo "Building TRIKStudio"
qmake CONFIG+=debug qrealRobots.pro
make -j7
;;
*)
echo "Unknown directory, don't know what to build here"
;;
esac
}
deploy() {
ip=192.168.77.1
if [ "$1" ]
then
ip=$1
fi
echo "ip is $ip"
ssh root@$ip 'chmod -x /etc/trik/trikGui.sh && killall trikGui'
rsync -avz -e ssh bin/arm-release/ root@$ip:/home/root/trik
ssh root@$ip 'chmod +x /etc/trik/trikGui.sh && /sbin/start-stop-daemon -Sbvx /home/root/trik/trikGui -- -qws'
}
releaseRuntime() {
if [ -z "$1" ]
then
echo "Please specify trikRuntime version"
return 1
fi
case ${PWD##*/} in
trikRuntime*)
if [ -z "$OECORE_SDK_VERSION" ]
then
echo "No Open Embedded Core in environment, crosscompilation is impossible"
return 1
fi
echo "Checking version.h"
if ! fgrep $1 trikKernel/include/trikKernel/version.h
then
echo "Version in version.h file does not match release version, please update version.h or check release version"
return 1
fi
echo "Releasing TRIK Runtime"
git clean -dfx
if ! build --no-tests
then
echo "Build failed, aborting"
return 1
fi
if ! cd bin/arm-release
then
echo "Something went wrong"
return 1
fi
tar cvfzh trikRuntime.tar.gz *
if ! [ -d ~/trik-runtime-builds ]
then
echo "No trik-tuntime-builds repo in home folder, cloning..."
git clone https://github.com/qreal/trik-runtime-builds.git ~/trik-runtime-builds
if [ $? -ne 0 ]
then
echo "Git Clone failed"
return 1
fi
fi
mv trikRuntime.tar.gz ~/trik-runtime-builds
cd -
cd ~/trik-runtime-builds
git commit -a -m"v$1"
git push
cd -
;;
*)
echo "Unknown directory, don't know what to release here"
;;
esac
}
alias qmake='qmake CONFIG+=debug'
alias qmakeRelease='qmake CONFIG+=release'
trik() {
xdotool key --delay 100 Alt+t p Down Return
ssh root@192.168.77.1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment