-
Notifications
You must be signed in to change notification settings - Fork 1
/
package
executable file
·73 lines (55 loc) · 2.1 KB
/
package
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
#!/bin/bash
name=boatinstrument
version=$(awk -F '[ :+]*' '/^version:/ {print $2}' pubspec.yaml)
arch=$(dpkg --print-architecture)
[ ${arch} == 'amd64' ] && { pi_opts="--arch=x64"; }
[ ${arch} == 'arm64' ] && { pi_opts="--arch=arm64"; }
if [ "$1" == 'arm' ]
then
shift
arch="armhf"
{ pi_opts="--arch=arm"; }
fi
date=$(date +"%a, %d %b %Y %T %z")
. /etc/os-release
prepackage () (
rm -rf debian
mkdir -p debian/DEBIAN debian/usr/share/doc/${name}
)
package () (
post=$1; shift
deps=$@
m4 -D__NAME__=${name} -D__VERSION__=$version -D__DATE__="$date" changelog.m4 > debian/usr/share/doc/${name}/changelog
cp debian/usr/share/doc/${name}/changelog debian/usr/share/doc/${name}/changelog.Debian
cp copyright debian/usr/share/doc/${name}
gzip --force --best debian/usr/share/doc/${name}/changelog*
size=$(du -s debian | awk '{print $1}')
m4 -D__NAME__=${name} -D__VERSION__=$version -D__RELEASE__=$VERSION_ID -D__ARCH__=${arch} -D__DEPS__="${deps}" -D__POST__=${post} -D__SIZE__=${size} debian-control.m4 > debian/DEBIAN/control
fakeroot dpkg-deb --build debian packages
)
mkdir -p packages
# ================================ Linux ====================================
flutter build linux
if [ ${arch} != "armhf" ]
then
prepackage
cpu=$(uname -m)
mkdir -p debian/usr/share/applications
mv build/linux/${cpu:0:1}*/release/bundle debian/usr/share/${name}
cp name.phil.seeley.boatinstrument.desktop debian/usr/share/applications
package "" libgtk-3-0, libgstreamer-plugins-base1.0-0
fi
# ================================ fpi ======================================
name=${name}-fpi
for pi_cpu in $*
do
flutterpi_tool build --release ${pi_opts} --cpu ${pi_cpu}
prepackage
mkdir -p debian/etc/systemd/system/[email protected] debian/etc/${name}
mv build/flutter_assets debian/usr/share/${name}
echo /etc/${name}/config >debian/DEBIAN/conffiles
cp boatinstrument-fpi debian/usr/share/${name}
cp boatinstrument-fpi-config debian/etc/${name}/config
cp boatinstrument-fpi.getty debian/etc/systemd/system/[email protected]/override.conf
package -${pi_cpu} libgl1-mesa-dri, flutter-pi
done