This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
disco/client/bin/disco-fs-diff

38 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash
. /etc/disco/client.cfg
SCRIPTROOT=$(dirname $(readlink -f $0))
if [ "$NOOP" != "" ]; then
DISCOROOT=/var/disco/testfs/noop
else
DISCOROOT=/var/disco/testfs/real
fi
cd $DISCOROOT
CREATED=0
DELETED=0
MODIFIED=0
rsync --checksum --times --perms --owner --group -ani ./scratchfs/ ./rootfs/ --out-format "info: File: %i : %f : mode='%B', size='%l', mtime='%M'" |\
sed -e s/"scratchfs"/""/ \
-e s/"\.unionfs\/"/""/ \
2012-08-19 15:21:51 -04:00
-e s/"info: File: .* : \(\/.*\)_HIDDEN~ : mode="/"info: File: *_deleted__ : \1 : mode="/|\
while read LINE
do
FNAME=$(echo $LINE | cut -d : -f 4 | sed s/"^ *"/""/ | sed s/" *$"/""/)
MD5_NEW=$(md5sum ${DISCOROOT}/scratchfs${FNAME} 2>/dev/null| cut -d " " -f 1)
STAT_NEW=$(chroot ${DISCOROOT}/chroot stat --format "owner='%G:%U', selinux='%C', md5='${MD5_NEW}'" /${FNAME} 2>/dev/null)
2012-08-19 15:21:51 -04:00
if [ ! -d ${FNAME} ] && [ ! -d ${DISCOROOT}/scratchfs${FNAME} ]; then
diff -N ${FNAME} ${DISCOROOT}/scratchfs${FNAME} 2>/dev/null | grep -v "^Binary file" > /tmp/$$.diff
fi
echo "${LINE}, ${STAT_NEW}"
if [ -f /tmp/$$.diff ]; then
cat /tmp/$$.diff
fi
rm -f /tmp/$$* 2>/dev/null
done
rm -f /tmp/$$*