Index: branches/hardy/debs/wikimedia-task-appserver/mw-cksum-list |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +#!/bin/bash |
| 3 | +# Get a sorted file/md5 list for a MediaWiki installation. |
| 4 | +# Expects a directory as the only argument. |
| 5 | + |
| 6 | +# Path to scan for files |
| 7 | +if [ -z "$1" ]; then |
| 8 | + echo "mw-cksum-list: no directory specified" |
| 9 | + exit 1 |
| 10 | +fi |
| 11 | + |
| 12 | +# Use maxdepth = 1 if checking the files in common-local. |
| 13 | +# Used for 'common-files' parameter in mw-cksum. |
| 14 | +if [ $(basename $1) == 'common-files' ]; then |
| 15 | + codePath=$(dirname $1) |
| 16 | + maxDepth="-maxdepth 1" |
| 17 | + filterParams="-name *.dat" |
| 18 | +else |
| 19 | + codePath="$1" |
| 20 | + maxDepth="" |
| 21 | + filterParams="( -name *.php -o -name *.cdb ) ! -name *.i18n.php ! -name *.alias.php" |
| 22 | +fi |
| 23 | + |
| 24 | +# Format through AWK to have the path first to improve diffs. |
| 25 | +nice -19 find -P $codePath $maxDepth -type f $filterParams \ |
| 26 | + -exec stat --printf="%n %a %G %U " {} \; -exec cksum {} \; \ |
| 27 | + | awk '{print $1, $2, $3, $4, $5}' | sort; |
Index: branches/hardy/debs/wikimedia-task-appserver/debian/changelog |
— | — | @@ -1,3 +1,9 @@ |
| 2 | +wikimedia-task-appserver (1.51) hardy-wikimedia; urgency=low |
| 3 | + |
| 4 | + * Added scripts to create MediaWiki fingerprints. Used for checking if installations are synced. |
| 5 | + |
| 6 | + -- Aaron Schulz <aschulz@wikimedia.org> Thu, 15 Sep 2011 19:45:54 +0000 |
| 7 | + |
2 | 8 | wikimedia-task-appserver (1.50) hardy-wikimedia; urgency=medium |
3 | 9 | |
4 | 10 | * Removed damaging quotes around for loop array (only worked when there was one item) |
Index: branches/hardy/debs/wikimedia-task-appserver/debian/rules |
— | — | @@ -51,7 +51,8 @@ |
52 | 52 | # Install sync/check scripts |
53 | 53 | install -d -m 0755 $(DESTDIR)/usr/bin |
54 | 54 | install -d -m 0755 $(DESTDIR)/usr/sbin |
55 | | - install -m 0755 sync-common apache-sanity-check apache-start check-time scap-1skins scap-1 scap-2 mwversionsinuse $(DESTDIR)/usr/bin |
| 55 | + install -m 0755 sync-common apache-sanity-check apache-start check-time $(DESTDIR)/usr/bin |
| 56 | + install -m 0755 scap-1skins scap-1 scap-2 mwversionsinuse mw-cksum mw-cksum-list $(DESTDIR)/usr/bin |
56 | 57 | |
57 | 58 | install -d -m 0750 $(DESTDIR)/var/lib/pybal-check/.ssh |
58 | 59 | install -m 0640 authorized_keys $(DESTDIR)/var/lib/pybal-check/.ssh/authorized_keys |
Index: branches/hardy/debs/wikimedia-task-appserver/mw-cksum |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +#!/bin/bash |
| 3 | +# Gets the hashes for all MW versions, wmf-config and common-other. |
| 4 | +# Each key for a MW version is of the format: php-<version>:<sha1>. |
| 5 | +# Hashes for wmf-config and common-other are of the format <keyName>:<sha1>. |
| 6 | +# If specified, gets the SHA1 for just one keyName (e.g. MW version) |
| 7 | +BINDIR="/usr/bin" |
| 8 | +COMMON="/usr/local/apache/common-local" |
| 9 | + |
| 10 | +# Filter the key list to one value |
| 11 | +keyName=$1 |
| 12 | + |
| 13 | +# If a MW version is given, give sha1 for a single directory |
| 14 | +if [ -n "$keyName" ]; then |
| 15 | + # common-files hash determined differently |
| 16 | + if [ "$keyName" != "common-files" ]; then |
| 17 | + if [ ! -d "$COMMON/$keyName" ]; then |
| 18 | + echo "mw-cksum: $COMMON/$keyName is not a directory." |
| 19 | + exit 1 |
| 20 | + fi |
| 21 | + fi |
| 22 | + mwCodeDirs=("$keyName") |
| 23 | +# Otherwise, get SHA1 for each active MW version and wmf-config/multiversion |
| 24 | +else |
| 25 | + mwCodeDirs=("wmf-config" "multiversion" "common-files") |
| 26 | + mwVersionNums=$($BINDIR/mwversionsinuse) |
| 27 | + if [ -z "$mwVersionNums" ]; then |
| 28 | + echo "Unable to read wikiversions.dat or it is empty" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | + for mwVerNum in ${mwVersionNums[@]}; do |
| 32 | + mwCodeDirs+=("php-$mwVerNum") |
| 33 | + done |
| 34 | +fi |
| 35 | + |
| 36 | +sha1Keys=() |
| 37 | +# Get SHA1 hash for each MW code path |
| 38 | +for codeDir in ${mwCodeDirs[@]}; do |
| 39 | + sha1Hash=$($BINDIR/mw-cksum-list "$COMMON/$codeDir" | sha1sum) |
| 40 | + sha1Keys+=("$codeDir:${sha1Hash%% *}") |
| 41 | +done |
| 42 | + |
| 43 | +echo ${sha1Keys[@]} |