make site-updaters that are mtn dependent also work with git.

This commit is contained in:
hankhill19580
2020-09-10 00:05:01 +00:00
parent 87f758e6f7
commit 8309eb2209
4 changed files with 63 additions and 24 deletions

View File

@@ -8,3 +8,8 @@ if [ $(which timeout) ]; then
else else
MTN="mtn" MTN="mtn"
fi fi
GITURL="i2pgit.org"
GITBRANCH="i2p.www"

View File

@@ -4,6 +4,9 @@ rm -f $TMP2
touch $TMP2 touch $TMP2
for i in i2p2www/translations/*/*/*.po for i in i2p2www/translations/*/*/*.po
do do
if [ -d ./.git ]; then
git diff $i | grep '+msgstr' | grep -v '+msgstr ""' > $TMP
fi
mtn diff $i | grep '+msgstr' | grep -v '+msgstr ""' > $TMP mtn diff $i | grep '+msgstr' | grep -v '+msgstr ""' > $TMP
if [ -s $TMP ] if [ -s $TMP ]
then then

View File

@@ -8,10 +8,26 @@ cd $(dirname $0)
TMP=$(mktemp XXXXXXXXXX) TMP=$(mktemp XXXXXXXXXX)
trap 'rm -f $TMP;exit' 0 1 2 15 trap 'rm -f $TMP;exit' 0 1 2 15
if [ -d ./.git ]; then
git pull origin master | tee $TMP
if grep "i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages"
./compile-messages-i2hq.sh
fi
echo "Git revision: $(git log -n 1 | grep commit | sed 's/commit //' | sed 's/ .*$//')" >./i2p2www/pages/include/mtnversion
if grep "^git: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TMP" >/dev/null ; then
echo "Python files changed, restarting server"
touch $TOUCHFILE
fi
else
mtn pull "mtn://$MTNURL?$MTNBRANCH" mtn pull "mtn://$MTNURL?$MTNBRANCH"
mtn up 2>&1 | tee $TMP mtn up 2>&1 | tee $TMP
if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages" echo "Translations updated, compiling messages"
./compile-messages-i2hq.sh ./compile-messages-i2hq.sh
@@ -24,4 +40,6 @@ if grep "^mtn: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TM
touch $TOUCHFILE touch $TOUCHFILE
fi fi
fi
[ -f ./.pybabel-stamp ] || ./compile-messages.sh [ -f ./.pybabel-stamp ] || ./compile-messages.sh

View File

@@ -8,10 +8,23 @@ cd $(dirname $0)
TMP=$(mktemp XXXXXXXXXX) TMP=$(mktemp XXXXXXXXXX)
trap 'rm -f $TMP;exit' 0 1 2 15 trap 'rm -f $TMP;exit' 0 1 2 15
if [ -d ./.git ]; then
#$MTN pull -k "" "mtn://$MTNURL?$MTNBRANCH"
git pull origin master 2>&1 | tee $TMP
if grep "i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages"
./compile-messages.sh
fi
echo "Git revision: $(git log -n 1 | grep commit | sed 's/commit: //' | sed 's/ .*$//')" >./i2p2www/pages/include/mtnversion
if grep "^git: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TMP" >/dev/null ; then
echo "Python files changed, restarting server"
touch $TOUCHFILE
fi
else
$MTN pull -k "" "mtn://$MTNURL?$MTNBRANCH" $MTN pull -k "" "mtn://$MTNURL?$MTNBRANCH"
$MTN up 2>&1 | tee $TMP $MTN up 2>&1 | tee $TMP
if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages" echo "Translations updated, compiling messages"
./compile-messages.sh ./compile-messages.sh
@@ -23,5 +36,5 @@ if grep "^mtn: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TM
echo "Python files changed, restarting server" echo "Python files changed, restarting server"
touch $TOUCHFILE touch $TOUCHFILE
fi fi
fi
[ -f ./.pybabel-stamp ] || ./compile-messages.sh [ -f ./.pybabel-stamp ] || ./compile-messages.sh