-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflatpak-build.sh
executable file
·48 lines (47 loc) · 1.38 KB
/
flatpak-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
#!/usr/bin/env -S bash
FLATPAK_BUILDER=$(which flatpak-builder)
if [ $? -ne 0 ] ; then
echo "flatpak-builder is not installed." 1>&2
exit 2
fi
SCRIPT_FILE=$(realpath "${0}")
GIT_ROOT_DIR=$(realpath "$(dirname "${SCRIPT_FILE}")")
echo "Building Flatpak image..."
pushd "$GIT_ROOT_DIR" 1>/dev/null
FLATPAK_DEPENDENCIES=(
'org.freedesktop.Platform/x86_64/24.08'
'org.freedesktop.Sdk/x86_64/24.08'
'org.winehq.Wine/x86_64/stable-24.08'
'org.freedesktop.Platform.GL.default/x86_64/24.08'
)
for DEP in "${FLATPAK_DEPENDENCIES[@]}" ; do
echo "Installing dependency $DEP"
flatpak install --user $DEP
done
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest net.azurewebsites.pathos.pathos.yml
if [ $? -ne 0 ] ; then
echo "Did not pass lint tests" 1>&2
exit 2
fi
find ~/.local -iname net.azurewebsites.pathos.pathos\*\.desktop -delete
rm -Rf .flatpak .flatpak-builder repo
test ! -d .flatpak && mkdir -p .flatpak
"${FLATPAK_BUILDER}" --verbose .flatpak/build \
--default-branch=main \
--force-clean \
--keep-build-dirs \
--state-dir=.flatpak/state \
--repo=repo \
net.azurewebsites.pathos.pathos.yml \
--install \
--user
if [ $? -ne 0 ] ; then
echo "Failed to build image" 1>&2
exit 2
fi
popd 1>/dev/null
echo "Flatpak image built successfully"
exit 0
if [ "$1" == 'publish'] ; then
flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo
fi