-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·88 lines (66 loc) · 2.63 KB
/
build.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
#/bin/bash
# By Olivier FONTÈS <olivier@altsysnet.com>
# This script has the purpose to build a wifirover version
# For every architectures
DPKGDEB="/usr/bin/dpkg-deb";
RSYNC="/usr/bin/rsync -a";
DEST=build_`cat common/etc/version_wr`
VERSION_WR=$(cat ../wifirover/common/etc/version_wr)
#Excluding .gitignore files
EXCLUDE='--exclude=.git';
for i in `cat .gitignore`; do
EXCLUDE="${EXCLUDE} --exclude=$i";
done
# Cleaning tmp files
rm -rf ${DEST}
echo "Generating Debian packages" > /dev/stderr
# Export of Debian tree
mkdir -p ${DEST}/wifirover_debian ${DEST}/wifirover_edgerouter
# Mergin with common directory
$RSYNC $EXCLUDE common/* ${DEST}/wifirover_debian
# Adding OS specific files
$RSYNC $EXCLUDE debian/* ${DEST}/wifirover_debian
# Building debian package
$DPKGDEB --build ${DEST}/wifirover_debian
# Mergin with common directory
$RSYNC $EXCLUDE common/* ${DEST}/wifirover_edgerouter
# Adding OS specific files
$RSYNC $EXCLUDE edgerouter/* ${DEST}/wifirover_edgerouter
# Building EdgeOS package
$DPKGDEB --build ${DEST}/wifirover_edgerouter
rm -rf $DEST/wifirover_debian $DEST/wifirover_edgerouter
echo "Generating LEDE package" > /dev/stderr
# Creating tmp directory
mkdir -p ${DEST}/lede/ipk
# Mergin with common directory
$RSYNC $EXCLUDE common/* ${DEST}/lede/ipk
# Adding arch specific files
$RSYNC $EXCLUDE openwrt/* ${DEST}/lede/ipk
tar czf $DEST/lede/data.tar.gz -C $DEST/lede/ipk .
cat > $DEST/lede/control << EOF
Package: wifirover
Version: $(cat common/etc/version_wr)
Description: WifiRover Captive portal
Section: extras
Priority: optional
Maintainer: Olivier Fontes <olivier@altsysnet.com>, Sebastien DA ROCHA <sebastien@altsysnet.com>
License: LGPL 2.1
Architecture: all
OE: wifirover
Source: https://github.com/altsysnet/wifirover
Depends: firewall, base-files, base-files, php7, dnsmasq-full
Replaces: firewall, base-files, base-files, php7, dnsmasq-full
EOF
cat > $DEST/lede/conffiles << EOF
/etc/wifi_rover.conf
EOF
tar czf $DEST/lede/control.tar.gz -C $DEST/lede/ control conffiles
echo 2.0 > $DEST/lede/debian-binary
tar czf $DEST/lede/wifirover_${VERSION_WR}.ipk -C $DEST/lede control.tar.gz data.tar.gz debian-binary > /dev/null
# Append info to Packages
cat $DEST/lede/control >> $DEST/lede/Packages
md5sum -b $DEST/lede/wifirover_${VERSION_WR}.ipk | awk '{ print "MD5Sum: " $1 }' >> $DEST/lede/Packages
wc -c $DEST/lede/wifirover_${VERSION_WR}.ipk | awk '{ print "Size: " $1 }' >> $DEST/lede/Packages
echo "Filename: wifirover_${VERSION_WR}.ipk" >> $DEST/lede/Packages
echo "" >> $DEST/lede/Packages
rm -rf $DEST/lede/control.tar.gz $DEST/lede/data.tar.gz $DEST/lede/debian-binary $DEST/lede/control $DEST/lede/conffiles $DEST/lede/ipk