Debian Codegraph @

build.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 BUILD_FOLDER=build
3 VERSION=$(catscip-shell system . . cat. core/banner.go | grepscip-shell system . . grep. Version | cutscip-shell system . . cut. -d '"' -f 2)
4
5 bin_depscip-shell shell shell-project 0.0.0 bin_dep().() {
6 BIN=$1
7 whichscip-shell system . . which. $BIN > /dev/nullscip-shell filesystem . . `/dev/null`. || { echoscip-shell system . . echo. "@ Dependency $BIN not found !"; exit 1; }
8 }
9
10 host_depscip-shell shell shell-project 0.0.0 host_dep().() {
11 HOST=$1
12 ping -c 1 $HOST > /dev/nullscip-shell filesystem . . `/dev/null`. || { echoscip-shell system . . echo. "@ Virtual machine host $HOST not visible !"; exit 1; }
13 }
14
15 create_exe_archivescip-shell shell shell-project 0.0.0 create_exe_archive().() {
16 bin_depscip-shell shell shell-project 0.0.0 bin_dep(). 'zip'
17
18 OUTPUT=$1
19
20 echoscip-shell system . . echo. "@ Creating archive $OUTPUT ..."
21 zip -j "$OUTPUT" bettercap.exe ../README.md ../LICENSE.md > /dev/nullscip-shell filesystem . . `/dev/null`.
22 rmscip-shell system . . rm. -rf bettercap bettercap.exe
23 }
24
25 create_archivescip-shell shell shell-project 0.0.0 create_archive().() {
26 bin_depscip-shell shell shell-project 0.0.0 bin_dep(). 'zip'
27
28 OUTPUT=$1
29
30 echoscip-shell system . . echo. "@ Creating archive $OUTPUT ..."
31 zip -j "$OUTPUT" bettercap ../README.md ../LICENSE.md > /dev/nullscip-shell filesystem . . `/dev/null`.
32 rmscip-shell system . . rm. -rf bettercap bettercap.exe
33 }
34
35 build_linux_amd64scip-shell shell shell-project 0.0.0 build_linux_amd64().() {
36 echoscip-shell system . . echo. "@ Building linux/amd64 ..."
37 goscip-shell system . . go. build -o bettercap ..
38 }
39
40
41 build_linux_armv6lscip-shell shell shell-project 0.0.0 build_linux_armv6l().() {
42 host_depscip-shell shell shell-project 0.0.0 host_dep(). 'arc.local'
43
44 DIR=/home/pi/gocode/src/github.com/bettercap/bettercapscip-shell filesystem . . `/home/pi/gocode/src/github.com/bettercap/bettercap`.
45
46 echoscip-shell system . . echo. "@ Updating repo on arm6l host ..."
47 sshscip-shell system . . ssh. [email protected] "cd $DIR && rm -rf '$OUTPUT' && git checkout . && git checkout master && git pull" > /dev/nullscip-shell filesystem . . `/dev/null`.
48
49 echoscip-shell system . . echo. "@ Building linux/armv6l ..."
50 sshscip-shell system . . ssh. [email protected] "export GOPATH=/home/pi/gocode && cd '$DIR' && PATH=$PATH:/usr/local/bin && go get ./... && go build -o bettercap ." > /dev/nullscip-shell filesystem . . `/dev/null`.
51
52 scpscip-shell system . . scp. -C [email protected]:$DIR/bettercap . > /dev/nullscip-shell filesystem . . `/dev/null`.
53 }
54
55 build_macos_amd64scip-shell shell shell-project 0.0.0 build_macos_amd64().() {
56 host_depscip-shell shell shell-project 0.0.0 host_dep(). 'osxvm'
57
58 DIR=/Users/evilsocket/gocode/src/github.com/bettercap/bettercapscip-shell filesystem . . `/Users/evilsocket/gocode/src/github.com/bettercap/bettercap`.
59
60 echoscip-shell system . . echo. "@ Updating repo on MacOS VM ..."
61 sshscip-shell system . . ssh. osxvm "cd $DIR && rm -rf '$OUTPUT' && git checkout . && git checkout master && git pull" > /dev/nullscip-shell filesystem . . `/dev/null`.
62
63 echoscip-shell system . . echo. "@ Building darwin/amd64 ..."
64 sshscip-shell system . . ssh. osxvm "export GOPATH=/Users/evilsocket/gocode && cd '$DIR' && PATH=$PATH:/usr/local/bin && go get ./... && go build -o bettercap ." > /dev/nullscip-shell filesystem . . `/dev/null`.
65
66 scpscip-shell system . . scp. -C osxvm:$DIR/bettercap . > /dev/nullscip-shell filesystem . . `/dev/null`.
67 }
68
69 build_windows_amd64scip-shell shell shell-project 0.0.0 build_windows_amd64().() {
70 host_depscip-shell shell shell-project 0.0.0 host_dep(). 'winvm'
71
72 DIR=c:/Users/evilsocket/gopath/src/github.com/bettercap/bettercap
73
74 echoscip-shell system . . echo. "@ Updating repo on Windows VM ..."
75 sshscip-shell system . . ssh. winvm "cd $DIR && git checkout . && git checkout master && git pull && go get ./..." > /dev/nullscip-shell filesystem . . `/dev/null`.
76
77 echoscip-shell system . . echo. "@ Building windows/amd64 ..."
78 sshscip-shell system . . ssh. winvm "cd $DIR && go build -o bettercap.exe ." > /dev/nullscip-shell filesystem . . `/dev/null`.
79
80 scpscip-shell system . . scp. -C winvm:$DIR/bettercap.exe . > /dev/nullscip-shell filesystem . . `/dev/null`.
81 }
82
83 build_android_armscip-shell shell shell-project 0.0.0 build_android_arm().() {
84 host_depscip-shell shell shell-project 0.0.0 host_dep(). 'shield'
85
86 BASE=/data/data/com.termux/filesscip-shell filesystem . . `/data/data/com.termux/files`.
87 THEPATH="$BASE/usr/bin:$BASE/usr/bin/applets:/system/xbin:/system/bin"
88 LPATH="$BASE/usr/lib"
89 GPATH=$BASE/home/go
90 DIR=$GPATH/src/github.com/bettercap/bettercap
91
92 echoscip-shell system . . echo. "@ Updating repo on Android host ..."
93 sshscip-shell system . . ssh. -p 8022 root@shield "su -c 'export PATH=$THEPATH && export LD_LIBRARY_PATH="$LPATH" && cd "$DIR" && rm -rf bettercap* && git pull && export GOPATH=$GPATH && go get ./...'"
94
95 echoscip-shell system . . echo. "@ Building android/arm ..."
96 sshscip-shell system . . ssh. -p 8022 root@shield "su -c 'export PATH=$THEPATH && export LD_LIBRARY_PATH="$LPATH" && cd "$DIR" && export GOPATH=$GPATH && go build -o bettercap . && setenforce 0'"
97
98 echoscip-shell system . . echo. "@ Downloading bettercap ..."
99 scpscip-shell system . . scp. -C -P 8022 root@shield:$DIR/bettercap .
100 }
101
102 rmscip-shell system . . rm. -rf $BUILD_FOLDER
103 mkdirscip-shell system . . mkdir. $BUILD_FOLDER
104 cd $BUILD_FOLDER
105
106 if [scip-shell system . . `[`. -z "$1" ]
107 then
108 WHAT=all
109 else
110 WHAT="$1"
111 fi
112
113 printfscip-shell system . . printf. "@ Building for $WHAT ...\n\n"
114
115 if [[ "$WHAT" == "all" || "$WHAT" == "linux_amd64" ]]; then
116 build_linux_amd64scip-shell shell shell-project 0.0.0 build_linux_amd64(). && create_archivescip-shell shell shell-project 0.0.0 create_archive(). bettercap_linux_amd64_$VERSION.zip
117 fi
118
119 if [[ "$WHAT" == "all" || "$WHAT" == "linux_armv6l" ]]; then
120 build_linux_armv6lscip-shell shell shell-project 0.0.0 build_linux_armv6l(). && create_archivescip-shell shell shell-project 0.0.0 create_archive(). bettercap_linux_armv6l_$VERSION.zip
121 fi
122
123 if [[ "$WHAT" == "all" || "$WHAT" == "osx" || "$WHAT" == "mac" || "$WHAT" == "macos" ]]; then
124 build_macos_amd64scip-shell shell shell-project 0.0.0 build_macos_amd64(). && create_archivescip-shell shell shell-project 0.0.0 create_archive(). bettercap_macos_amd64_$VERSION.zip
125 fi
126
127 if [[ "$WHAT" == "all" || "$WHAT" == "win" || "$WHAT" == "windows" ]]; then
128 build_windows_amd64scip-shell shell shell-project 0.0.0 build_windows_amd64(). && create_exe_archivescip-shell shell shell-project 0.0.0 create_exe_archive(). bettercap_windows_amd64_$VERSION.zip
129 fi
130
131 if [[ "$WHAT" == "all" || "$WHAT" == "android" ]]; then
132 build_android_armscip-shell shell shell-project 0.0.0 build_android_arm(). && create_archivescip-shell shell shell-project 0.0.0 create_archive(). bettercap_android_armv7l_$VERSION.zip
133 fi
134
135 sha256sumscip-shell system . . sha256sum. * > checksums.txt
136
137 echoscip-shell system . . echo.
138 echoscip-shell system . . echo.
139 duscip-shell system . . du. -sh *
140
141 cd --