#!/bin/sh # Show what would change on this server when the repository is applied (dry run by default). # buildbot runs the dry run; the real deployment is /opt/wiiu/bin/deploy-server (root-owned, own allow-list). R=$(cd "$(dirname "$0")/.." && pwd); W=/opt/wiiu; APPLY=${1:-} map() { # repo path -> live path case "$1" in etc/mrtg/mrtg.cfg|buildbot/master.cfg) return 1 ;; etc/*) echo "$W/$1" ;; bin/*) echo "$W/$1" ;; www/index.html) echo /srv/www/default/index.html ;; www/mefo/plugins/*) echo "/srv/www/mefo/plugins/${1##*/}" ;; rc.d/buildbot_dango) echo /usr/local/etc/rc.d/buildbot_dango ;; rc.d/*) echo "/etc/rc.d/${1##*/}" ;; *) return 1 ;; esac } cd "$R"; find . -type f -not -path './.git/*' | sed 's|^\./||' | while read f; do t=$(map "$f") || continue; [ -e "$t" ] || continue grep -qE '|@@[A-Z_]+@@' "$f" && continue cmp -s "$f" "$t" && continue echo "differs: $f -> $t"; [ "$APPLY" = "--apply" ] && { cp -p "$t" "/var/tmp/$(basename "$t").deploy-bak"; cp "$f" "$t"; } done exit 0