|
@@ -1,37 +1,36 @@
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
-if [ ! -e /usr/bin/xgettext ]; then
|
|
|
|
|
|
|
+
|
|
|
|
|
+if [ ! -x /usr/bin/xgettext ]; then
|
|
|
echo " **********************************************************"
|
|
echo " **********************************************************"
|
|
|
echo " * Unable to find xgettext please install gettext package *"
|
|
echo " * Unable to find xgettext please install gettext package *"
|
|
|
echo " **********************************************************"
|
|
echo " **********************************************************"
|
|
|
exit 3
|
|
exit 3
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-echo "[ * ] Move hestiacp.pot to Move hestiacp.pot.old"
|
|
|
|
|
|
|
+echo "[ * ] Move hestiacp.pot to hestiacp.pot.old"
|
|
|
mv hestiacp.pot hestiacp.pot.old
|
|
mv hestiacp.pot hestiacp.pot.old
|
|
|
-echo "" > hestiacp.pot
|
|
|
|
|
|
|
+true > hestiacp.pot
|
|
|
|
|
|
|
|
echo "[ * ] Search *.php *.html and *.sh for php based gettext functions"
|
|
echo "[ * ] Search *.php *.html and *.sh for php based gettext functions"
|
|
|
find ../.. \( -name '*.php' -o -name '*.html' -o -name '*.sh' \) | xgettext --output=hestiacp.pot --language=PHP --join-existing -f -
|
|
find ../.. \( -name '*.php' -o -name '*.html' -o -name '*.sh' \) | xgettext --output=hestiacp.pot --language=PHP --join-existing -f -
|
|
|
-OLDIFS=$IFS
|
|
|
|
|
-IFS=$'\n'
|
|
|
|
|
|
|
+
|
|
|
# Scan the description string for list updates page
|
|
# Scan the description string for list updates page
|
|
|
-for string in $(awk -F'DESCR=' '/data=".+ DESCR=[^"]/ {print $2}' ../../bin/v-list-sys-hestia-updates | cut -d\' -f2); do
|
|
|
|
|
- if [ -z "$(grep "\"$string\"" hestiacp.pot)" ]; then
|
|
|
|
|
- echo -e "\n#: ../../bin/v-list-sys-hestia-updates:"$(grep -n "$string" ../../bin/v-list-sys-hestia-updates | cut -d: -f1)"\nmsgid \"$string\"\nmsgstr \"\"" >> hestiacp.pot
|
|
|
|
|
|
|
+while IFS= read -r string; do
|
|
|
|
|
+ if ! grep -q "\"$string\"" hestiacp.pot; then
|
|
|
|
|
+ echo -e "\n#: ../../bin/v-list-sys-hestia-updates:$(grep -n "$string" ../../bin/v-list-sys-hestia-updates | cut -d: -f1)\nmsgid \"$string\"\nmsgstr \"\"" >> hestiacp.pot
|
|
|
fi
|
|
fi
|
|
|
-done
|
|
|
|
|
|
|
+done < <(awk -F'DESCR=' '/data=".+ DESCR=[^"]/ {print $2}' ../../bin/v-list-sys-hestia-updates | cut -d\' -f2)
|
|
|
|
|
+
|
|
|
# Scan the description string for list server page
|
|
# Scan the description string for list server page
|
|
|
-for string in $(awk -F'SYSTEM=' '/data=".+ SYSTEM=[^"]/ {print $2}' ../../bin/v-list-sys-services | cut -d\' -f2); do
|
|
|
|
|
- if [ -z "$(grep "\"$string\"" hestiacp.pot)" ]; then
|
|
|
|
|
- echo -e "\n#: ../../bin/v-list-sys-services:"$(grep -n "$string" ../../bin/v-list-sys-services | cut -d: -f1)"\nmsgid \"$string\"\nmsgstr \"\"" >> hestiacp.pot
|
|
|
|
|
|
|
+while IFS= read -r string; do
|
|
|
|
|
+ if ! grep -q "\"$string\"" hestiacp.pot; then
|
|
|
|
|
+ echo -e "\n#: ../../bin/v-list-sys-services:$(grep -n "$string" ../../bin/v-list-sys-services | cut -d: -f1)\nmsgid \"$string\"\nmsgstr \"\"" >> hestiacp.pot
|
|
|
fi
|
|
fi
|
|
|
-done
|
|
|
|
|
-IFS=$OLDIFS
|
|
|
|
|
|
|
+done < <(awk -F'SYSTEM=' '/data=".+ SYSTEM=[^"]/ {print $2}' ../../bin/v-list-sys-services | cut -d\' -f2)
|
|
|
|
|
|
|
|
# Prevent only date change become a commit
|
|
# Prevent only date change become a commit
|
|
|
-if [ $(diff hestiacp.pot hestiacp.pot.old | wc -l) != 2 ]; then
|
|
|
|
|
- rm hestiacp.pot
|
|
|
|
|
- mv hestiacp.pot.old hestiacp.pot
|
|
|
|
|
-else
|
|
|
|
|
|
|
+if [ "$(diff hestiacp.pot hestiacp.pot.old | wc -l)" -gt 4 ]; then
|
|
|
rm hestiacp.pot.old
|
|
rm hestiacp.pot.old
|
|
|
|
|
+else
|
|
|
|
|
+ mv -f hestiacp.pot.old hestiacp.pot
|
|
|
fi
|
|
fi
|