forked from Qu-Bit-Electronix/QB_Nebulae_V2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_fw_update.sh
52 lines (50 loc) · 1.24 KB
/
create_fw_update.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
40
41
42
43
44
45
46
47
48
49
50
51
################################################
# Create Firmware Update File for the Nebulae
#
# Nebulae expects a file called "neb_update.zip"
#
# Using the .zip extension was an oversight,
# but the check_firmware.sh on the Nebulae
# is not user-updateable
################################################
echo "Creating Nebulae Firmware Update"
# Get Current Location
dir="$(pwd)"
# Create Temp Locations
mkdir -p temp/
# Move to Temp Location
cd temp/
# Copy Code/ contents to new directory structure
mkdir -p QB_Nebulae_V2/
cp -R ../Code/ QB_Nebulae_V2/
# Go through, and strip any unwanted line endings.
SEARCHDIR=./QB_Nebulae_V2/Code
for f in $SEARCHDIR/* $SEARCHDIR/**/*
do
if [ -d "$f" ]
then
for ff in $f/*
do
if [ -f "$f" ]
then
echo "Stripping File of carriage returns: $f"
dos2unix $f
fi
done
else
if [ -f "$f" ]
then
echo "Stripping File of carriage returns: $f"
dos2unix $f
fi
fi
done
# Create Update File
tar -czf neb_update.zip QB_Nebulae_V2
# Copy Update File to user directory
cp neb_update.zip $dir
# Return to user directory
cd $dir;
# Erase Temp Files
rm -r temp/
echo "Done."