-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_deb.sh
More file actions
executable file
·75 lines (63 loc) · 2.26 KB
/
Copy pathbuild_deb.sh
File metadata and controls
executable file
·75 lines (63 loc) · 2.26 KB
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
#!/usr/bin/env bash
# Build Querya-Desktop-*.deb from a Flutter linux release bundle (Debian/Ubuntu).
#
# Usage:
# ./scripts/linux/build_deb.sh [bundle_dir] [output_deb]
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
BUNDLE="${1:-$ROOT/build/linux/x64/release/bundle}"
BINARY_NAME="querya_desktop"
ICON_SRC="$ROOT/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png"
if [[ ! -d "$BUNDLE" ]]; then
echo "error: Flutter linux bundle not found: $BUNDLE" >&2
exit 1
fi
if [[ ! -x "$BUNDLE/$BINARY_NAME" ]]; then
echo "error: missing executable: $BUNDLE/$BINARY_NAME" >&2
exit 1
fi
if ! command -v dpkg-deb >/dev/null 2>&1; then
echo "error: dpkg-deb is required (apt install dpkg)" >&2
exit 1
fi
VERSION="$(grep '^version:' "$ROOT/pubspec.yaml" | sed 's/^version: //; s/+.*//')"
OUT="${2:-$ROOT/Querya-Desktop-${VERSION}-linux.deb}"
ARCH="$(dpkg --print-architecture 2>/dev/null || echo amd64)"
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/querya-deb.XXXXXX")"
cleanup() { rm -rf "$WORKDIR"; }
trap cleanup EXIT
PKG="$WORKDIR/pkg"
INSTALL_ROOT="$PKG/opt/querya-desktop"
mkdir -p \
"$INSTALL_ROOT" \
"$PKG/usr/bin" \
"$PKG/usr/share/applications" \
"$PKG/usr/share/icons/hicolor/512x512/apps" \
"$PKG/DEBIAN"
cp -a "$BUNDLE"/. "$INSTALL_ROOT/"
chmod +x "$INSTALL_ROOT/$BINARY_NAME"
ln -s "/opt/querya-desktop/$BINARY_NAME" "$PKG/usr/bin/$BINARY_NAME"
if [[ -f "$ICON_SRC" ]]; then
cp "$ICON_SRC" "$PKG/usr/share/icons/hicolor/512x512/apps/${BINARY_NAME}.png"
fi
cp "$ROOT/packaging/linux/querya_desktop.desktop" \
"$PKG/usr/share/applications/${BINARY_NAME}.desktop"
# Rough installed size in KiB for the control file.
INSTALLED_SIZE="$(du -sk "$PKG" | awk '{print $1}')"
cat > "$PKG/DEBIAN/control" <<EOF
Package: querya-desktop
Version: ${VERSION}
Section: database
Priority: optional
Architecture: ${ARCH}
Maintainer: QueryaHub <noreply@querya.app>
Installed-Size: ${INSTALLED_SIZE}
Depends: libgtk-3-0, libsecret-1-0, libglib2.0-0
Recommends: libayatana-appindicator3-1
Homepage: https://github.com/QueryaHub/Querya-Desktop
Description: Querya Desktop database client
Multi-database desktop client for PostgreSQL, MySQL, Redis, MongoDB,
SQLite, and sandboxed drivers.
EOF
dpkg-deb --root-owner-group --build "$PKG" "$OUT"
echo "Wrote $OUT"