Skip to content

Commit

Permalink
Merge pull request #121 from endlessm/sort-and-dedup-ek-channels
Browse files Browse the repository at this point in the history
image: ek-content-list: Sort and dedup channel list
  • Loading branch information
dbnicholson authored Oct 6, 2023
2 parents 54e3409 + 7e466dc commit b672e38
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hooks/image/51-ek-content-list
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ fi
# hooks/image/53-ek-content-preload
EK_CHANNELS_FILE="${EIB_TMPDIR}"/ek-channels

rm -f "${EK_CHANNELS_FILE}"
rm -f "${EK_CHANNELS_FILE}" "${EK_CHANNELS_FILE}.tmp"
collections="${OSTREE_VAR}"/lib/flatpak/app/org.endlessos.Key/current/active/files/share/endless-key/collections/*.json
for collection in ${collections}; do
# Check if the file basename stripped off of -0001.json is part of the list
# of collections to be installed.
bn=$(basename ${collection})
if [[ "${EIB_ENDLESSKEY_COLLECTIONS}" =~ .*"${bn%-????.json}".* ]] ; then
jq -r '.channels[].id' "${collection}" >> "${EK_CHANNELS_FILE}"
jq -r '.channels[].id' "${collection}" >> "${EK_CHANNELS_FILE}.tmp"
fi
done
if [ -f "${EK_CHANNELS_FILE}.tmp" ]; then
sort -u "${EK_CHANNELS_FILE}.tmp" > "${EK_CHANNELS_FILE}"
fi

0 comments on commit b672e38

Please sign in to comment.