Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripts
mahara-scripts
Commits
d5420001
Commit
d5420001
authored
Apr 05, 2011
by
Richard Mansfield
Browse files
Add script to update .pot files from mahara source
parent
cfd88469
Changes
1
Hide whitespace changes
Inline
Side-by-side
mahara-langpacks/update-pot.sh
0 → 100755
View file @
d5420001
#!/bin/bash
# Update .pot files
# this is expected to define DATA, and SCRIPTS
.
/etc/mahara-langpacks.conf
if
[
!
-w
${
DATA
}
]
;
then
echo
"
${
DATA
}
not writable"
exit
1
fi
WORK
=
${
DATA
}
/templates
GITDIR
=
${
WORK
}
/git
TEMP
=
${
WORK
}
/temp
OUT
=
${
DATA
}
/pot
[
!
-d
${
WORK
}
]
&&
mkdir
${
WORK
}
[
!
-d
${
TEMP
}
]
&&
mkdir
${
TEMP
}
[
!
-d
${
OUT
}
]
&&
mkdir
${
OUT
}
remote
=
'git://gitorious.org/mahara/mahara.git'
if
[
!
-d
${
GITDIR
}
]
;
then
echo
"git clone
${
remote
}
${
GITDIR
}
"
git clone
--quiet
${
remote
}
${
GITDIR
}
fi
cd
${
GITDIR
}
git fetch
--quiet
origin
branches
=
"1.2_STABLE 1.3_STABLE master"
for
branch
in
${
branches
}
;
do
branchexists
=
`
git branch |
grep
"
${
branch
}
$"
`
if
[
-z
"
${
branchexists
}
"
]
;
then
git checkout
-b
${
branch
}
origin/
${
branch
}
else
git checkout
--quiet
${
branch
}
git reset
--hard
-q
origin/
${
branch
}
fi
remotecommit
=
`
git log
--pretty
=
format:
"%H"
|
head
-1
`
last
=
${
WORK
}
/
${
branch
}
.last
lastruncommit
=
z
if
[
-f
${
last
}
]
;
then
lastruncommit
=
`
cat
${
last
}
`
fi
if
[
"
$remotecommit
"
=
"
$lastruncommit
"
]
;
then
echo
"
${
branch
}
is up to date"
else
echo
"New commits on
${
branch
}
"
outputfile
=
${
OUT
}
/
${
branch
}
.pot
if
[
!
-d
${
GITDIR
}
/htdocs
]
;
then
echo
"No htdocs directory in branch
${
branch
}
; skipping."
continue
fi
find htdocs
-type
f
-path
"*lang/en.utf8*"
| xargs
tar
zcf
${
TEMP
}
/
${
branch
}
.tar.gz
if
[
!
-f
${
TEMP
}
/
${
branch
}
.tar.gz
]
;
then
echo
"Missing archive
${
TEMP
}
/
${
branch
}
.tar.gz; skipping."
continue
fi
langpack
=
${
TEMP
}
/
${
branch
}
[
!
-d
${
langpack
}
]
&&
mkdir
${
langpack
}
cd
${
langpack
}
tar
zxf ../
${
branch
}
.tar.gz
cd
${
GITDIR
}
if
[
!
-d
${
langpack
}
/htdocs
]
;
then
echo
"No htdocs directory in langpack
${
langpack
}
; skipping."
continue
fi
echo
"Updating
${
outputfile
}
"
[
-f
${
outputfile
}
]
&&
rm
${
outputfile
}
/usr/bin/php
${
SCRIPTS
}
/php-po.php
${
langpack
}
${
langpack
}
${
outputfile
}
echo
"
${
remotecommit
}
"
>
${
last
}
fi
done
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment