-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·39 lines (29 loc) · 1.3 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh -e
# Script to automatically download the project including all submodules
# It then zips the hardware add-on and calculate the SHA-256 and file size
# This is used with the Arduino Boards Manager
url=https://github.com/khairulhasanmd/USBino.git
hardware_add_on_path=avr
dir="$(cd "$(dirname "$0")" && pwd)"
echo "Working path: $dir"
name=$(echo $(echo $url | rev | cut -d'/' -f 1 | rev) | cut -d'.' -f 1)
echo "\nClone Project: $name\n"
git clone --depth 1 --single-branch -b master --recursive $url || exit 1
cd "$name"
echo "\nRemove git files"
find . -name .git | xargs rm -rf
find . -name .gitmodules | xargs rm -rf
find . -name .gitignore | xargs rm -rf
find . -name .gitattributes | xargs rm -rf
cd "$dir"
mv "$name/$hardware_add_on_path" "$dir/$name-hardware" # Rename avr directory and move out of folder
echo "Remove \"$name\" directory"
rm -rf $name
mv "$dir/$name-hardware" "$dir/$name" # Rename hardware directory to the original name
echo "ZIP hardware directory"
zip -rq "$name" "$name" # Zip the hardware add-on
echo "Remove hardware directory"
rm -rf "$name"
# Calculate SHA-256 and file size of hardware add-on used for "package_lauszus_sanguino_index.json"
echo \"checksum\": \"SHA-256:`shasum -a 256 $name.zip | awk '{print $1}'`\",
echo \"size\": \"`ls -l $name.zip | awk '{print $5}'`\",