controls: add shortcut keys for a bunch of items
[chrome-ext/music-player-client.git] / makedist.sh
CommitLineData
50dafc4c
MF
1#!/bin/bash -e
2# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6case $1 in
7-h|--help)
8 echo "Usage: $0 [rev]"
9 exit 0
10 ;;
11esac
12
13json_value() {
14 local key=$1
15 sed -n -r \
16 -e '/^[[:space:]]*"'"${key}"'"/s|.*:[[:space:]]*"([^"]*)",?$|\1|p' \
17 manifest.json
18}
19
20PN=$(json_value name | sed 's:[[:space:]]:_:g' | tr '[:upper:]' '[:lower:]')
21PV=$(json_value version)
22rev=${1:-0}
23PVR="${PV}.${rev}"
24P="${PN}-${PVR}"
25
26rm -rf "${P}"
27mkdir "${P}"
28
29while read line ; do
30 [[ ${line} == */* ]] && mkdir -p "${P}/${line%/*}"
31 ln "${line}" "${P}/${line}"
32done < <(sed 's:#.*::' manifest.files)
77c46373
MF
33cp Makefile manifest.files manifest.json "${P}/"
34
35make -C "${P}" -j js-min
36while read line ; do
37 mv "${line}.min" "${line}"
38done < <(find "${P}" -name '*.js')
39rm "${P}"/{manifest.files,Makefile}
50dafc4c
MF
40
41sed -i \
42 -e '/"version"/s:"[^"]*",:"'${PVR}'",:' \
43 "${P}/manifest.json"
44
45zip="${P}.zip"
46zip -r "${zip}" "${P}"
47rm -rf "${P}"
48du -b "${zip}"