forked from bacnet-stack/bacnet-stack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
executable file
·110 lines (97 loc) · 3.11 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
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
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# script adapted from
# https://sourceforge.net/p/forge/documentation/Using%20the%20Release%20API/
# sudo apt-get update -qq
# sudo apt-get install -qq build-essential mingw-w64 curl git
#
# Prior to running this script, be sure to:
# a) update CHANGELOG and version.h with new version number, and commit changes.
# b) git tag to bacnet-stack-x.y.z where x.y.z is the new version number
# c) create long term branch as bacnet-stack-x.y if needed
USERNAME='skarg'
if [ -z "$1" ]
then
echo "Usage: `basename $0` 0.0.0"
echo "Builds the Win32 release files, archives the source, and uploads them to sf.net"
exit 1
fi
version="$1"
tools="bacnet-tools-$version"
tag_name="bacnet-stack-$version"
url_api='https://sourceforge.net/projects/bacnet/files'
url_frs="${USERNAME},bacnet@frs.sourceforge.net:/home/frs/project/b/ba/bacnet"
url_frs_tools="$url_frs/bacnet-tools"
url_frs_source="$url_frs/bacnet-stack"
function bacnet_build() {
echo ""
echo "Build Win32 Apps"
export CC=i686-w64-mingw32-gcc
export LD=i686-w64-mingw32-ld
i686-w64-mingw32-gcc --version
make clean
make -s LEGACY=true win32
}
function bacnet_zip() {
echo "ZIP Win32 Tools"
mkdir -p $tools
cp ./bin/*.exe $tools
cp ./bin/bvlc.bat $tools
cp ./bin/readme.txt $tools
cp ./apps/mstpcap/mstpcap.txt $tools
zip -r $tools.zip $tools
rm $tools/*.exe
rm $tools/*.bat
mv $tools.zip $tools/$tools.zip
}
function bacnet_source() {
echo "ZIP Source Code for Tag $tag_name"
git archive --format zip --output $tag_name.zip $tag_name
echo "TGZ Source Code for Tag $tag_name"
git archive --format tgz --output $tag_name.tgz $tag_name
mkdir -p $tag_name
mv $tag_name.zip $tag_name
mv $tag_name.tgz $tag_name
cp CHANGELOG.md $tag_name
cp README.md $tag_name
cp SECURITY.md $tag_name
}
function bacnet_upload() {
echo "Upload Win32 Tools with SCP"
scp -r $tools $url_frs_tools
echo "Upload Source Code with SCP"
scp -r $tag_name $url_frs_source
}
function bacnet_settings() {
echo "Set the default download for Windows and POSIX"
api_key=""api_key=$SOURCEFORGE_RELEASE_API_KEY_SKARG""
default_win='"default=windows"'
default_posix='"default=mac&default=linux&default=bsd&default=solaris&default=others"'
accept='"Accept: application/json"'
url_tools="$url_api/bacnet-tools/$tools/$tools.zip"
url_source="$url_api/bacnet-stack/$tag_name/$tag_name.tgz"
curl -H $accept -X PUT -d $default_win -d $api_key $url_tools
curl -H $accept -X PUT -d $default_posix -d $api_key $url_source
}
menu(){
echo -ne "
BACnet Stack Release Steps
1) Build BACnet apps for Win32
2) Zip BACnet apps for Win32
3) Archive BACnet source code
4) Upload files to bacnet.sf.net
5) Configure bacnet.sf.net download settings
0) Exit
Choose an option: "
read a
case $a in
1) bacnet_build ; menu ;;
2) bacnet_zip ; menu ;;
3) bacnet_source ; menu ;;
4) bacnet_upload ; menu ;;
5) bacnet_settings ; menu ;;
0) exit 0 ;;
*) echo -e $red"Invalid option."$clear; WrongCommand;;
esac
}
# Call the menu function
menu