* fix:(default-flatpaks): Missing notification for system flatpaks This approach, while more fragmented, it's cleaner, as there is a clearer separation of root & non-root operations done by flatpak-setup service. This should probably increase security too (but I'm not the expert to talk seriously about that). It also gets rid of some non-harming error for /var data, can't remember it fully. While it may be confusing for users that they have to type: `systemctl status --user system-flatpak-setup` instead of previous: `systemctl status system-flatpak-setup` It is something worth sacrificing for the important user-experience fix.
40 lines
1.3 KiB
Bash
Executable file
40 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
REPO_INFO="/etc/flatpak/system/repo-info.yml"
|
|
REPO_NAME=$(yq '.repo-name' $REPO_INFO)
|
|
|
|
# Notifications config
|
|
NOTIFICATIONS=$(cat /etc/flatpak/notifications)
|
|
|
|
# Installed flatpaks
|
|
FLATPAK_LIST=$(flatpak list --columns=application)
|
|
|
|
# Flatpak list files
|
|
INSTALL_LIST_FILE="/etc/flatpak/system/install"
|
|
REMOVE_LIST_FILE="/etc/flatpak/system/remove"
|
|
|
|
# Install flatpaks in list
|
|
if [[ -f $INSTALL_LIST_FILE ]]; then
|
|
if [[ -n $FLATPAK_LIST ]]; then
|
|
INSTALL_LIST=$(echo "$FLATPAK_LIST" | grep -vf - "$INSTALL_LIST_FILE")
|
|
else
|
|
INSTALL_LIST=$(cat $INSTALL_LIST_FILE)
|
|
fi
|
|
if [[ -n $INSTALL_LIST ]]; then
|
|
flatpak install --system --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
|
|
if [[ $NOTIFICATIONS == "true" ]]; then
|
|
notify-send "Flatpak Installer" "Finished install of system flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Remove flatpaks in list
|
|
if [[ -f $REMOVE_LIST_FILE ]]; then
|
|
REMOVE_LIST=$(echo "$FLATPAK_LIST" | grep -o -f - "$REMOVE_LIST_FILE")
|
|
if [[ -n $REMOVE_LIST ]]; then
|
|
flatpak uninstall --system --noninteractive ${REMOVE_LIST[@]}
|
|
if [[ $NOTIFICATIONS == "true" ]]; then
|
|
notify-send "Flatpak Installer" "Finished uninstall of system flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL
|
|
fi
|
|
fi
|
|
fi
|