Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flatpak comparison in ujust script #172

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions just/aurora-system.just
Original file line number Diff line number Diff line change
Expand Up @@ -216,27 +216,31 @@ configure-vfio ACTION="":
[group('System')]
[private]
install-system-flatpaks CURR_LIST_FILE="":
#!/usr/bin/bash
#!/usr/bin/env bash
CURR_LIST_FILE={{ CURR_LIST_FILE }}
IMAGE_NAME=$(jq -r '."image-name"' < "/usr/share/ublue-os/image-info.json")
FLATPAK_LIST="$(curl https://raw.githubusercontent.com/ublue-os/aurora/main/aurora_flatpaks/flatpaks | tr '\n' ' ')"
flatpak --system -y install --or-update ${FLATPAK_LIST}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no clue how this got through lol

FLATPAK_LIST=($(curl https://raw.githubusercontent.com/ublue-os/aurora/main/aurora_flatpaks/flatpaks))
Copy link

@etvt etvt Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible / would it make sense to put these files in the image instead of downloading them every time from the internet, in order to:

  1. avoid depending on internet connection to githubusercontent.com on every boot
  2. only consider the historical version of the recommended flatpak list that was active at the point in time when the image was built.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah we could curl the list in build time into /usr/share/ublue-os and compare against that in the recipe. I do like that approach much more, on it!


if [[ ${IMAGE_NAME} =~ "dx" ]]; then
DX_FLATPAKS="$(curl https://raw.githubusercontent.com/ublue-os/aurora/main/dx_flatpaks/flatpaks | tr '\n' ' ')"
FLATPAK_LIST="${FLATPAK_LIST} ${DX_FLATPAKS}"
FLATPAK_LIST+=($(curl https://raw.githubusercontent.com/ublue-os/aurora/main/dx_flatpaks/flatpaks))
fi

if [[ -n ${CURR_LIST_FILE} ]]; then
CURRENT_FLATPAK_LIST=$(cat "${CURR_LIST_FILE} 2>/dev/null")
# get flatpaks that are in FLATPAK_LIST but not in CURRENT_FLATPAK_LIST
NEW_FLATPAKS=$(comm -23 <(sort "${FLATPAK_LIST}") <(sort "${CURRENT_FLATPAK_LIST}"))
if [[ -n ${NEW_FLATPAKS} ]]; then
flatpak --system -y install --or-update ${NEW_FLATPAKS}
echo "${FLATPAK_LIST}" > "${CURR_LIST_FILE}"
if [[ -f "${CURR_LIST_FILE}" ]]; then
mapfile -t CURRENT_FLATPAK_LIST < "${CURR_LIST_FILE}"
# convert arrays to sorted newline-separated strings to compare lists and get new flatpaks
NEW_FLATPAKS=($(comm -23 <(printf "%s\n" "${FLATPAK_LIST[@]}" | sort) <(printf "%s\n" "${CURRENT_FLATPAK_LIST[@]}" | sort)))
if [[ ${#NEW_FLATPAKS[@]} -gt 0 ]]; then
flatpak --system -y install --or-update "${NEW_FLATPAKS[@]}"
printf "%s\n" "${FLATPAK_LIST[@]}" > "${CURR_LIST_FILE}"
notify-send "Welcome to Aurora" "New flatpak apps have been installed!" --app-name="Flatpak Manager Service" -u NORMAL
fi
else
printf "%s\n" "${FLATPAK_LIST[@]}" > "${CURR_LIST_FILE}"
flatpak --system -y install --or-update "${FLATPAK_LIST[@]}"
fi
else
flatpak --system -y install --or-update ${FLATPAK_LIST}
flatpak --system -y install --or-update "${FLATPAK_LIST[@]}"
fi

# Configure grub bootmenu visibility
Expand Down
Loading