diff --git a/difference.sh b/difference.sh new file mode 100644 index 0000000..58be4b8 --- /dev/null +++ b/difference.sh @@ -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} \ No newline at end of file