„difference.sh“ hinzufügen

This commit is contained in:
2021-02-08 17:33:55 +01:00
parent bc693cb75e
commit 1165b2995a

30
difference.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# Should be run as root user to avoid messing up permissions
BASEDIR=/root
SEARCHDIR=/usr/share/locale
ls ${SEARCHDIR}/de/LC_MESSAGES/ > ${BASEDIR}/before
#-----------------------------------------------
# Install app to make difference search possible
#-----------------------------------------------
ls ${SEARCHDIR}/de/LC_MESSAGES/ > ${BASEDIR}/after
diff ${BASEDIR}/before ${BASEDIR}/after > ${BASEDIR}/diff.list
sed -i '/^>/!d' ${BASEDIR}/diff.list
sed -i 's/^..//' ${BASEDIR}/diff.list
mkdir -p ${BASEDIR}/diff
while read -r line
do
find ${SEARCHDIR}/ -name $line -print0 | xargs -0 -I {} cp -r --parents {} ${BASEDIR}/diff
done < ${BASEDIR}/diff.list
cd ${BASEDIR}/diff
tar -czvf ../locales.tar .
rm -rf ${BASEDIR}/before ${BASEDIR}/after ${BASEDIR}/diff.list ${BASEDIR}/diff
cd ${BASEDIR}