feat(default-flatpaks): Add info about which flatpaks are installed (#85)
* feat(default-flatpaks): Add info about which flatpaks are installed & uninstalled in notification. Also implement notification enable/disable config support. * feat(default-flatpaks): Add support for configuring notifications in recipe file * fix(default-flatpaks): Formatting fixes * fix(default-flatpaks): Fix "enabling" typo instead of "configuring" notifications * chore(default-flatpaks): Remove unused yq command * fix(default-flatpaks): There is no need for 2 double quotes
This commit is contained in:
parent
623834bb3b
commit
bd92e7e5c5
4 changed files with 26 additions and 6 deletions
13
files/usr/bin/system-flatpak-setup
Executable file → Normal file
13
files/usr/bin/system-flatpak-setup
Executable file → Normal file
|
|
@ -41,6 +41,9 @@ if [[ ! $REPO_TITLE == "null" ]]; then
|
|||
echo "Setting title $REPO_TITLE for remote $REPO_NAME"
|
||||
fi
|
||||
|
||||
# Notifications config
|
||||
NOTIFICATIONS=$(cat /etc/flatpak/notifications)
|
||||
|
||||
# Installed flatpaks
|
||||
FLATPAK_LIST=$(flatpak list --columns=application)
|
||||
|
||||
|
|
@ -57,7 +60,9 @@ if [[ -f $INSTALL_LIST_FILE ]]; then
|
|||
fi
|
||||
if [[ -n $INSTALL_LIST ]]; then
|
||||
flatpak install --system --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
|
||||
notify-send "Flatpak Installer" "Finished install of system flatpaks" --app-name="Flatpak Installer" -u NORMAL
|
||||
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
|
||||
|
||||
|
|
@ -66,8 +71,8 @@ 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[@]}
|
||||
notify-send "Flatpak Installer" "Finished uninstall of system flatpaks" --app-name="Flatpak Installer" -u NORMAL
|
||||
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
|
||||
|
||||
|
||||
|
|
|
|||
11
files/usr/bin/user-flatpak-setup
Executable file → Normal file
11
files/usr/bin/user-flatpak-setup
Executable file → Normal file
|
|
@ -23,6 +23,9 @@ if [[ ! $REPO_TITLE == "null" ]]; then
|
|||
echo "Setting title $REPO_TITLE for remote $REPO_NAME"
|
||||
fi
|
||||
|
||||
# Notifications config
|
||||
NOTIFICATIONS=$(cat /etc/flatpak/notifications)
|
||||
|
||||
# Installed flatpaks
|
||||
FLATPAK_LIST=$(flatpak list --columns=application)
|
||||
|
||||
|
|
@ -39,7 +42,9 @@ if [[ -f $INSTALL_LIST_FILE ]]; then
|
|||
fi
|
||||
if [[ -n $INSTALL_LIST ]]; then
|
||||
flatpak install --user --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
|
||||
notify-send "Flatpak Installer" "Finished install of user flatpaks" --app-name="Flatpak Installer" -u NORMAL
|
||||
if [[ $NOTIFICATIONS == "true" ]]; then
|
||||
notify-send "Flatpak Installer" "Finished install of user flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -48,6 +53,8 @@ if [[ -f $REMOVE_LIST_FILE ]]; then
|
|||
REMOVE_LIST=$(echo "$FLATPAK_LIST" | grep -o -f - "$REMOVE_LIST_FILE")
|
||||
if [[ -n $REMOVE_LIST ]]; then
|
||||
flatpak uninstall --user --noninteractive ${REMOVE_LIST[@]}
|
||||
notify-send "Flatpak Installer" "Finished uninstall of user flatpaks" --app-name="Flatpak Installer" -u NORMAL
|
||||
if [[ $NOTIFICATIONS == "true" ]]; then
|
||||
notify-send "Flatpak Installer" "Finished uninstall of user flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@ The scripts are run on every boot by these services:
|
|||
|
||||
This module stores the Flatpak remote configuration and Flatpak install/remove lists in `/etc/flatpak/`. There are two subdirectories, `user` and `system` corresponding with the install level of the Flatpaks and repositories. Each directory has text files containing the IDs of flatpaks to `install` and `remove`, plus a `repo-info.yml` containing the details of the Flatpak repository.
|
||||
|
||||
This module also supports disabling & enabling notifications.
|
||||
|
||||
## Example configurations
|
||||
|
||||
```yaml
|
||||
type: default-flatpaks
|
||||
notify: true # Send notification after install/uninstall is finished (true/false)
|
||||
system:
|
||||
# If no repo information is specified, Flathub will be used by default
|
||||
repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
|
|
|||
|
|
@ -118,3 +118,8 @@ if [[ ! $(echo "$1" | yq -I=0 ".user") == "null" ]]; then
|
|||
configure_flatpak_repo "$1" "user"
|
||||
configure_lists "$1" "user"
|
||||
fi
|
||||
|
||||
echo "Configuring default-flatpaks notifications"
|
||||
NOTIFICATIONS=$(yq ".notify" "$CONFIG_FILE")
|
||||
NOTIFICATIONS_CONFIG_FILE="/usr/etc/flatpak/notifications"
|
||||
echo "$NOTIFICATIONS" > "$NOTIFICATIONS_CONFIG_FILE"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue