forked from philseeley/boatinstrument
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package
executable file
·55 lines (43 loc) · 1.93 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
#!/bin/bash
name=boatinstrument
version=$(awk -F '[ :+]*' '/^version:/ {print $2}' pubspec.yaml)
arch=$(uname -m)
[ ${arch} == 'x86_64' ] && { arch=amd64; pi_opts="--arch=x64"; }
[ ${arch} == 'aarch64' ] && { arch=arm64; pi_opts="--arch=arm64 --cpu=pi4"; }
date=$(date +"%a, %d %b %Y %T %z")
. /etc/os-release
prepackage () (
post=$1; shift
rm -rf debian
mkdir -p debian/DEBIAN debian/usr/share/doc/${name}${post}
)
package () (
post=$1; shift
deps=$@
m4 -D__VERSION__=$version -D__DATE__="$date" -D__POST__=${post} changelog.m4 > debian/usr/share/doc/${name}${post}/changelog
cp debian/usr/share/doc/${name}${post}/changelog debian/usr/share/doc/${name}${post}/changelog.Debian
cp copyright debian/usr/share/doc/${name}${post}
gzip --force --best debian/usr/share/doc/${name}${post}/changelog*
size=$(du -s debian | awk '{print $1}')
m4 -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
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
# ================================ flutter-pi ====================================
flutterpi_tool build --release ${pi_opts}
post=-flutter-pi
prepackage ${post}
mkdir -p debian/etc/systemd/system/getty@tty1.service.d
mv build/flutter_assets debian/usr/share/${name}${post}
cp debian-postinst debian/DEBIAN/postinst
cp boatinstrument-flutter-pi debian/usr/share/${name}${post}
cp boatinstrument-flutter-pi.getty debian/etc/systemd/system/getty@tty1.service.d/override.conf
package ${post} libgl1-mesa-dri, flutter-pi