-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate
executable file
·45 lines (37 loc) · 812 Bytes
/
create
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
#!/bin/bash
PREREQS=( "curl" "fpm" )
VERSION="3.4"
error() {
echo $1
exit 1
}
check_prereq() {
local PACKAGE=$1
which $PACKAGE >/dev/null || error "$PACKAGE is missing"
}
download() {
local URL="http://download2.mikrotik.com/routeros/winbox/$VERSION/winbox.exe"
if [ ! -f package_root/opt/winbox/bin/winbox.exe ]; then
curl -s --head --fail --connect-timeout 2 "$URL" -o /dev/null || error "${URL} does not exist"
curl -sLo package_root/opt/winbox/bin/winbox.exe ${URL}
fi
}
create_package() {
fpm -s dir -t deb -n winbox \
--version "$VERSION" \
--after-install scripts/after-install \
--depends "wine" \
--exclude *.gitignore \
-C package_root \
opt tmp
}
cleanup() {
rm -rf package_root/opt/winbox/bin/*
}
for PREREQ in ${PREREQS[@]}
do
check_prereq $PREREQ
done
download
create_package
cleanup