fr: synchronize with enc 637d334.
[enc-live.git] / copy-enc-to-live
CommitLineData
b15f36c3
TG
1#! /bin/bash
2
3# Copy Email Self-Defense translations locally from enc to enc-live.
4# and update the language pickers.
5# The two repos are assumed to have the same parent directory.
6# The script is called from the root of enc-live:
7# copy-enc-to-live LANG
8
9# ***** Check that lang-picker-source is up to date. *****
10
11set -e
12
13lang=$1
14pages='confirmation.html index.html infographic.html next_steps.html workshops.html'
15
16test -n "$lang" || (echo " !!! Please enter a language code as argument.";
17 exit 1)
18
19# The files we need are on the master branch of enc.
20cd ../enc
21git co master
22# Get the ID of the last commit on this branch for future reference, and
23# truncate it to 7 digits.
24commit=$(git rev-parse HEAD | cut -b -7)
25
26# Go back to enc-live.
27cd ../enc-live
28# Create the LANG directory if it doesn't exist.
29mkdir -p $lang
30
31# Take one page at a time.
32for p in $pages; do
33 echo $lang/$p
34 # If it exists in enc,
35 if [ -f ../enc/$lang/$p ]; then
36 # copy it to enc-live.
37 cp ../enc/$lang/$p $lang/
38 # If not...
39 else
40 # say so,
41 echo " !!! $lang/$p doesn't exist"
42 # restore enc-live to its original state,
43 git reset --hard HEAD
44 # and quit.
45 exit 1
46 fi
47done
48
49# Add and commit the changes.
50git add $lang
51# Refer to the enc commit ID in the enc-live commit message.
52git commit -m "$lang: synchronize with enc $commit."
53
54replace-lang-picker
0260d901
TG
55git commit --amend
56