#!/bin/zsh PROGRAM=$0 success() { echo "\e[1;32mDone:\e[m $1" exit 0 } fail() { echo "\e[1;31mError:\e[m $1" exit 1 } help() { cat < ../../patches/tock/${file#*-} done git clean -qfxd top=$(get_head) git checkout -q $root rm -r boards patch -sp1 < ../../patches/tock/00-boards.patch rm ../../patches/tock/00-boards.patch rsync -a --delete boards ../.. git reset -q --hard git clean -qfxd git checkout -q $top ) || exit success 'Saved the Tock submodule to the patches.' } [[ $(basename $PWD) == OpenSK ]] || fail 'Not running from OpenSK directory.' [[ $# -eq 1 ]] || help case $1 in apply) apply ;; save) save ;; *) fail 'Unexpected argument. Run without argument for help.' ;; esac