Skip to content

Commit ef2cd52

Browse files
committed
Use linter in container if one doesn't exist natively
1 parent 20316fd commit ef2cd52

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

installers/flatpak/create_flatpak.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,18 @@ run_script() {
3636
return 1
3737
fi
3838

39-
if ! flatpak-builder-lint manifest space.oolite.Oolite.yaml; then
40-
echo "❌ Flatpak manifest lint failed!" >&2
41-
return 1
39+
MANIFEST="space.oolite.Oolite.yaml"
40+
if command -v flatpak-builder-lint >/dev/null 2>&1; then
41+
if ! flatpak-builder-lint manifest "$MANIFEST"; then
42+
echo "❌ Flatpak manifest lint failed!" >&2
43+
return 1
44+
fi
45+
else
46+
echo "Native linter not found. Falling back to Flatpak container..."
47+
if ! flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest "$MANIFEST"; then
48+
echo "❌ Flatpak manifest lint failed!" >&2
49+
return 1
50+
fi
4251
fi
4352

4453
echo "Creating Flatpak..."
@@ -51,11 +60,11 @@ run_script() {
5160
fi
5261

5362
sed -i "/- name: oolite/a \ build-options:\n env:\n VERSION_OVERRIDE: \"$VER\"" \
54-
space.oolite.Oolite.yaml
55-
TOTAL_LINES=$(wc -l < space.oolite.Oolite.yaml)
63+
$MANIFEST
64+
TOTAL_LINES=$(wc -l < $MANIFEST)
5665
START_LINE=$((TOTAL_LINES - 3))
57-
sed -i "${START_LINE},\$d" space.oolite.Oolite.yaml
58-
cat <<EOF >> space.oolite.Oolite.yaml
66+
sed -i "${START_LINE},\$d" $MANIFEST
67+
cat <<EOF >> $MANIFEST
5968
- type: dir
6069
path: ../
6170
EOF
@@ -66,7 +75,7 @@ EOF
6675
--install-deps-from=flathub \
6776
--disable-rofiles-fuse \
6877
build-dir \
69-
space.oolite.Oolite.yaml; then
78+
$MANIFEST; then
7079
echo "❌ Flatpak build failed!" >&2
7180
return 1
7281
fi

0 commit comments

Comments
 (0)