From 1165b2995a0b2f422dcb6fa30bd2b1d68bbdd9b9 Mon Sep 17 00:00:00 2001 From: ich777 Date: Mon, 8 Feb 2021 17:33:55 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9Edifference.sh=E2=80=9C=20hinzuf=C3=BCg?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- difference.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 difference.sh 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