Skip to content

Commit

Permalink
config: List which Endless Key collections to preload
Browse files Browse the repository at this point in the history
Instead of loading every channel from every collection JSON from the
Endless Key app, allow the image configuration to list which collections
to include.

#117
  • Loading branch information
jprvita committed Sep 27, 2023
1 parent 16d6a11 commit d9a4d59
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ regular_users_can_manage_content = false
# # Kolibri 0.12.2 User Guide for Admins [document]
# 5bb37c1832c8489ab2940f31588305f6

[endlesskey]
# Which Endless Key collections to preload in the image.
# Must match the name of one of the collections shipped with the Endless Key
# (ex. artist, explorer, spanish etc).
collections =

[usb]
size = 16000000000
free_space = 1000
Expand Down
11 changes: 10 additions & 1 deletion hooks/image/51-ek-content-list
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Populate the Endless Key home directory

if [ -z "${EIB_ENDLESSKEY_COLLECTIONS}" ]; then
exit 0
fi

if [[ ! "${EIB_FLATPAK_REMOTE_FLATHUB_APPS}" =~ .*"org.endlessos.Key".* ]]; then
exit 0
fi
Expand All @@ -11,5 +15,10 @@ EK_CHANNELS_FILE="${EIB_TMPDIR}"/ek-channels
rm -f "${EK_CHANNELS_FILE}"
collections="${OSTREE_VAR}"/lib/flatpak/app/org.endlessos.Key/current/active/files/share/endless-key/collections/*.json
for collection in ${collections}; do
jq -r '.channels[].id' "${collection}" >> "${EK_CHANNELS_FILE}"
# 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}"
fi
done

0 comments on commit d9a4d59

Please sign in to comment.