diff --git a/config/defaults.ini b/config/defaults.ini index 5210b540..d5cc476a 100644 --- a/config/defaults.ini +++ b/config/defaults.ini @@ -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 diff --git a/hooks/image/51-ek-content-list b/hooks/image/51-ek-content-list index 7e80bd45..f22f492d 100644 --- a/hooks/image/51-ek-content-list +++ b/hooks/image/51-ek-content-list @@ -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 @@ -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