~ubuntu-html5-theme-devs/ubuntu-html5-theme/trunk

« back to all changes in this revision

Viewing changes to ubuntu-html5-theme

  • Committer: CI Train Bot
  • Author(s): David Barth
  • Date: 2015-05-20 16:51:30 UTC
  • mfrom: (200.5.1 ubuntu-html5-theme)
  • Revision ID: ci-train-bot@canonical.com-20150520165130-c6c81yc2exh2wrly
Add a command line tool to maintain a theme installation in an html5 project Fixes: #1451937

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
OUTDIR="$(pwd)"
 
4
WORKDIR=$(mktemp -d)
 
5
 
 
6
cleanup()
 
7
{
 
8
        rm -rf $WORKDIR
 
9
        rm -f .ubuntu-html5-theme.releases-list
 
10
}
 
11
 
 
12
trap cleanup EXIT INT QUIT ILL KILL SEGV TERM
 
13
 
 
14
 
 
15
list_releases() {
 
16
        wget -q -O ./.ubuntu-html5-theme.releases-list https://code.launchpad.net/ubuntu-html5-theme
 
17
        cat .ubuntu-html5-theme.releases-list | \
 
18
                grep lp:ubuntu | \
 
19
                grep ~ubuntu-html5-theme-devs | \
 
20
                awk '{match($0, /~ubuntu-html5-theme-devs\/ubuntu-html5-theme\/([^\"]*)/, releases); print releases[1]}'
 
21
}
 
22
 
 
23
download() {
 
24
        rel=$1
 
25
        echo "Downloading release $rel..."
 
26
        bzr branch https://code.launchpad.net/~ubuntu-html5-theme-devs/ubuntu-html5-theme/$1 $WORKDIR/$rel
 
27
        if [ "$?" -ne 0 ]; then
 
28
                echo "Unable to download release $rel"
 
29
                exit 1
 
30
        fi
 
31
}
 
32
 
 
33
do_install_theme() {
 
34
        if [ ! -d $OUTDIR/www ]; then
 
35
                echo "No 'www' folder found in the current directory"
 
36
                echo "Exiting..."
 
37
                exit 1
 
38
        fi
 
39
        if [ -d $OUTDIR/ambiance ]; then
 
40
                echo "There is already an 'ambiance' folder in the project directory"
 
41
                echo "Exiting..."
 
42
                exit 1
 
43
        fi
 
44
        download $1
 
45
        mv $WORKDIR/$1/0.1/ambiance $OUTDIR/www
 
46
}
 
47
 
 
48
do_convert_project() {
 
49
        if [ ! -e $OUTDIR/www/index.html ]; then
 
50
                echo "No index.html found in the 'www' folder"
 
51
                echo "Exiting..."
 
52
                exit 1
 
53
        fi
 
54
        sed -i 's:/usr/share/ubuntu-html5-ui-toolkit/0.1/::' $OUTDIR/www/index.html
 
55
}
 
56
 
 
57
case "$1" in
 
58
install)
 
59
        do_install_theme $2
 
60
        ;;
 
61
convert)
 
62
        do_convert_project
 
63
        ;;
 
64
list)
 
65
        list_releases
 
66
        ;;
 
67
update)
 
68
        echo "Not implemented..."
 
69
        exit 1
 
70
        ;;
 
71
*)
 
72
        echo "Usage: $0 {list|install <release>|convert|update}"
 
73
        exit 1
 
74
esac