diff --git a/langpacks.sh b/langpacks.sh --- a/langpacks.sh +++ b/langpacks.sh @@ -1,33 +1,123 @@ #!/bin/bash - -VERSION="60.4.0" +# Insired largely by Fedora +set -e +VER=$1 +RELURL="https://ftp.mozilla.org/pub/thunderbird/releases" ARCH="x86_64" -URL="https://ftp.mozilla.org/pub/thunderbird/releases/${VERSION}/linux-${ARCH}/xpi/" -# Ensure we don't have a previous run living here -if [[ -e lang_pack ]]; then - rm -rvf lang_pack +if [[ ! $VER =~ ^[0-9]+(\.[0-9]+)*$ ]]; +then + echo "Usage: $0 " + echo "" + echo "Error: missing or invalid Thunderbird version number" + exit 1 fi -mkdir lang_pack +WHITE='\033[1;33m' +NC='\033[0m' # No Color + +echo -e "${WHITE}Processing Thunderbird langpacks${NC}" -pushd lang_pack +# Ensure we don't have a previous run living here +rm -rf thunderbird_langpacks +mkdir thunderbird_langpacks +cd thunderbird_langpacks -echo "mirror ." | lftp "${URL}" + wget --quiet -r -np -l1 -nd -A xpi $RELURL/$VER/linux-$ARCH/xpi/ -# Insired largely by Fedora -for i in *.xpi ; do + for i in *.xpi ; do ln="$(basename ${i} .xpi)" eid="langpack-${ln}@thunderbird.mozilla.org" - unzip $i -d "${eid}" - find "${eid}" -type f | xargs chmod 644 - pushd "${eid}" - zip -qq -r9mX "../${eid}.xpi" * - rm ../$i - popd + echo "Processing thunderbird locale: ${ln}" + unzip -qq $i -d "${eid}" + find "${eid}" -type f | xargs chmod 00644 + cd "${eid}" + zip -qq -r9mX "../${eid}.xpi" * + rm ../$i + cd .. rm -rf "${eid}" -done + done + + + echo -e "${WHITE}Processing Lightning langpacks${NC}" + + LOCALES=`curl -f $RELURL/$VER/linux-$ARCH/ | grep "a href"|sed -e "s|.*/\([^/]*\)/\".*|\1|"|tail -n+2 |grep -v xpi` + #echo $LOCALES + LOCALE_COUNT=`echo $LOCALES| tr ' ' '\n' | wc -l` + LOCALE_NUM=0 + for lang in $LOCALES; do + LOCALE_NUM=$((LOCALE_NUM+1)) + echo -e "${WHITE}Processing calendar locale: $lang ($LOCALE_NUM/$LOCALE_COUNT)${NC}" + mkdir -p extracted_lightning + mkdir -p calendar-locales + #echo Downloading TB binary for locale: $lang + wget --quiet $RELURL/$VER/linux-$ARCH/$lang/thunderbird-$VER.tar.bz2 + + cd extracted_lightning + tar -xf ../thunderbird-$VER.tar.bz2 thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi + set +e + unzip -qq thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi + set -e + LIGHTNING_VERSION=`cat app.ini |grep "^Version="|sed -e 's/Version=//'` + BUILD_ID=`cat app.ini |grep "^BuildID="|sed -e 's/BuildID=//'` + MAX_VERSION=`cat app.ini |grep MaxVersion|sed -e s/MaxVersion=//` + MIN_VERSION=`cat app.ini |grep MinVersion|sed -e s/MinVersion=//` + rm -rf thunderbird + mkdir -p ../calendar-locales/chrome + cp -r chrome/calendar-$lang ../calendar-locales/chrome + cp -r chrome/lightning-$lang ../calendar-locales/chrome + cd - + + cd calendar-locales + # create manifest + cat > manifest.json <