Skip to content

Commit

Permalink
fix(yafti): Populating custom flatpaks
Browse files Browse the repository at this point in the history
It's populated in reverse order compared to the format in recipe, but it works
  • Loading branch information
fiftydinar authored Dec 1, 2024
1 parent c20a6f4 commit 14308e0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/yafti/yafti.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@ fi

YAFTI_FILE="${FIRSTBOOT_DATA}/yafti.yml"

get_json_array FLATPAKS 'try .["custom-flatpaks"][]' "$1"
get_yaml_array FLATPAKS '.custom-flatpaks[]' "$1"
if [[ ${#FLATPAKS[@]} -gt 0 ]]; then
echo "Adding Flatpaks to yafti.yml"
sed -i '/^ Custom:/,/^ / s/description: .*/description: "Flatpaks suggested by the image maintainer."/' "${YAFTI_FILE}"
sed -i '/^ Custom:/,/^ / s/default: .*/default: true/' "${YAFTI_FILE}"
sed -i -e '/- Boatswain for Streamdeck: com.feaneron.Boatswain/a \
Custom:\n description: Flatpaks suggested by the image maintainer.\n default: true' "${YAFTI_FILE}"

for pkg in "${FLATPAKS[@]}"; do
echo "Adding to yafti: ${pkg}"
sed -i "/^ packages:/a\ \ - $pkg" "${YAFTI_FILE}"
sed -i '/^[[:space:]]*Custom:/ {
n; n; n;
i\
- REPLACEMEHERE
}' "${YAFTI_FILE}"
sed -i "s/ - REPLACEMEHERE/ - ${pkg}/g" "${YAFTI_FILE}"
done
fi

0 comments on commit 14308e0

Please sign in to comment.