#!/bin/bash repo=/tmp/rpi-config device=${1} if [ ! -d /tmp/rpi-config/.git ]; then cd /tmp su ctibor --command "/usr/bin/git clone --depth 1 ssh://git@git.brancik.cz/rpi-config.git" su ctibor --command "/usr/bin/git config --global user.name \"Ctibor Brančík\"" su ctibor --command "/usr/bin/git config --global user.email \"ctibor@brancik.cz\"" fi if [ $# != 2 ]; then echo "Usage sync-rpi-config . Action can be either push or pull." exit 1; fi case $1 in alcor-01|alcor-02|alcor-03) root="/usr/armv6j-hardfloat-linux-gnueabi/";; mizar) root="/usr/armv7a-hardfloat-linux-gnueabi/";; alioth) root="/usr/aarch64-unknown-linux-gnu/";; *) echo "Usage sync-rpi-config ." exit 1;; esac case $2 in push) echo "Pushing config files to overlay folder ..." /usr/bin/rsync -v --files-from ${root}/etc/portage/filelist_sync --recursive ${root} ${repo}/conf/${device} -- cd ${repo} su ctibor --command "/usr/bin/git pull" su ctibor --command "/usr/bin/git commit -a -m \"Update portage config for ${device} $(date +%Y%m%d-%H%M%S)\"" su ctibor --command "/usr/bin/git push";; pull) echo "Pulling config files from overlay folder ..." cd ${repo} su ctibor --command "/usr/bin/git pull" /usr/bin/rsync -v --files-from ${root}/etc/portage/filelist_sync --recursive ${repo}/conf/${device} ${root} --;; *) echo "Usage sync-rpi-config ." exit 1;; esac function cleanup { rm -r /tmp/rpi-config } trap cleanup EXIT;