Blame SOURCES/get-calendar-langpacks.sh

2acdd5
#!/bin/bash
2acdd5
#set -x
2acdd5
set -e
2acdd5
usage()
2acdd5
{
2acdd5
cat << EOF
2acdd5
usage: $0 options
2acdd5
2acdd5
This script downloads calendar langpacks for Thunderbird.
2acdd5
2acdd5
OPTIONS:
2acdd5
   -h      Show this message
2acdd5
   -v      Version string (7.0.1)
2acdd5
   -b      Build number (1, 2, 3)
2acdd5
   -r      Reuse downloaded files (when you don't want to redownload)
2acdd5
EOF
2acdd5
}
2acdd5
2acdd5
VER=
2acdd5
BUILDNUM=
2acdd5
LANG_DATE=`date "+%Y%m%d"`
2acdd5
while getopts “hv:b:r” OPTION
2acdd5
do
2acdd5
     case $OPTION in
2acdd5
         h)
2acdd5
             usage
2acdd5
             exit 1
2acdd5
             ;;
2acdd5
         v)
2acdd5
             VER=$OPTARG
2acdd5
             ;;
2acdd5
         b)
2acdd5
             BUILDNUM=$OPTARG
2acdd5
             ;;
2acdd5
         ?)
2acdd5
             usage
2acdd5
             exit
2acdd5
             ;;
2acdd5
     esac
2acdd5
done
2acdd5
2acdd5
if [ -z "$VER" -o -z "$BUILDNUM"  ]
2acdd5
then
2acdd5
     echo "Missing version or build number."
2acdd5
     usage
2acdd5
     exit 1
2acdd5
fi
2acdd5
2acdd5
WHITE='\033[1;33m'
2acdd5
NC='\033[0m' # No Color
2acdd5
2acdd5
LOCALES=`curl -f https://archive.mozilla.org/pub/thunderbird/candidates/$VER-candidates/build$BUILDNUM/linux-i686/ | grep "a href"|sed -e "s|.*/\([^/]*\)/\".*|\1|"|tail -n+2 |grep -v xpi`
2acdd5
#echo $LOCALES
2acdd5
rm -rf lightning-langpacks
2acdd5
mkdir -p lightning-langpacks
2acdd5
cd lightning-langpacks
2acdd5
LOCALE_COUNT=`echo $LOCALES| tr ' ' '\n' | wc -l`
2acdd5
LOCALE_NUM=0
2acdd5
for lang in $LOCALES; do
2acdd5
  LOCALE_NUM=$((LOCALE_NUM+1))
2acdd5
  echo -e "${WHITE}Processing calendar locale: $lang ($LOCALE_NUM/$LOCALE_COUNT)${NC}"
2acdd5
  mkdir -p extracted_lightning
2acdd5
  mkdir -p calendar-locales
2acdd5
  #echo Downloading TB binary for locale: $lang
2acdd5
  wget --quiet https://archive.mozilla.org/pub/thunderbird/candidates/$VER-candidates/build$BUILDNUM/linux-i686/$lang/thunderbird-$VER.tar.bz2
2acdd5
2acdd5
  cd extracted_lightning
2acdd5
  tar -xf ../thunderbird-$VER.tar.bz2 thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi
2acdd5
  set +e
2acdd5
  unzip -qq thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi
2acdd5
  set -e
2acdd5
  LIGHTNING_VERSION=`cat app.ini |grep "^Version="|sed -e 's/Version=//'`
2acdd5
  BUILD_ID=`cat app.ini |grep "^BuildID="|sed -e 's/BuildID=//'`
2acdd5
  MAX_VERSION=`cat app.ini |grep MaxVersion|sed -e s/MaxVersion=//`
2acdd5
  MIN_VERSION=`cat app.ini |grep MinVersion|sed -e s/MinVersion=//`
2acdd5
  rm -rf thunderbird
2acdd5
  mkdir -p ../calendar-locales/chrome
2acdd5
  cp -r chrome/calendar-$lang ../calendar-locales/chrome
2acdd5
  cp -r chrome/lightning-$lang ../calendar-locales/chrome
2acdd5
  cd -
2acdd5
2acdd5
  cd calendar-locales
2acdd5
  # create manifest
2acdd5
  cat > manifest.json <
2acdd5
{
2acdd5
  "languages": {
2acdd5
    "$lang": {
2acdd5
      "chrome_resources": {
2acdd5
        "calendar": "chrome/calendar-$lang/locale/$lang/calendar/",
2acdd5
        "lightning": "chrome/lightning-$lang/locale/$lang/lightning/"
2acdd5
      },
2acdd5
      "version": "$LIGHTNING_VERSION"
2acdd5
    }
2acdd5
  },
2acdd5
  "applications": {
2acdd5
    "gecko": {
2acdd5
      "strict_min_version": "$MIN_VERSION",
2acdd5
      "id": "langpack-cal-$lang@lightning.mozilla.org",
2acdd5
      "strict_max_version": "$MAX_VERSION"
2acdd5
    }
2acdd5
  },
2acdd5
  "langpack_id": "$lang",
2acdd5
  "version": "7.$LIGHTNING_VERSION.$BUILD_ID",
2acdd5
  "name": "$lang Language Pack Calendar",
2acdd5
  "manifest_version": 2,
2acdd5
  "sources": {
2acdd5
    "browser": {
2acdd5
      "base_path": "browser/"
2acdd5
    }
2acdd5
  },
2acdd5
  "author": "Mozilla.cz (contributors: Pavel Cvrček, Pavel Franc, Michal Stanke, Michal Vašíček)",
2acdd5
  "description": "Language pack for Thunderbird for $lang, this was repacked by Fedora/RHEL package maintainer from original binaries."
2acdd5
}
2acdd5
2acdd5
EOL
2acdd5
  zip --quiet -r ../langpack-cal-$lang@lightning.mozilla.org.xpi *
2acdd5
  cd -
2acdd5
  rm -rf calendar-locales
2acdd5
  rm -rf extracted_lightning
2acdd5
2acdd5
  rm -f thunderbird-$VER.tar.bz2
2acdd5
done
2acdd5
echo "Creating lightning-langpacks-$VER.tar.xz..."
2acdd5
tar cJf ../lightning-langpacks-$VER.tar.xz *.xpi
2acdd5
cd ..
2acdd5
rm -rf lightning-langpacks