Created
October 7, 2013 14:51
-
-
Save PiotrCzapla/6869281 to your computer and use it in GitHub Desktop.
A cygwin script to compare a content of workarea with content of STAGING
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tsurl() { | |
dir=$(realpath "$*"); | |
echo "${dir/cygdrive\/y//localhost}" | |
} | |
function dump_ea_txt { | |
src=${1:-.} | |
filter=${3:-TeamSite/Metadata/.*} | |
dest=${2:-/cygdrive/c/tmp} | |
echo "Extracting extattrs maching $filter from $src to $dest" | |
find "$src" -type f | while read f ; do | |
d="$dest/$f.ea.txt" | |
dir=$(dirname "$d") | |
mkdir -p "$dir" | |
( | |
sha1sum "$f"; | |
url=$(tsurl "$f") | |
iwextattr.exe -l -r $filter "$url" | |
) >"$d" | |
done | |
} | |
function gen_sha1 { | |
find . -type f -exec sha1sum {} \; | |
} | |
cd /cygdrive/y/default/main/MSite/WORKAREA/Shared/assets/documents | |
wa_dir=$(pwd); | |
staging=${wa_dir/WORKAREA\/Shared/STAGING}; | |
(cd $staging; dump_ea_txt . /cygdrive/c/tmp/dump/staging) | |
(cd $wa_dir; dump_ea_txt . /cygdrive/c/tmp/dump/wa) | |
(cd /cygdrive/c/tmp/dump/staging; gen_sha1) >/tmp/st-ea.sha1 | |
rm /tmp/submit.txt | |
cd $wa_dir | |
(cd /cygdrive/c/tmp/dump/wa; sha1sum -c /tmp/st-ea.sha1) | tee /tmp/ea-cmp.log |grep --line-buffered ": OK" | sed 's/.ea.txt: OK$//' |( while read fn; do | |
echo $(tsurl "$fn") | |
echo "Submitting because the file content and it's metadata was not changed." | |
done ) >/tmp/submit.txt | |
(cd "$staging"; gen_sha1) > /tmp/staging-docs-20131007.sha1 | |
cat /tmp/submit.txt |iwsubmit.exe -x -f - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment