| 1 |
#!/bin/bash -ex |
| 2 |
|
| 3 |
# pack.*.bash - Bash script to help packaging avr core releases. |
| 4 |
# Copyright (c) 2015 Arduino LLC. All right reserved. |
| 5 |
# |
| 6 |
# This library is free software; you can redistribute it and/or |
| 7 |
# modify it under the terms of the GNU Lesser General Public |
| 8 |
# License as published by the Free Software Foundation; either |
| 9 |
# version 2.1 of the License, or (at your option) any later version. |
| 10 |
# |
| 11 |
# This library is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
# Lesser General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU Lesser General Public |
| 17 |
# License along with this library; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
|
| 20 |
BUILD_NUMBER=$1 |
| 21 |
CURR_TIME=`date "+%Y-%m-%d %H:%M"` |
| 22 |
CURR_TIME_SED=`date "+%Y\\-%m\\-%d %H:%M"` |
| 23 |
VERSION=9.9.9-Hourly |
| 24 |
|
| 25 |
PWD=`pwd` |
| 26 |
FOLDERNAME=`basename $PWD` |
| 27 |
THIS_SCRIPT_NAME=`basename $0` |
| 28 |
FILENAME=package_avr-hourly-b${BUILD_NUMBER}.tar.bz2 |
| 29 |
|
| 30 |
rm -f $FILENAME |
| 31 |
|
| 32 |
# Change name in platform.txt |
| 33 |
sed -i "s/name=.*/name=SAMD Hourly Build ${BUILD_NUMBER} (${CURR_TIME})/" platform.txt |
| 34 |
|
| 35 |
cd .. |
| 36 |
tar --transform "s|$FOLDERNAME|avr-hourly_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME |
| 37 |
cd - |
| 38 |
|
| 39 |
mv ../$FILENAME . |
| 40 |
|
| 41 |
CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` |
| 42 |
SIZE=`wc -c $FILENAME | awk '{ print $1 }'` |
| 43 |
|
| 44 |
cat extras/package_index.json.Hourly.template | |
| 45 |
sed "s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/" | |
| 46 |
sed "s/%%CURR_TIME%%/${CURR_TIME_SED}/" | |
| 47 |
sed "s/%%VERSION%%/${VERSION}/" | |
| 48 |
sed "s/%%FILENAME%%/${FILENAME}/" | |
| 49 |
sed "s/%%CHECKSUM%%/${CHKSUM}/" | |
| 50 |
sed "s/%%SIZE%%/${SIZE}/" > package_avr-hourly-build_index.json |
| 51 |
|