1#!/bin/bash
2# This script packages the ADK1 files into a downloadable zip
3# by Joe Fernandez, June 2012
4#
5# creates a zip for downloading with the following structure:
6# /app (demokit Android app)
7# /arduino_libs
8#   /AndroidAccessory
9#     /examples/demokit (added here for ease of use with Arduino)
10#   /USB_Host_Shield
11# /hardware
12# COPYING
13# README
14
15
16# Generic pause function
17function pause {
18    read -p " Press Enter to continue..."
19}
20
21# move up to accessory directory
22cd ..
23
24# Main execution
25dateStamp=`date +"%Y%m%d"`
26
27# create the directory structure
28mkdir -p ADK_release_${dateStamp}/arduino_libs/AndroidAccessory/examples
29
30# move the demokit firmware into the AndroidAccessory library,
31# so that it shows up in the Arduino IDE menus:
32cp -r demokit/firmware/* ADK_release_${dateStamp}/arduino_libs/AndroidAccessory/examples
33
34# copy in the app and hardware files
35cp -r demokit/app ADK_release_${dateStamp}
36cp -r demokit/hardware ADK_release_${dateStamp}
37
38# copy in the README and license info
39cp demokit/COPYING ADK_release_${dateStamp}
40cp demokit/README ADK_release_${dateStamp}
41
42# copy in the Arduino libraries and remove the make file
43cp -r arduino/* ADK_release_${dateStamp}/arduino_libs
44rm -f ADK_release_${dateStamp}/arduino_libs/Android.mk
45
46echo "packaged directories assembled. Next: create zip"
47#pause
48
49# create the zip download
50if [ -e ADK_release_${dateStamp}.zip ]; then
51    rm -f ADK_release_${dateStamp}.zip
52fi
53zip -r ADK_release_${dateStamp}.zip ADK_release_${dateStamp}/*
54
55echo "download zip assembled. Next: remove package directories"
56#pause
57
58rm -rf ADK_release_${dateStamp}
59
60
61
62