firefox-i18n update-lang-list: use package name as argument
While we're at it, stop create bogus symlink firefox-18n/firefox-18n The script always execute ln, if subpackages exists, ln will consider it's a directory, thus making firefox-i18n-<lang>/firefox-i18n symlink.
This commit is contained in:
parent
5afccc3765
commit
866d8c9320
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Usage: $0 <firefox|firefox-esr>
|
||||
# Copyright (c) 2019 Danh Doan
|
||||
# All rights reserved.
|
||||
#
|
||||
|
@ -13,20 +14,27 @@
|
|||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
version=$1
|
||||
pkg=${1:-firefox}
|
||||
tmpldir="$pkg-i18n"
|
||||
|
||||
esr=""
|
||||
[[ $version =~ esr$ ]] && esr="-esr"
|
||||
|
||||
tmpldir="firefox${esr}-i18n"
|
||||
case "${pkg}" in
|
||||
firefox-esr) esr=esr ;;
|
||||
firefox) : ;;
|
||||
*)
|
||||
echo "Usage: $0 <firefox|firefox-esr>" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
tmpoldfile="$(mktemp)"
|
||||
tmpnewfile="$(mktemp)"
|
||||
|
||||
xoldlangexpr="^_languages="
|
||||
|
||||
cd "$(xdistdir)/srcpkgs"
|
||||
source "${tmpldir}/template"
|
||||
|
||||
xlistold() {
|
||||
source "${tmpldir}/template"
|
||||
for _lang in "${_languages[@]}"; do
|
||||
_locale="${_lang%%\"*}"
|
||||
[ $_locale ] && echo "$_locale"
|
||||
|
@ -34,6 +42,7 @@ xlistold() {
|
|||
}
|
||||
|
||||
xlink () {
|
||||
test -L "$tmpldir-$1" ||
|
||||
ln -sf "$tmpldir" "$tmpldir-$1"
|
||||
}
|
||||
|
||||
|
@ -51,7 +60,7 @@ xnewlang () {
|
|||
}
|
||||
|
||||
xprocessnew() {
|
||||
while read lang; do
|
||||
while read -r lang; do
|
||||
printf '%-7s\n' $lang >&3
|
||||
xlink $lang
|
||||
xnewlang $lang
|
||||
|
@ -59,18 +68,16 @@ xprocessnew() {
|
|||
}
|
||||
|
||||
xcleanlang() {
|
||||
while read lang; do
|
||||
while read -r lang; do
|
||||
padded=$(printf '%-7s' $lang)
|
||||
sed -i "/'$padded\"/d" $tmpldir/template
|
||||
unlink "$tmpldir-$lang" || true
|
||||
done
|
||||
}
|
||||
|
||||
cd $(xdistdir)/srcpkgs
|
||||
|
||||
xlistold >| "$tmpoldfile"
|
||||
|
||||
curl "https://ftp.mozilla.org/pub/firefox/releases/$1/linux-i686/xpi/" \
|
||||
curl "https://ftp.mozilla.org/pub/firefox/releases/$version$esr/linux-i686/xpi/" \
|
||||
| grep -o 'xpi/[a-z]\+\(-[A-Z]\+\)\?' \
|
||||
| cut -d/ -f2 \
|
||||
| xprocessnew 3>$tmpnewfile
|
||||
|
|
Loading…
Reference in New Issue