-
Notifications
You must be signed in to change notification settings - Fork 2
/
Build-UBNT.sh
executable file
·101 lines (72 loc) · 2.49 KB
/
Build-UBNT.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /bin/sh
# Build script for UBNT devices
echo ""
# Check to see if setup script has already run
if [ ! -f ./already_configured ]; then
echo "Build environment not configured. Quitting now"
exit
else
echo "Build environment is configured. Continuing with build"
echo ""
fi
#########################
echo "Start build process"
# Set up version strings
VER="Version 2.0 Beta 1e (r34386)"
DIRVER="Beta-1e"
###########################
echo "Copy files from Git repo into build folder"
rm -r ./SECN-build/files/*
cp -r -f ~/Git/SECN2-test/SECN-build/* ./SECN-build/
###########################
echo "Set up new directory name with date and version"
DATE=`date +%Y-%m-%d-%H:%M`
DIR=$DATE"-UBNT-"$DIRVER
###########################
# Set up build directory
echo "New build directory ./bin/ar71xx/builds/build-"$DIR
mkdir ./bin/ar71xx/builds/build-$DIR
# Create md5sums file
touch ./bin/ar71xx/builds/build-$DIR/md5sums
###########################
echo '----------------------------'
echo "Set up files for Ubiquity AR71xx"
DEVICE="Ubiquity AR71xx"
rm -r ./files/*
cp -r ./SECN-build/files . ; echo "Copy generic files"
cp -r ./SECN-build/UBNT/files . ; echo "Overlay device specific files"
./FactoryRestore.sh ; echo "Build Factory Restore tar file"
echo "Check files "
ls -al ./files
echo ""
# Set up version file
echo "Version: " $VER $DEVICE
echo $VER " " $DEVICE > ./files/etc/secn_version
echo "Date stamp the version file: " $DATE
echo "Build date " $DATE >> ./files/etc/secn_version
echo " " >> ./files/etc/secn_version
echo "Set up .config for UBNT"
rm ./.config
cp ./SECN-build/UBNT/.config ./.config
make defconfig > /dev/null
## Use for first build on a new revision to update .config file
cp ./.config ./SECN-build/UBNT/.config
echo "Check .config version"
cat ./.config | grep "OpenWrt version"
echo "Check banner version"
cat ./files/etc/secn_version | grep "Version"
echo ""
echo "Run make for UBNT"
make
echo "Move files to build folder" ##############
mv ./bin/ar71xx/*-squash*sysupgrade.bin ./bin/ar71xx/builds/build-$DIR
mv ./bin/ar71xx/*-squash*factory.bin ./bin/ar71xx/builds/build-$DIR
echo "Update md5sums"
cat ./bin/ar71xx/md5sums | grep "squashfs" | grep ".bin" >> ./bin/ar71xx/builds/build-$DIR/md5sums
cat ./bin/ar71xx/md5sums | grep "lzma" >> ./bin/ar71xx/builds/build-$DIR/md5sums
echo "Clean up unused files"
rm ./bin/ar71xx/openwrt-*
echo ""
echo "End Ubiquity AR71xx build"
echo ""
#exit