~dholbach/help-app/1434125

« back to all changes in this revision

Viewing changes to internals/web-publish

  • Committer: Daniel Holbach
  • Date: 2015-03-20 14:00:47 UTC
  • Revision ID: daniel.holbach@canonical.com-20150320140047-1ogesh63gjr21poo
use trap (http://redsymbol.net/articles/bash-exit-traps/), thanks mvo! don't test rc of 'bzr commit', we use 'set -e' already

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh -e
2
2
 
 
3
finish() {
 
4
        cd "$workingdir" && rm -r "$tempdir"
 
5
}
 
6
 
 
7
workingdir=$(pwd)
 
8
tempdir=$(mktemp -d)
 
9
trap finish EXIT INT
 
10
 
3
11
web_branch="lp:~help-app-dev/help-app/help-app-web"
4
12
outputdir_web=$(cd .. && make print-OUTPUTDIR_WEB | cut -d'=' -f2)
5
13
current_rev=$(bzr revno)
6
 
workingdir=$(pwd)
7
14
 
8
 
tempdir=$(mktemp -d)
9
15
cd "$tempdir"
10
16
bzr branch "$web_branch" output-web
11
17
 
12
18
cd output-web; bzr import "$outputdir_web"
13
19
 
14
20
bzr commit -m "Update content (rev $current_rev)" -q
15
 
rc=$?; if [ $rc = 0 ]; then
16
 
        bzr push :parent
17
 
fi
18
 
 
19
 
cd "$workingdir" && rm -r "$tempdir"
 
21
bzr push :parent