From bc5e7b154c0160c7f512f9d0a1ad85de9b38edbe Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 17 Aug 2022 23:16:25 +0200 Subject: Added some utility scripts I used for some datafiles inspections --- data/compare.sh | 25 +++++++++++++++++++++++++ data/files.sh | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 data/compare.sh create mode 100755 data/files.sh (limited to 'data') diff --git a/data/compare.sh b/data/compare.sh new file mode 100755 index 0000000..4c3958c --- /dev/null +++ b/data/compare.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Run to compare all files from one pack to equivalent files from the other pack. For example: +# +# $ ./compare.sh content +# +# Compares all files in 'content/' pack to equivalent files in 'shatter/' (default second argument). + +test -z "$1" && { echo "missing directory path argument" >&2; exit 1; } +test -d "$1" || { echo "not a directory: $1" >&2; exit 1; } +left=$1 +right=${2:-shatter} +for file in $(find $left/* -type f); do + file=${file#*/} + echo -e "\e[1mdiff $left/$file $right/$file\e[0m" + echo -e "\e[1m<<< $left/$file\e[0m" + if test -f "$right/$file"; then + echo -e "\e[1m>>> $right/$file\e[0m" + if diff --color=always $left/$file $right/$file; then + echo Files are the same + fi + else + echo -e "\e[1m>>> /dev/null\e[0m" + fi + echo +done \ No newline at end of file diff --git a/data/files.sh b/data/files.sh new file mode 100755 index 0000000..11c6b01 --- /dev/null +++ b/data/files.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Lists interesting files in package in $1. Output can be modified by setting $2 to "-print0". By default it lists all +# files that are usually not part of the repository. This can be reverted by setting $3 to "!". For example: +# +# $ ./files.sh start -print ! +# +# Will list all "non-binary" files that are below 'start/' directory. In case of unmodified state of the repository this +# means a couple of *.def files. + +test -d "$1" || exit 1 +exec find "$1" -type f -a $3 \( \ + -iname '*.pcx' -o \ + -iname '*.jpg' -o \ + -iname '*.mag' -o \ + -iname '*.wav' -o \ + -iname '*.pal' -o \ + -iname '*.ogg' -o \ + -iname '*.ipl' \) ${2:--print} -- cgit v1.1