-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·137 lines (119 loc) · 4.97 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
rm -rf build
if [ "$2." != "--no-frontend." ] ; then
cd frontend
npm run build || exit 1
cd ..
fi
if [ "$1." == "arm." ] ; then
export CC="/usr/bin/arm-linux-gnueabihf-gcc -mfloat-abi=hard -mfpu=fp-armv8 -lwiringPi"
corral run -- ponyc -Dwiringpi -Dopenssl_1.1.x --cpu=cortex-a53 --triple="arm-unknown-linux-gnueabihf" --link-arch=armv8-a --linker=clang-17
if [ "$2." == "release." ] ; then
export VERSION=`git tag | grep ^v | sort -r | head -1 | sed 's/v//' `
echo "Building pinkweb_$VERSION"
mkdir -p build/pink2web_$VERSION/
cd build/pink2web_$VERSION/
mkdir -p DEBIAN
mkdir -p etc/systemd/system/
mkdir -p etc/pink2web/
mkdir -p usr/bin/
mkdir -p usr/local/lib/pink2web/bin/
mkdir -p var/lib/pink2web/processes/
mkdir -p var/lib/pink2web/hist
mkdir -p var/lib/pink2web/stores
mkdir -p var/www/pink2web
cd -
echo "Source: pink2web
Section: other
Priority: optional
Maintainer: Niclas Hedhman <niclas@bali.io>
Uploaders:
Version: $VERSION
Standards-Version: 3.8.3
Package: pink2web
Homepage:
Architecture: armhf
Distribution:
Depends: wiringpi, python-serial
Description: pink2web is a block programming platform, intended for IoT and automation systems.
" >build/pink2web_$VERSION/DEBIAN/control
echo "[Unit]
Description=Pink2Web block programming platform. Contact Bali Automation (https://bali.io) for more information.
[Service]
User=pink2web
Group=nogroup
EnvironmentFile=-/etc/default/pink2web
ExecStart=/usr/local/lib/pink2web/bin/pink2web --info run process --host=0.0.0.0 --startpage=pink2web.html --webdir=/var/www/pink2web /var/lib/pink2web/applications/main.json
Restart=on-failure
[Install]
WantedBy=multi-user.target" >build/pink2web_$VERSION/usr/local/lib/pink2web/bin/pink2web.service
cp pink2web build/pink2web_$VERSION/usr/local/lib/pink2web/bin/pink2web
cp -r frontend/dist/* build/pink2web_$VERSION/var/www/pink2web/
cp -r dist/conf/* build/pink2web_$VERSION/etc/pink2web/
for FILE in `ls dist/hist | grep -v dummy` ; do cp -r $FILE build/pink2web_$VERSION/var/lib/pink2web/hist/ ; done
for FILE in `ls dist/stores | grep -v dummy` ; do cp -r $FILE build/pink2web_$VERSION/var/lib/pink2web/stores/ ; done
cp dist/scripts/post-install.sh build/pink2web_$VERSION/DEBIAN/postinst
cp dist/scripts/pre-uninstall.sh build/pink2web_$VERSION/DEBIAN/prerm
chmod 0755 build/pink2web_$VERSION/DEBIAN/postinst
chmod 0755 build/pink2web_$VERSION/DEBIAN/prerm
ln -s /usr/local/lib/pink2web/bin/pink2web.service build/pink2web_$VERSION/etc/systemd/system/pink2web.service
cd build
dpkg-deb --build pink2web_$VERSION
fi
fi
if [ "$1." == "x86_64." ] ; then
export CC="/usr/bin/clang-11"
corral run -- ponyc -d -Dopenssl_3 --linker=clang-17
if [ "$2." == "release." ] ; then
export VERSION=`git tag | grep ^v | sort -r | head -1 | sed 's/v//' `
echo "Building pinkweb_$VERSION"
mkdir -p build/pink2web_$VERSION/
cd build/pink2web_$VERSION/
mkdir -p DEBIAN
mkdir -p etc/systemd/system/
mkdir -p etc/pink2web/
mkdir -p usr/bin/
mkdir -p usr/local/lib/pink2web/bin/
mkdir -p var/lib/pink2web/processes/
mkdir -p var/lib/pink2web/hist
mkdir -p var/lib/pink2web/stores
mkdir -p var/www/pink2web
cd -
echo "Source: pink2web
Section: other
Priority: optional
Maintainer: Niclas Hedhman <niclas@bali.io>
Uploaders:
Version: $VERSION
Standards-Version: 3.8.3
Package: pink2web
Homepage:
Architecture: amd64
Distribution:
Depends: python-serial
Description: pink2web is a block programming platform, intended for IoT and automation systems.
" >build/pink2web_$VERSION/DEBIAN/control
echo "[Unit]
Description=Pink2Web block programming platform. Contact Bali Automation (https://bali.io) for more information.
[Service]
User=pink2web
Group=nogroup
EnvironmentFile=-/etc/default/pink2web
ExecStart=/usr/local/lib/pink2web/bin/pink2web --info run process --host=192.168.1.111 --startpage=pink2web.html --webdir=/var/www/pink2web /var/lib/pink2web/applications/main.json
Restart=on-failure
[Install]
WantedBy=multi-user.target" >build/pink2web_$VERSION/usr/local/lib/pink2web/bin/pink2web.service
cp pink2web build/pink2web_$VERSION/usr/local/lib/pink2web/bin/pink2web
cp -r frontend/dist/* build/pink2web_$VERSION/var/www/pink2web/
cp -r dist/conf/* build/pink2web_$VERSION/etc/pink2web/
for FILE in `ls dist/hist | grep -v dummy` ; do cp -r $FILE build/pink2web_$VERSION/var/lib/pink2web/hist/ ; done
for FILE in `ls dist/stores | grep -v dummy` ; do cp -r $FILE build/pink2web_$VERSION/var/lib/pink2web/stores/ ; done
cp dist/scripts/post-install.sh build/pink2web_$VERSION/DEBIAN/postinst
cp dist/scripts/pre-uninstall.sh build/pink2web_$VERSION/DEBIAN/prerm
chmod 0755 build/pink2web_$VERSION/DEBIAN/postinst
chmod 0755 build/pink2web_$VERSION/DEBIAN/prerm
ln -s /usr/local/lib/pink2web/bin/pink2web.service build/pink2web_$VERSION/etc/systemd/system/pink2web.service
cd build
dpkg-deb --build pink2web_$VERSION
fi
fi